query-1424828a770dbaba2a9f6246dc07ec26
But this is quite tricky and I couldn't write a good query for it. Could someone help? Here a bad written query (it's limited to churches - or it TimeOut - and to 2 countries, and it's still quite long to give results) :
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?country1Label ?country2Label
WHERE {
?item wdt:P31 wd:Q16970 ; wdt:P17 ?country1 ; wdt:P17 ?country2 .
MINUS { ?country1 wdt:P47 ?country2 }
FILTER ( ?country1 != ?country2 )
FILTER NOT EXISTS { ?country1 wdt:P576 [] }
FILTER NOT EXISTS { ?country2 wdt:P576 [] }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?country1")
v1("?country2")
v3("?item"):::projected
a2((" "))
a1((" "))
c7(["bd:serviceParam"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3(["wd:Q16970"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P576"--> e0a1
e0v1("?country2"):::projected
e0a1((" ")):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> a1
v1 --"wdt:P576"--> a1
f1[["not "]]
subgraph f1e1["Exists Clause"]
e1v1 --"wdt:P576"--> e1a1
e1v1("?country1"):::projected
e1a1((" ")):::projected
end
f1--EXISTS--> f1e1
f1 --> v2
f1 --> c1
f1 --> a2
v2 --"wdt:P576"--> a2
f2[["?country1 != ?country2"]]
f2 --> v2
f2 --> v1
v3 --"wdt:P31"--> c3
v3 --"wdt:P17"--> v2
v3 --"wdt:P17"--> v1
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v2 --"wdt:P47"--> v1
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end