query-e9b6f6a70a2e9ae7244c0eedd7c9ea82
Image gallery version of above
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Objects related to Shah Jahan
#defaultView:ImageGrid{"hide":["?thumbnail","?noimg"]}
SELECT DISTINCT ?collection (CONCAT(?property," ",?targetlabel) AS ?proplabel) (SAMPLE(?obj_type) AS ?object_type) (SAMPLE(?image) AS ?thumbnail) ?q ?qLabel ?noimg WHERE {
VALUES ?target {wd:Q83672}
?i ?rel ?target; wdt:P195 ?coll; wdt:P31 ?type
OPTIONAL {?i wdt:P18 ?img}
BIND(IF(BOUND(?img), ?img, <http://commons.wikimedia.org/wiki/Special:FilePath/No%20image%20available.svg>) AS ?image)
BIND(IF(BOUND(?img), 0, 1) AS ?noimg)
OPTIONAL {?i wdt:P973 ?url}
BIND(COALESCE(?url, ?i) as ?q)
MINUS {?coll wdt:P31 wd:Q61781831}
?prop wikibase:directClaim ?rel; a wikibase:Property
SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
?i rdfs:label ?qLabel. ?coll rdfs:label ?collection.
?prop rdfs:label ?property. ?type rdfs:label ?obj_type. ?target rdfs:label ?targetlabel}
} GROUP BY ?q ?qLabel ?collection ?property ?targetlabel ?noimg
ORDER BY ?noimg ?proplabel ?collection
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?coll")
v3("?collection"):::projected
v5("?i")
v10("?image"):::projected
v9("?img")
v11("?noimg"):::projected
v16("?obj_type"):::projected
v18("?object_type")
v13("?prop")
v15("?property"):::projected
v18("?proplabel")
v12("?q"):::projected
v14("?qLabel"):::projected
v6("?rel")
v4("?target")
v17("?targetlabel"):::projected
v19("?thumbnail")
v8("?type")
v11("?url")
c8(["wikibase:Property"]):::iri
c10(["bd:serviceParam"]):::iri
c5(["wd:Q61781831"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?target/]
bind0-->v4
bind00(["wd:Q83672"])
bind00 --> bind0
v5 -->v6--> v4
v5 --"wdt:P195"--> v7
v5 --"wdt:P31"--> v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P18".-> v9
end
bind1[/"if(bound(?img),?img,http://commons.wikimedia.org/wiki/Special:FilePath/No%20image%20available.svg)"/]
v9 --o bind1
bind1 --as--o v10
bind2[/"if(bound(?img),'0^^xsd:integer','1^^xsd:integer')"/]
v9 --o bind2
bind2 --as--o v11
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."wdt:P973".-> v11
end
bind3[/"?url?i"/]
v11 --o bind3
v5 --o bind3
bind3 --as--o v12
subgraph minus4["MINUS"]
style minus4 stroke-width:6px,fill:pink,stroke:red;
v7 --"wdt:P31"--> c5
end
v13 --"wikibase:directClaim"--> v6
v13 --"a"--> c8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
v5 --"rdfs:label"--> v14
v7 --"rdfs:label"--> v3
v13 --"rdfs:label"--> v15
v8 --"rdfs:label"--> v16
v4 --"rdfs:label"--> v17
end
bind7[/"concat(?property,' ',?targetlabel)"/]
v15 --o bind7
v17 --o bind7
bind7 --as--o v18
bind8[/"sample(?obj_type)"/]
v16 --o bind8
bind8 --as--o v18
bind9[/"sample(?image)"/]
v10 --o bind9
bind9 --as--o v19