query-45c295ae3d46f2278d7ca7ddbc7f6776
Q660304 located in Q16 Q30 Q96
Q48719 located in Q30 Q16
SELECT ?countriesOfItem ?countriesOfClass ?class WHERE {
wd:Q48719 wdt:P17 ?countriesOfItem . wd:Q48719 wdt:P31 ?class . ?class wdt:P17 ?countriesOfClass FILTER EXISTS { FILTER(?countriesOfItem IN (?countriesOfClass) ) } }
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
# Q660304 located in Q16 Q30 Q96
# Q48719 located in Q30 Q16
SELECT ?countriesOfItem ?countriesOfClass ?class
WHERE
{
wd:Q48719 wdt:P17 ?countriesOfItem .
wd:Q48719 wdt:P31 ?class .
?class wdt:P17 ?countriesOfClass
FILTER EXISTS {
FILTER(?countriesOfItem IN (?countriesOfClass) )
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?class"):::projected
v2("?countriesOfClass"):::projected
v1("?countriesOfItem"):::projected
c1(["wd:Q48719"]):::iri
f0[[" "]]
subgraph f0e0["Exists Clause"]
e0f0[["?countriesOfItem = ?countriesOfClass"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0v2("?countriesOfClass"):::projected
e0v1("?countriesOfItem"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> v2
f1[["?countriesOfItem = ?countriesOfClass"]]
f1 --> v1
f1 --> v2
c1 --"wdt:P17"--> v1
c1 --"wdt:P31"--> v3
v3 --"wdt:P17"--> v2