User:MartinPoulter/queries/botany

See type locality (biology) (P5304). List at Template:Taxonomy_properties

Depictions of species that are part of the Trifolium genus edit

#title:Paintings of plant species that are in the Trifolium genus
SELECT ?speciesname ?artistLabel (URI(CONCAT("https://eol.org/pages/",?eol_id)) AS ?eol_link) ?url WHERE {
?species wdt:P171 wd:Q101538; # Species' parent taxon is Trifolium
         wdt:P225 ?speciesname.
?work wdt:P180 ?species; wdt:P170 ?artist; wdt:P953 ?url.
?species wdt:P830 ?eol_id
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Paintings of plant species that are in the Trifolium genus

Art works by Ferdinand Bauer edit

SELECT ?item ?itemLabel ?typeLabel WHERE {
?item wdt:P170 wd:Q79012; wdt:P31 ?type
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER by ?itemLabel
Try it!

Species and the number of Bauer works that depict them edit

SELECT ?name ?taxon (COUNT(?item) as ?count) WHERE {
?item wdt:P170 wd:Q79012. # work by Bauer
?item wdt:P180 ?taxon.  # depicting a species
?taxon wdt:P225 ?name   # taxon name of species
} GROUP BY ?name ?taxon
ORDER by DESC(?count) ?name
Try it!

Drawings in "Mediterranean Scenes" and what they depict edit

SELECT ?work ?workLabel ?page ?place ?placeLabel (URI(CONCAT("http://www.geonames.org/",?geoname)) AS ?geoname_url) ?coords WHERE { ?work p:P361 [ps:P361 wd:Q54854779; pq:P304 ?page].
OPTIONAL {?work wdt:P180 ?place
OPTIONAL {?place wdt:P1566 ?geoname}
OPTIONAL {?place wdt:P625 ?coords}
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} ORDER by xsd:integer(?page)
Try it!

Map of locations depicted in "Mediterranean Scenes" edit

SELECT ?work ?workLabel ?page ?coords ?itemLabel WHERE {
?work p:P361 [ps:P361 wd:Q54854779; pq:P304 ?page].
?work wdt:P180 ?item. ?item wdt:P625 ?coords
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
Try it!

Art works by Ferdinand Bauer without a "depicts" property edit

SELECT ?item ?itemLabel ?workLabel WHERE {
?item wdt:P170 wd:Q79012.
MINUS {?item wdt:P180 []}
OPTIONAL {?item wdt:P1433 ?work} # Work published in
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER by ?itemLabel
Try it!

Art works by Bauer that are not part of a publication edit

SELECT ?item ?itemLabel ?url WHERE {
?item wdt:P170 wd:Q79012; wdt:P953 ?url
MINUS {?item wdt:P1433 [] }
MINUS {?item wdt:P361 [] }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER by ?itemLabel
Try it!

Art works by Bauer without a "depicts" property, but a separate work has the same name and a depiction edit

SELECT ?item2 ("P180" as ?prop) ?species ("S854" as ?ref) ?cite WHERE {
?item1 wdt:P170 wd:Q79012. 
?item2 wdt:P170 wd:Q79012.
?item1 p:P180 [ps:P180 ?species; prov:wasDerivedFrom/pr:P854 ?cite]
MINUS {?item2 wdt:P180 []}
?item1 rdfs:label ?name.
?item2 rdfs:label ?name
}
Try it!

Genus of plants depicted in the Flora Graeca edit

SELECT ?genus ?genusname (COUNT(?art) as ?count) WHERE {
?art wdt:P1433 wd:Q5460305. # Artwork published in FG
?art wdt:P180 ?species. # Artwork depicts species
?species wdt:P171 ?genus. # parent taxon of species
?genus wdt:P225 ?genusname. # taxon name of genus
} GROUP BY ?genus ?genusname
ORDER BY ?genusname
Try it!

English common names of species depicted by Bauer edit

SELECT DISTINCT ?item ?commonname ?taxonname WHERE {
?art wdt:P170 wd:Q79012; wdt:P180 ?item.
?item wdt:P225 ?taxonname; wdt:P1843 ?commonname FILTER (lang(?commonname) = "en")
} ORDER BY UCASE(?commonname)
Try it!

Places visited by the Sibthorp/ Bauer expedition edit

Used to make places.json

SELECT (SUBSTR(STR(?loc),32) AS ?q) ?locLabel (SAMPLE(?coords) AS ?latlong) (MONTH(?start) AS ?start_m) (YEAR(?start) AS ?start_y) (MONTH(?end) AS ?end_m) (YEAR(?end) AS ?end_y) WHERE {
wd:Q52496052 p:P276 ?s.
?s ps:P276 ?loc
OPTIONAL {?s pq:P585 ?point}
OPTIONAL {?s pq:P580 ?startpoint}
BIND(COALESCE(?startpoint, ?point) AS ?start)
OPTIONAL {?s pq:P582 ?end}
?loc wdt:P625 ?coords.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} GROUP BY ?loc ?locLabel ?start ?end
ORDER BY ?start_y ?start_m ?end_y ?end_m
Try it!

Places visited by the Sibthorp/ Bauer expedition lacking co-ordinates edit

SELECT ?loc ?locLabel (SAMPLE(?coords) AS ?latlong) WHERE {
wd:Q52496052 wdt:P276 ?loc.
MINUS {?loc wdt:P625 ?coords}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} GROUP BY ?loc ?locLabel
Try it!

Places visited by all expeditions (and subtypes) known to Wikidata edit

SELECT ?layer ?loc ?placename ?coords WHERE {
{ SELECT ?exp (COUNT(?loc) AS ?count) WHERE {
   ?exp wdt:P31/wdt:P279* wd:Q2401485.
   ?exp wdt:P276 ?loc.
  } GROUP BY ?exp }
  FILTER (?count > 1)
?exp wdt:P276 ?loc.
?loc wdt:P625 ?coords.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?exp rdfs:label ?layer. ?loc rdfs:label ?placename }
}
Try it!

Taxa named after John Sibthorp edit

SELECT ?item ?name WHERE {
?item wdt:P138 wd:Q936580; wdt:P225 ?name
}
Try it!

Taxa that might have been named after Ferdinand Bauer edit

SELECT ?item ?name WHERE {
?item wdt:P225 ?name FILTER (CONTAINS(?name, " baueri")).
MINUS {?item wdt:P138 wd:Q936580}
}
Try it!

All the taxa represented in the Botanical Explorer edit

SELECT DISTINCT ?taxon WHERE {
?item wdt:P170 wd:Q79012; wdt:P180/wdt:P171* ?taxon.
?taxon wdt:P31 wd:Q16521
}
Try it!

Botanists edit

Botanists whose botanical abbreviation begins with a certain string edit

SELECT ?q ?name WHERE {
?q wdt:P428 ?name FILTER(STRSTARTS(?name,"H"))
} ORDER BY ?name
Try it!

People with botanical abbreviations edit

SELECT ?b ?q ?qLabel WHERE {
?q wdt:P428 ?b.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?b
Try it!

Top botanists by number of sitelinks edit

SELECT ?b ?q ?qLabel (count(?s) AS ?sitelinks) WHERE {
?q wdt:P428 ?b.
?s schema:about ?q.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} GROUP BY ?b ?q ?qLabel
ORDER BY DESC(?sitelinks)
LIMIT 10
Try it!

Top botanists by number of number of taxons authored edit

NB This times out

SELECT ?q ?qLabel (count(?s) AS ?taxa) WHERE {
?s p:P225 [pq:P405 ?q].
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} GROUP BY ?q ?qLabel
ORDER BY DESC(?taxa)
LIMIT 10
Try it!

Top botanists by number of things named after them edit

SELECT ?b ?q ?qLabel (count(?t) AS ?taxa) (count(?o) AS ?other) WHERE {
?q wdt:P428 ?b.
?s wdt:P138 ?q 
{?s wdt:P31 wd:Q16521. BIND(1 AS ?t) } UNION { BIND(1 AS ?o). MINUS {?s wdt:P31 wd:Q16521} }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} GROUP BY ?b ?q ?qLabel
ORDER BY DESC(?taxa + ?other)
LIMIT 10
Try it!