query-e53bf60a8734edd6f2147c16b1ba478e
All different human settlements in India that are also in another country SELECT ?object ?objectLabel ?country ?countryLabel ?country2 ?country2Label WHERE { ?object wdt:P17 ?country. ?object wdt:P17 ?country2. FILTER(STR(?country2) != STR(?country)) #Different countries FILTER(STR(?country) = STR(wd:Q668)) #India #MINUS { ?country wdt:P582|wdt:P576 ?ended. } #MINUS { ?country2 wdt:P582|wdt:P576 ?ended. } ?object wdt:P31/wdt:P279* wd:Q486972. #Human settlements SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
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#>
#All different human settlements in India that are also in another country
SELECT ?object ?objectLabel ?country ?countryLabel ?country2 ?country2Label
WHERE {
?object wdt:P17 ?country.
?object wdt:P17 ?country2.
FILTER(STR(?country2) != STR(?country)) #Different countries
FILTER(STR(?country) = STR(wd:Q668)) #India
#MINUS { ?country wdt:P582|wdt:P576 ?ended. }
#MINUS { ?country2 wdt:P582|wdt:P576 ?ended. }
?object wdt:P31/wdt:P279* wd:Q486972. #Human settlements
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Query found at
- https://www.wikidata.org/wiki/User:Soni/sandbox
- https://www.wikidata.org/wiki/Wikidata:WikiProject_India/Tasks
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?country"):::projected
v2("?country2"):::projected
v3("?object"):::projected
a1((" "))
c5(["wd:Q486972"]):::iri
c7(["bd:serviceParam"]):::iri
c9(["en"]):::literal
f0[["str(?country) = str('wd:Q668')"]]
f0 --> v1
f1[["str(?country2) != str(?country)"]]
f1 --> v2
f1 --> v1
v3 --"wdt:P17"--> v1
v3 --"wdt:P17"--> v2
v3 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end