User:Ambrosia10/Query

New Zealand edit

New Zealand women edit

The following query uses these:

  • Properties: instance of (P31)     , sex or gender (P21)     , place of birth (P19)     , located in the administrative territorial entity (P131)     , date of birth (P569)     , date of death (P570)     , place of death (P20)     
    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:

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

The following query uses these:

  • Properties: invasive to (P5588)     
    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: