User:MarioGom

From Wikidata
Jump to navigation Jump to search

Resources[edit]

Tasks[edit]

Queries[edit]

Commons[edit]

Russian photographers death before 1946
SELECT ?item
WHERE {
  { ?item wdt:P106 wd:Q33231 . }
  UNION { ?item wdt:P106/wdt:P279 wd:Q33231 . }
  ?item wdt:P570 ?dod .
  FILTER(?dod < "1942-01-01"^^xsd:dateTime)
  ?item wdt:P27|wdt:P17 ?country .
  VALUES ?country {
    wd:Q34266 # Russian Empire
    wd:Q15180 # Soviet Union
    wd:Q2184 # RSFS
    wd:Q159 # Russia
  }
}
Try it!

Tools[edit]

Statement without qualifiers or references (useful for safe QuickStatements)
SELECT ?item {
  ?item wdt:P21 wd:Q6581072 .
  ?item wdt:P27 wd:Q17 .
  ?item p:P735 ?givenStmt .
  ?givenStmt ps:P735 wd:Q19810348 .
  FILTER NOT EXISTS {
    ?givenStmt ?pred ?obj .
    ?prop wikibase:qualifier ?pred .
  }
  FILTER NOT EXISTS {
    ?givenStmt prov:wasDerivedFrom ?ref 
  }
}
LIMIT 200
Try it!
Potential duplicates (ORCID vs ZooBank imports)
SELECT ?itemA ?itemALabel ?itemB ?itemBLabel
WHERE {
{
  SELECT DISTINCT ?itemA ?itemB ?itemALabel ?itemBLabel
    WHERE {
      {
        SELECT ?itemA ?itemB
        WHERE {
          hint:Query hint:optimizer "None" .

          ?itemA wdt:P2006 ?zoobankA .
          ?itemA wdt:P735 ?givenA .
          FILTER(?givenA NOT IN (
            wd:Q4925477, # John (male)
            wd:Q4927937 # Robert (male)
          ))
          ?itemA wdt:P734 ?familyA .
          FILTER(?familyA NOT IN (
            wd:Q1158446 # Smith
          ))
          OPTIONAL { ?itemA wdt:P496 ?orcidA . }
          FILTER(!BOUND(?orcidA))
          OPTIONAL { ?itemA wdt:P569 ?dobA . }
          FILTER(!BOUND(?dobA)|
Try it!

Given names[edit]

Redundant María in José María

María should be removed in favor of José María (Q18755442).

SELECT DISTINCT ?item
WHERE {
  ?item wdt:P735 wd:Q18755442 .
  { ?item wdt:P735 wd:Q18088640 . }
  UNION { ?item wdt:P735 wd:Q56842555 . }
}
Try it!
María in male compound names without series ordinal
SELECT DISTINCT ?item
WHERE {
  { ?item wdt:P735 wd:Q18088640 . }
  UNION { ?item wdt:P735 wd:Q56842555 . }
  ?item wdt:P21 wd:Q6581097 .
  ?item p:P735 ?statement .
  FILTER NOT EXISTS { ?statement pq:P1545 ?ordinal . }
}
Try it!
Mari in Spain

Mari is usually an hypocorism.

SELECT DISTINCT ?item ?itemLabel 
WHERE {
  {
  SELECT ?item
    WHERE {
      ?item wdt:P21 wd:Q6581072 .
      ?item wdt:P735 wd:Q3195783 . # Mari (male)
      ?item wdt:P27 wd:Q29 . # Spain
  }
  LIMIT 200
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!
Top Spanish given name without property assigned
SELECT ?givenCandidate (COUNT(?item) AS ?count) WHERE {
  {
    SELECT ?item ?itemLabel WHERE {
      {
        SELECT ?item WHERE {
          ?item wdt:P27 wd:Q29;
            wdt:P31 wd:Q5.
          FILTER(NOT EXISTS { ?item wdt:P735 ?given. })
        }
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
    }
  }
  BIND(STRBEFORE(STR(?itemLabel), " ") AS ?givenCandidate)
}
GROUP BY ?givenCandidate
ORDER BY DESC(COUNT(?item))
Try it!

Detecting misgendering[edit]

Top male given names used in females
SELECT ?given ?count
WHERE {

SELECT ?given (COUNT(DISTINCT ?item) AS ?count)
WHERE {
  hint:Query hint:optimizer "None" .
  ?item wdt:P21 wd:Q6581072 . # is female
  ?item wdt:P735 ?given .
  
  ?given wdt:P31 wd:Q12308941 . # has male given name'
  FILTER NOT EXISTS { ?given wdt:P31 wd:Q11879590 . } # not unisex

  # filter out The Peerage entries, too many wrong entries,
  # it should be handled separately
  OPTIONAL { ?item wdt:P4638 ?thepeerageid . }
  FILTER(!BOUND(?thepeerageid))
      
  # Prioritize cases with sitelinks at the moment
  ?item wikibase:sitelinks ?linkcount .
  FILTER (?linkcount >= 1)
}
GROUP BY ?given

}
ORDER BY DESC(?count)
Try it!
Suspicous items (WIP)
SELECT ?item ?itemLabel ?given
WHERE {
  {
  SELECT ?item ?given
    WHERE {
      ?item wdt:P21 wd:Q6581072 . # is female
      ?item wdt:P735 ?given .
      ?given wdt:P31 wd:Q12308941 . # has male given name'
      FILTER NOT EXISTS { ?given wdt:P31 wd:Q11879590 . }
  
      FILTER (?given NOT IN (
        wd:Q6410090, # Kimi - needs a new item for female given name
        wd:Q533503, # Edy - usually a hypocorism, may need female given name
        wd:Q416744, # Willy
        wd:Q263116, # Micha - needs a new item for female given name
        wd:Q256463 # Pascal - needs a new item for female given name
      ))
      
      # filter out The Peerage entries, too many wrong entries
      FILTER NOT EXISTS { ?item wdt:P4638 ?thepeerageid . }
  }
  LIMIT 200
  }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!
Marian (general)
SELECT ?item ?itemLabel 
WHERE {
  {
  SELECT ?item
    WHERE {
  ?item wdt:P21 wd:Q6581072 .
  ?item wdt:P735 wd:Q545486 .
  }
  LIMIT 200
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!
Marian (Polish)
SELECT ?item ?itemLabel 
WHERE {
  {
  SELECT ?item
    WHERE {
      ?item wdt:P21 wd:Q6581072 .
      ?item wdt:P735 wd:Q20155725 . # Marian (female)
      {
        # articles in plwiki only
        ?item wikibase:sitelinks ?linkcount .
        FILTER(?linkcount = 1)
        ?link schema:about ?item ; schema:inLanguage "pl" .
      }
      UNION
      {
        # combined with a second Polish male given name
        ?item wdt:P735 ?given .
        ?given wdt:P31 wd:Q12308941 .
        ?given wdt:P407 wd:Q809 .
      }
      UNION
      {
        # combined with a Polish family name
        ?item wdt:P734 ?family .
        ?family wdt:P407 wd:Q809 .
      }
      UNION
      {
        # combined with a Polish birth place
        ?item wdt:P19 ?birthPlace .
        ?birthPlace wdt:P17 wd:Q36 .
      }
      UNION
      {
        # combined with Polish citizenship
        ?item wdt:P27 wd:Q36 .
      }
  }
  LIMIT 50
  }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!
Maria (female)

For females, use Maria (Q325872) or María (Q18088640).

SELECT ?item ?itemLabel 
WHERE {
  {
  SELECT ?item
    WHERE {
      ?item wdt:P21 wd:Q6581072 .
      ?item wdt:P735 wd:Q25413386 . # Maria (male)
  }
  LIMIT 200
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!
Isa (Turkish)

İsa (Q18536346) is sometimes confused with Isa (Q60883416).

SELECT ?item ?itemLabel 
WHERE {
  {
  SELECT ?item
    WHERE {
      ?item wdt:P21 wd:Q6581072 .
      ?item wdt:P735 wd:Q18536346 . # İsa (male, Turkish)
  }
  LIMIT 200
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Try it!

Countries with Wikipedia article in Catalonian and Euskera but not in Spanish[edit]

PREFIX schema: <http://schema.org/>
SELECT DISTINCT ?item ?linkCount ?wca ?weu
WHERE
{
  ?item wdt:P31/wdt:P279* wd:Q6256 .
  ?item wikibase:sitelinks ?linkCount .
  ?weu schema:about ?item .
  ?weu schema:inLanguage "eu" .
  ?wca schema:about ?item .
  ?wca schema:inLanguage "ca" .
  OPTIONAL { ?wes schema:about ?item . ?wes schema:inLanguage "es" }
  FILTER (!BOUND(?wes))
  #OPTIONAL { ?wen schema:about ?item . ?wen schema:inLanguage "en" }
  #FILTER (!BOUND(?wen))
}
Try it!

Left-wing entities with no Wikipedia article in Spanish ordered by linkcount[edit]

PREFIX schema: <http://schema.org/>
SELECT DISTINCT ?item ?itemLabel ?linkCount ?wen
WHERE
{
  ?item wdt:P1142*/wdt:P1387*/wdt:P361* wd:Q164597 .
  ?item wikibase:sitelinks ?linkCount .
  OPTIONAL { ?wen schema:about ?item . ?wen schema:inLanguage "en" . ?wen schema:isPartOf <https://en.wikipedia.org/> . }
  OPTIONAL { ?wes schema:about ?item . ?wes schema:inLanguage "es" }
  FILTER (!BOUND(?wes))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,pt,fr,it,ca" }
}
ORDER BY DESC(?linkCount)
Try it!

Marxist women in English Wikipedia not present in Spanish Wikipedia[edit]

PREFIX schema: <http://schema.org/>
SELECT DISTINCT ?item ?itemLabel ?linkCount
WHERE
{
  ?item wdt:P21 wd:Q6581072 .
  ?item wdt:P102*/wdt:P1142*/wdt:P1387*/wdt:P361* wd:Q7264 .
  ?item wikibase:sitelinks ?linkCount .
  ?wen schema:about ?item .
  ?wen schema:inLanguage "en" .
  ?wen schema:isPartOf <https://en.wikipedia.org/> .
  OPTIONAL { ?wes schema:about ?item . ?wes schema:inLanguage "es" }
  FILTER (!BOUND(?wes))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,pt,fr,it,ca" }
}
ORDER BY DESC(?linkCount)
Try it!

All items related to Marxism ordered by linkcount[edit]

# Items related to marxism.
#
# NOTE: Results include articles about people that is
#       barely related to marxism or that is plainly
#       anti-marxism. Take them with a grain of salt.

PREFIX schema: <http://schema.org/>
SELECT DISTINCT ?item ?itemLabel ?linkCount
WHERE
{
  ?item (wdt:P102|wdt:P1142|wdt:P1387|wdt:P361|wdt:P1269|wdt:P31)+ wd:Q7264 .
  ?item wikibase:sitelinks ?linkCount .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,fr,it,es" }
}
ORDER BY DESC(?linkCount)
Try it!

People born in the XX century with a Featured Article in Spanish[edit]

PREFIX schema: <http://schema.org/>

SELECT ?sitelink ?itemLabel ?birthyear WHERE {
  ?item wdt:P31 wd:Q5.
  ?item wdt:P569 ?birth.
  BIND(YEAR(?birth) as ?birthyear).
  ?sitelink schema:isPartOf <https://es.wikipedia.org/>.
  ?sitelink schema:about ?item.
  ?sitelink wikibase:badge wd:Q17437796.
  FILTER (?birthyear >= 1900).
  FILTER (?birthyear < 2000).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],es". }
}
ORDER BY ?itemLabel
Try it!

People killed by law enforcement agencies[edit]

SELECT ?human ?humanLabel
WHERE {
  ?human wdt:P157 ?killer.
  ?killer (wdt:P31/wdt:P279*) wd:Q732717
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
Try it!

Organizations funded by the National Endowment for Democracy[edit]

PREFIX schema: <http://schema.org/>
SELECT DISTINCT ?item ?itemLabel ?linkCount
WHERE
{
  ?item (wdt:P859|wdt:P1962)* wd:Q1422577 .
  ?item wikibase:sitelinks ?linkCount .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,pt,fr,it,ca,es" }
}
ORDER BY DESC(?linkCount)
Try it!

Wikimedia benefactors[edit]

PREFIX schema: <http://schema.org/>
SELECT DISTINCT ?item ?itemLabel ?linkCount
WHERE
{
  wd:Q180 wdt:P859 ?item .
  ?item wikibase:sitelinks ?linkCount .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de,pt,fr,it,ca" }
}
ORDER BY DESC(?linkCount)
Try it!

Marxism concepts (work in progress)[edit]

SELECT ?item WHERE {
  #?item wdt:P31 ?instance .
  #VALUES ?instance {
  #  wd:Q151885
  #  wd:Q33104069
  #  wd:Q7257
  #  wd:Q12909644
  #  wd:Q1401304
  #}
  {
    ?item wdt:P361 ?current .
    VALUES ?current {
      wd:Q7272
      wd:Q7264
      wd:Q211930
      wd:Q18127879
      wd:Q167651
      wd:Q181133
      wd:Q6186
    }
  } UNION {
    ?item wdt:P135 ?movement .
    VALUES ?movement {
      wd:Q7272
      wd:Q7264
      wd:Q211930
      wd:Q18127879
      wd:Q167651
      wd:Q181133
      wd:Q6186
    }
  }
  FILTER (NOT EXISTS { ?item wdt:P31 wd:Q5 })
  FILTER (NOT EXISTS { ?item wdt:P31/wdt:P279* wd:Q43229 })
 }
Try it!