query-878e50663a11880852476346e4a86d14

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"hide":"?rgb"}
#title: Border check (with landform & settlement base classes, timeout prone)
SELECT ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer WHERE {
   {
  SELECT DISTINCT ?item (COUNT(DISTINCT ?country) as ?anz) WHERE {

    ?item wdt:P17 wd:Q77 . #16
    #?item wdt:P131*/wdt:P279* wd:Q980 . # in case of timelimit restrict to sub unit
    ?item wdt:P31*/wdt:P279* ?isA .
    VALUES ?isA {wd:Q271669 wd:Q486972} # landform settlement
    ?item wdt:P625 [] .
    ?item wdt:P17 ?country .
  }
  GROUP BY ?item
}.
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  BIND(IF(?anz = 1, '60ff60', 'ff0000') AS ?rgb) .
  BIND(IF(?anz = 1, 'inside (single P17)', 'border (multiple P17)') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer # ORDER BY ASC(?item)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?anz"):::projected v6("?coord"):::projected v5("?coordStatement") v3("?country") v3("?isA") v1("?item"):::projected v8("?layer"):::projected v7("?rgb"):::projected a2((" ")) a3((" ")) a1((" ")) c9(["bd:serviceParam"]):::iri c2(["wd:Q77"]):::iri c11(["#91;AUTO_LANGUAGE,de,en#93;"]):::literal v1 --"p:direct/P17"--> c2 v1 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> v3 bind0[/VALUES ?isA/] bind0-->v3 bind00(["wd:Q271669"]) bind00 --> bind0 bind01(["wd:Q486972"]) bind01 --> bind0 v1 --"p:direct/P625"--> a2 v1 --"p:direct/P17"--> v3 bind2[/"count(?country)"/] v3 --o bind2 bind2 --as--o v4 v1 --"p:direct/P31"--> a3 v1 --"p:P625"--> v5 v5 --"p:statement/P625"--> v6 bind3[/"if(?anz = '1^^xsd:integer','60ff60','ff0000')"/] v4 --o bind3 bind3 --as--o v7 bind4[/"if(?anz = '1^^xsd:integer','inside (single P17)','border (multiple P17)')"/] v4 --o bind4 bind4 --as--o v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end