query-e64914749af2ddbe7fd0bab19a125c09

rq turtle/ttl

All cities and towns of India without a coordinate mentioned SELECT ?object ?objectLabel ?coord WHERE { ?object wdt:P17 wd:Q668. #India ?object wdt:P31/wdt:P279 wd:Q486972. #Human settlement {?object wdt:P31/wdt:P279 wd:Q515.} UNION {?object wdt:P31/wdt:P279* wd:Q3957.} #Cities and towns. Add more categories, as needed MINUS {?object wdt:P625 ?coord.} #Filter out all Location that has coordinates. #MINUS {?object wdt:P473 ?localcode.} #Does not have an STD code mentioned. Not necessary yet SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }

Use at

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 cities and towns of India without a coordinate mentioned
SELECT  ?object ?objectLabel ?coord
WHERE {
  ?object wdt:P17 wd:Q668. #India
  ?object wdt:P31/wdt:P279* wd:Q486972. #Human settlement
  {?object wdt:P31/wdt:P279* wd:Q515.} UNION {?object wdt:P31/wdt:P279* wd:Q3957.} #Cities and towns. Add more categories, as needed
  MINUS {?object wdt:P625 ?coord.} #Filter out all Location that has coordinates.
  #MINUS {?object wdt:P473 ?localcode.} #Does not have an STD code mentioned. Not necessary yet
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?coord"):::projected v1("?object"):::projected a1((" ")) a2((" ")) a3((" ")) c5(["wd:Q486972"]):::iri c7(["wd:Q3957"]):::iri c10(["bd:serviceParam"]):::iri c6(["wd:Q515"]):::iri c2(["wd:Q668"]):::iri c12(["en"]):::literal v1 --"wdt:P17"--> c2 v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c5 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> a3 a3 --"wdt:P279"--> c7 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c6 end union0r <== or ==> union0l end subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v1 --"wdt:P625"--> v2 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end