query-4d1a1246b316823cc3f98ef4fc37aaae

rq turtle/ttl

Species with a reference to Linnès Species Plantarum. 1st Edition (Q21856050)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item ?name ?volume ?pages WHERE {
  VALUES ?sp {wd:Q21856106 wd:Q21856107} . # Species Plantarum, 1st Ed., Vol. 1+2
  ?item wdt:P225 ?name .
  ?item wdt:P105 wd:Q7432 .
  ?item p:P225 ?taxonName .
  ?taxonName ps:P225 ?taxonNameValue .
  ?taxonName pq:P405 wd:Q1043.
  ?taxonName prov:wasDerivedFrom ?ref .
  ?ref pr:P248 ?sp .   
  OPTIONAL {?ref pr:P304 ?pages}
  BIND(if(sameTerm(?sp, wd:Q21856106), "1", "2") as ?volume)
  BIND(REPLACE(?pages, "-", "–") AS ?pages)
  BIND(REPLACE(?pages, "\\[1230\\]", "1230") AS ?pages)
  BIND(REPLACE(?pages, "\\[1231\\]", "1231") AS ?pages)
  BIND(if(contains(?pages,  "–"), strbefore(?pages, "–"), ?pages) as ?startpage)
  BIND(if(contains(?pages,  "–"), strafter(?pages, "–"), ?pages) as ?endpage)
}
ORDER BY ASC(xsd:integer(?startpage)) ASC(?name)
#ORDER BY ASC(?name)|

Query found at