query-3a0cba3bcff1c8be0a72336f6ba0ae9e

rq turtle/ttl

Query by User:Gnoeee

Wards of Kerala in OSM - Wikidata - Maintainence

PREFIX osmt: https://wiki.openstreetmap.org/wiki/Key: PREFIX osmm: https://www.openstreetmap.org/meta/ PREFIX osmrel: https://www.openstreetmap.org/relation/ SELECT DISTINCT ?item ?ward_name ?osm_relationLink ?loc ?osmId ?sameWikidata WHERE { ?item wdt:P31 wd:Q1195098; wdt:P17 wd:Q668; wdt:P131/wdt:P131* wd:Q1186; wdt:P402 ?osm_relation . SERVICE https://sophox.org/sparql { ?osmId osmt:wikidata ?item . ?osmId osmt:admin_level "10" ; osmt:boundary "local_authority" ; osmt:name ?ward_name ; osmm:loc ?loc ; osmm:type "r". # FILTER ( ?loc < "POINT(77.41445 8.07876)"^^geo:wktLiteral && ?loc > "POINT(76.08419 8.98918)"^^geo:wktLiteral ) . } BIND(IRI(CONCAT("https://www.openstreetmap.org/relation/", ?osm_relation)) AS ?osm_relationLink) BIND( ?osm_relationLink = ?osmId AS ?sameWikidata) }

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
#Query by User:Gnoeee
#Wards of Kerala in OSM - Wikidata - Maintainence 
PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
SELECT DISTINCT ?item ?ward_name ?osm_relationLink ?loc ?osmId ?sameWikidata
WHERE {
  ?item wdt:P31 wd:Q1195098;
        wdt:P17 wd:Q668;
        wdt:P131/wdt:P131* wd:Q1186;
        wdt:P402 ?osm_relation .
   SERVICE <https://sophox.org/sparql> {
    ?osmId osmt:wikidata ?item .
    ?osmId osmt:admin_level "10" ;
           osmt:boundary "local_authority" ;
           osmt:name ?ward_name ;
           osmm:loc ?loc ;
           osmm:type "r".
           # FILTER ( ?loc < "POINT(77.41445 8.07876)"^^geo:wktLiteral && ?loc > "POINT(76.08419 8.98918)"^^geo:wktLiteral ) .
  }
  BIND(IRI(CONCAT("https://www.openstreetmap.org/relation/", ?osm_relation)) AS ?osm_relationLink)
  BIND( ?osm_relationLink = ?osmId AS ?sameWikidata)
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v5("?loc"):::projected v3("?osmId"):::projected v2("?osm_relation") v6("?osm_relationLink"):::projected v7("?sameWikidata"):::projected v4("?ward_name"):::projected a1((" ")) c2(["wd:Q1195098"]):::iri c13(["local_authority"]):::literal c17(["r"]):::literal c4(["wd:Q668"]):::iri c6(["wd:Q1186"]):::iri c11(["10"]):::literal v1 --"wdt:P31"--> c2 v1 --"wdt:P17"--> c4 v1 --"wdt:P131"--> a1 a1 --"wdt:P131"--> c6 v1 --"wdt:P402"--> v2 subgraph s1["https://sophox.org/sparql"] style s1 stroke-width:4px; v3 --https://wiki.openstreetmap.org/wiki/Key:wikidata--> v1 v3 --https://wiki.openstreetmap.org/wiki/Key:admin_level--> c11 v3 --https://wiki.openstreetmap.org/wiki/Key:boundary--> c13 v3 --https://wiki.openstreetmap.org/wiki/Key:name--> v4 v3 --https://www.openstreetmap.org/meta/loc--> v5 v3 --https://www.openstreetmap.org/meta/type--> c17 end bind0[/"concat('https://www.openstreetmap.org/relation/',?osm_relation)"/] v2 --o bind0 bind0 --as--o v6 bind1[/"?osm_relationLink = ?osmId"/] v6 --o bind1 v3 --o bind1 bind1 --as--o v7