query-33a8ab4f830927857f11d7c78009b67e

rq turtle/ttl

Images in Wikimedia Commons depicting items of type specimens

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:ImageGrid

SELECT ?file ?image ?stype ?stypeLabel ?collec ?collecLabel ?role ?roleLabel ?de ?deLabel
WHERE {
  ?file wdt:P180 ?stype ; schema:contentUrl ?url .

  bind(iri(concat("http://commons.wikimedia.org/wiki/Special:FilePath/", replace(substr(str(?url),53),"_","%20"))) AS ?image) .

  #?file wdt:P180  wd:Q105607273  .
   {
  select ?stype ?stypeLabel ?collec ?collecLabel ?role ?de ?roleLabel ?deLabel {
   service <https://query.wikidata.org/sparql> {
     select ?stype ?stypeLabel ?collec ?collecLabel ?role ?de ?roleLabel ?deLabel { 
       ?stype wdt:P31/wdt:P279* wd:Q51255340 
       SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
       optional {
         ?stype wdt:P195 ?collec .
       }
       ?stype p:P2868 [ps:P2868 ?role ; pq:P642 ?de] .
       #remove the # below to specify one or more collections
       #values ?collec {
       # wd:Q122945 # example with the Yale Peabody Museum of Natural History 
       #}
       #?de wdt:P171* wd:Q15711568 . # choose a taxon whose types are sought, including the types of its sub-taxa 
     }
   }
  }
}}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?collec"):::projected v7("?de"):::projected v1("?file"):::projected v4("?image"):::projected v6("?role"):::projected v2("?stype"):::projected v3("?url") a1((" ")) a2((" ")) c6(["wd:Q51255340"]):::iri c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal v1 --"p:direct/P180"--> v2 v1 --"schema:contentUrl"--> v3 bind0[/"concat('http://commons.wikimedia.org/wiki/Special:FilePath/',replace(substring(str(?url),'53^^xsd:integer'),'_','%20'))"/] v3 --o bind0 bind0 --as--o v4 subgraph s1["https://query.wikidata.org/sparql"] style s1 stroke-width:4px; v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c6 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c8 --"wikibase:language"--> c10 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P195".-> v5 end a2 --"p:statement/P2868"--> v6 a2 --"p:qualifier/P642"--> v7 v2 --"p:P2868"--> a2 end