query-c69824b1029874a8033da9c6e738cb91
Filtering locations for statements with reference URLs, it is displayed as a latitude/ longitude pair. Sometimes there are two or three for each result. I want to only show the coordinates for which there is a reference URL. So my query is: (P625)coordinate location . When I get w:en:User:MartinPoulter/HillfortsHi, I'm creating a ListeriaBot list which includes coordinates:
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item ?type ?loc WHERE {
?item wdt:P31/wdt:P279? wd:Q744099 ; wdt:P31 ?type ; wdt:P131 wd:Q23183 ; wdt:P4102 ?atlas ; p:P625 ?locstatement .
?locstatement ps:P625 ?loc FILTER EXISTS { ?locstatement prov:wasDerivedFrom/pr:P854 ?locref } .
?type wdt:P279? wd:Q744099
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?atlas")
v3("?item"):::projected
v6("?loc"):::projected
v2("?locref")
v1("?locstatement")
v4("?type"):::projected
a2((" "))
a1((" "))
c4(["wd:Q744099"]):::iri
c7(["wd:Q23183"]):::iri
f0[[" "]]
subgraph f0e0["Exists Clause"]
e0v1 --"prov:wasDerivedFrom"--> e0a1
e0a1 --"p:reference/P854"--> e0v2
e0v2("?locref"):::projected
e0v1("?locstatement"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> a1
f0 --> c2
f0 --> v2
v1 --"prov:wasDerivedFrom"--> a1
a1 --"p:reference/P854"--> v2
v3 --"p:direct/P31"--> a2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
a2 --"p:direct/P279"--> c4
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
end
union0r <== or ==> union0l
end
v3 --"p:direct/P31"--> v4
v3 --"p:direct/P131"--> c7
v3 --"p:direct/P4102"--> v5
v3 --"p:P625"--> v1
v1 --"p:statement/P625"--> v6
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v4 --"p:direct/P279"--> c4
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
end
union1r <== or ==> union1l
end