query-5d27bdff2d45b8edbcd791d43e7368fa

rq turtle/ttl

All HASC Data with seperate code for country, region and subregion

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#-----------------------------------------------------
# All HASC Data with seperate code for country, region and subregion
#-----------------------------------------------------
#defaultView:Map;Table
SELECT ?item ?itemLabel ?itemDescription ?hasc ?country_code ?region_code ?subregion_code
WHERE
{
    ?item wdt:P8119 ?hasc .                     # hasc
    #STRLEN("http://www.wikidata.org/entity/Q")+1)
    BIND(SUBSTR(?hasc,1,2) AS ?country_code).
    BIND(SUBSTR(?hasc,4,2) AS ?region_code).
    BIND(SUBSTR(?hasc,7,2) AS ?subregion_code).
    #OPTIONAL { ?item wdt:P625 ?coordinate. }    # coordinate
    #OPTIONAL { ?item wdt:P17  ?country. }       # country
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,de". }
}
order by ?hasc

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?country_code"):::projected v1("?hasc"):::projected v2("?item"):::projected v4("?region_code"):::projected v5("?subregion_code"):::projected c3(["bd:serviceParam"]):::iri c5(["#91;AUTO_LANGUAGE#93;,en,de"]):::literal v2 --"wdt:P8119"--> v1 bind0[/"substring(?hasc,'1^^xsd:integer','2^^xsd:integer')"/] v1 --o bind0 bind0 --as--o v3 bind1[/"substring(?hasc,'4^^xsd:integer','2^^xsd:integer')"/] v1 --o bind1 bind1 --as--o v4 bind2[/"substring(?hasc,'7^^xsd:integer','2^^xsd:integer')"/] v1 --o bind2 bind2 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c3 --"wikibase:language"--> c5 end