query-d1a278edd4fc7ccde65ae0b693dd33b4
TODO
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 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:Map{"hide":["?coordinates", "?layer"]}
SELECT ?item ?itemLabel (SAMPLE(?coordinates_) AS ?coordinates) ?layer WHERE {
# see previous query: two ways to model shipwrecks; we include both, even for the RMS Titanic
{
?item wdt:P31 wd:Q852190;
wdt:P625 ?coordinates_.
FILTER(?item != wd:Q25173)
BIND("not Titanic"@en AS ?layer)
} UNION {
?item p:P793 [
a wikibase:BestRank;
ps:P793 wd:Q906512;
pq:P625 ?location
].
FILTER(?item != wd:Q25173)
BIND("not Titanic"@en AS ?layer)
} UNION {
wd:Q25173 wdt:P31 wd:Q852190;
wdt:P625 ?coordinates_.
BIND("RMS Titanic"@en AS ?layer)
} UNION {
wd:Q25173 p:P793 [
a wikibase:BestRank;
ps:P793 wd:Q906512;
pq:P625 ?location
].
BIND("RMS Titanic"@en AS ?layer)
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel ?layer
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?coordinates")
v2("?coordinates_"):::projected
v1("?item"):::projected
v5("?layer"):::projected
v4("?location")
a1((" "))
a2((" "))
c6(["wikibase:BestRank"]):::iri
c12(["bd:serviceParam"]):::iri
c8(["wd:Q906512"]):::iri
c1(["wd:Q25173"]):::iri
c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q852190"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
a2 --"a"--> c6
a2 --"p:statement/P793"--> c8
a2 --"p:qualifier/P625"--> v4
c1 --"p:P793"--> a2
bind0[/"sRMS Titanic^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/]
bind0 --as--o v5
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
c1 --"p:direct/P31"--> c3
c1 --"p:direct/P625"--> v2
bind1[/"sRMS Titanic^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/]
bind1 --as--o v5
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
f2[["?item != 'wd:Q25173'"]]
f2 --> v1
a1 --"a"--> c6
a1 --"p:statement/P793"--> c8
a1 --"p:qualifier/P625"--> v4
v1 --"p:P793"--> a1
bind3[/"snot Titanic^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/]
bind3 --as--o v5
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f4[["?item != 'wd:Q25173'"]]
f4 --> v1
v1 --"p:direct/P31"--> c3
v1 --"p:direct/P625"--> v2
bind5[/"snot Titanic^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>'"/]
bind5 --as--o v5
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end
bind7[/"sample(?coordinates_)"/]
v2 --o bind7
bind7 --as--o v5