query-477e0a6b541ecd0a8a8e4461e85cde92

rq turtle/ttl


Human settlement and HASC

-----------------------------------------------------

SELECT DISTINCT ?itemLabel ?hasc WITH { # Subquery to get all values of hasc in Germany (DE) SELECT ?region ?hasc WHERE { ?region wdt:P8119 ?hasc . FILTER(REGEX(STR(?hasc), "^DE.[A-Z]{2}.[A-Z]{2}$","i")) ?region wdt:P17 wd:Q183 . # country is Germany } #ORDER BY ?hasc #OFFSET 0 #LIMIT 50 } AS %hasc WHERE { INCLUDE %hasc ?item wdt:P131 * ?region . #?item wdt:P31 / wdt:P279 * wd:Q486972 . # ?item is a subclass of human settlement VALUES ?instance_of { wd:Q253019 # Ortsteil wd:Q486972 # Siedlung wd:Q262166 # Gemeinde in Deutschland wd:Q123705 # Stadtviertel } ?item wdt:P31 ?instance_of .
#hint:Prior hint:gearing "forward" . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de". } }

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#>
#-----------------------------------------------------
# Human settlement and HASC
#-----------------------------------------------------

SELECT DISTINCT ?itemLabel ?hasc
WHERE
{

{
  # Subquery to get all values of hasc in Germany (DE) 
  SELECT ?region ?hasc
  WHERE
  {
    ?region wdt:P8119 ?hasc .
    FILTER(REGEX(STR(?hasc), "^DE.[A-Z]{2}.[A-Z]{2}$","i")) 
    ?region wdt:P17 wd:Q183 . # country is Germany
  }
  #ORDER BY ?hasc
  #OFFSET 0
  #LIMIT 50
}  ?item wdt:P131 * ?region .
  #?item wdt:P31 / wdt:P279 * wd:Q486972 . # ?item is a subclass of human settlement
  VALUES ?instance_of { 
    wd:Q253019      # Ortsteil
    wd:Q486972      # Siedlung
    wd:Q262166      # Gemeinde in Deutschland
    wd:Q123705      # Stadtviertel
  } 
  ?item wdt:P31 ?instance_of .  
  #hint:Prior hint:gearing "forward" . 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?hasc"):::projected v4("?instance_of") v3("?item") v2("?region") c9(["bd:serviceParam"]):::iri c5(["wd:Q183"]):::iri c11(["#91;AUTO_LANGUAGE#93;,en,de"]):::literal f0[["regex(str(?hasc),'^DE.#91;A-Z#93;{2}.#91;A-Z#93;{2}$','i')"]] f0 --> v1 v2 --"wdt:P8119"--> v1 v2 --"wdt:P17"--> c5 v3 --"wdt:P131"--> v2 bind1[/VALUES ?instance_of/] bind1-->v4 bind10(["wd:Q253019"]) bind10 --> bind1 bind11(["wd:Q486972"]) bind11 --> bind1 bind12(["wd:Q262166"]) bind12 --> bind1 bind13(["wd:Q123705"]) bind13 --> bind1 v3 --"wdt:P31"--> v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end