User:Ambrosia10/Query

From Wikidata
Jump to navigation Jump to search

New Zealand[edit]

New Zealand women[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, sex or gender (P21)  View with Reasonator View with SQID, place of birth (P19)  View with Reasonator View with SQID, located in the administrative territorial entity (P131)  View with Reasonator View with SQID, date of birth (P569)  View with Reasonator View with SQID, date of death (P570)  View with Reasonator View with SQID, place of death (P20)  View with Reasonator View with SQID
    SELECT ?item ?statements (COUNT(distinct ?sitelink) as ?sites) ?itemLabel ?birth ?pobLabel ?death ?podLabel
    WHERE {
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }	# for generating label
    BIND(xsd:integer(STRAFTER(str(?item), "Q")) AS ?qid) .   ?item wikibase:statements ?statements . # for counting statements
    OPTIONAL { ?sitelink schema:about ?item . ?sitelink schema:inLanguage ?lang } # for counting sitelinks
    	?item wdt:P31 wd:Q5 . 	# item = humans only
      	?item wdt:P21 wd:Q6581072 .		  # gender = female only
    	{ ?item wdt:P19 wd:Q664 }		# place of birth = New Zealand (Q664) 
    		UNION  { ?item wdt:P19 ?pob . ?pob wdt:P131* wd:Q664 } 	# OR place of birth within New Zealand. 
    					OPTIONAL { ?item wdt:P569 ?birth  }
      					OPTIONAL { ?item wdt:P19 ?pob  }
      					OPTIONAL { ?item wdt:P570 ?death  }
      					OPTIONAL { ?item wdt:P20 ?pod  }
    	}
    GROUP BY ?item ?statements ?itemLabel ?birth ?pobLabel ?death ?podLabel
    ORDER BY DESC(?sites)
    

Paintings by Charles Heaphy[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, creator (P170)  View with Reasonator View with SQID
    #Paintings by Charles Heaphy
    SELECT * WHERE {
      ?item wdt:P31 wd:Q3305213.
      ?item wdt:P170 wd:Q1064767.  
    }
    

Invasive species of New Zealand & whether they have an English wikipedia article[edit]

The following query uses these:

  • Properties: invasive to (P5588)  View with Reasonator View with SQID
    SELECT ?taxon ?taxonLabel ?en WHERE {
      BIND(IF(BOUND(?english), "+", "-") AS ?en)
      {
        SELECT ?taxon ?taxonLabel ?english WHERE {
          ?taxon wdt:P5588 wd:Q664.
          OPTIONAL {
            ?english schema:about ?taxon.
            FILTER(REGEX(STR(?english), "https://en.wikipedia"))
          }
          SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
        }
      }
    }
    

images of endemic species Lepidoptera of New Zealand[edit]

The following query uses these:

New Zealand libraries[edit]

The following query uses these: