query-8b2430d84a754d5f44188f2aa9644228

rq turtle/ttl

Propertiescollection (P195)instance of (P31)image (P18)Commons category (P373)inventory number (P217)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?thing ?thingLabel ?image (URI(CONCAT("https://commons.wikimedia.org/wiki/Category:",?cat) ) AS ?commons) WHERE {
{ ?thing wdt:P195 wd:Q82133 } UNION { ?thing p:P217/pq:P195 wd:Q82133 }
{ ?thing wdt:P31 wd:Q87167 } UNION { ?thing wdt:P31 wd:Q48498 }
OPTIONAL { ?thing wdt:P18 ?image }
OPTIONAL { ?thing wdt:P373 ?cat }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" }
} ORDER BY ?thingLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?cat"):::projected v5("?commons") v3("?image"):::projected v2("?thing"):::projected v1("?thingLabel"):::projected a1((" ")) c7(["wd:Q48498"]):::iri c13(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal c6(["wd:Q87167"]):::iri c11(["bd:serviceParam"]):::iri c2(["wd:Q82133"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"p:P217"--> a1 a1 --"p:qualifier/P195"--> c2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P195"--> c2 end union0r <== or ==> union0l end subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P31"--> c7 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P31"--> c6 end union1r <== or ==> union1l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P18".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P373".-> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind0[/"concat('https://commons.wikimedia.org/wiki/Category:',?cat)"/] v4 --o bind0 bind0 --as--o v5