query-8d6ef92de1e4a3f5dadef74901cfdbf2
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"]}
SELECT ?item ?itemLabel (SAMPLE(?coordinates_) AS ?coordinates) WHERE {
# there seem to be two possible ways of modeling a shipwreck (may be combined on the same item)
{
# instance of shipwreck, coordinates as main statement
?item wdt:P31 wd:Q852190;
wdt:P625 ?coordinates_.
} UNION {
# significant event shipwreck, coordinates as qualifier of that
?item p:P793 [
a wikibase:BestRank;
ps:P793 wd:Q906512;
pq:P625 ?location
].
}
# include both (the GROUP BY will ensure we don’t get duplicates)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel # coalesce duplicate coordinates and also items that are selected by both UNION branches
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?coordinates")
v2("?coordinates_"):::projected
v1("?item"):::projected
v3("?location")
a1((" "))
c5(["wikibase:BestRank"]):::iri
c11(["bd:serviceParam"]):::iri
c7(["wd:Q906512"]):::iri
c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c2(["wd:Q852190"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
a1 --"a"--> c5
a1 --"p:statement/P793"--> c7
a1 --"p:qualifier/P625"--> v3
v1 --"p:P793"--> a1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"p:direct/P31"--> c2
v1 --"p:direct/P625"--> v2
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end
bind1[/"sample(?coordinates_)"/]
v2 --o bind1
bind1 --as--o v4