query-f75d3ee2b422459f3852e5a279caba73

rq turtle/ttl

Genera with a reference to Linnès Genera Plantarum (Q40975586)

Use at

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 ?pages ?bhlLink WHERE {
  ?item wdt:P225 ?name .
  ?item wdt:P105 wd:Q34740 .
  ?item p:P225 ?taxonName .
  ?taxonName ps:P225 ?taxonNameValue .
  ?taxonName pq:P405 wd:Q1043.
  ?taxonName prov:wasDerivedFrom ?ref .
  ?ref pr:P248 wd:Q40975586 .   
  OPTIONAL {?ref pr:P304 ?pages}
  OPTIONAL {?ref pr:P687 ?bhl}  
  BIND(REPLACE(?pages, "-", "–") AS ?pages)
  BIND(if(contains(?pages,  "–"), strbefore(?pages, "–"), ?pages) as ?startpage)
  BIND(if(contains(?pages,  "–"), strafter(?pages, "–"), ?pages) as ?endpage)
  BIND(uri(concat("http://biodiversitylibrary.org/page/",?bhl)) as ?bhlLink)
}
ORDER BY ASC(?name)

Query found at