query-21eefb2b20326db3ef30daf01f3e2808

rq turtle/ttl

admin_level=6 LGUs per province for OSM editing SELECT ?lguLabel ?lguQid ?psgc ?wikipediaTitle WHERE { { ?lgu wdt:P31 wd:Q104157. } UNION { ?lgu wdt:P31 wd:Q24764. } ?lgu wdt:P131 wd:Q13826 ; wdt:P988 ?psgc . BIND(SUBSTR(STR(?lgu), 32) AS ?lguQid) ?articleUrl schema:about ?lgu ; schema:isPartOf https://en.wikipedia.org/ . BIND(SUBSTR(STR(?articleUrl), 31) AS ?wikipediaTitle) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_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 schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# admin_level=6 LGUs per province for OSM editing
SELECT ?lguLabel ?lguQid ?psgc ?wikipediaTitle WHERE {
  { ?lgu wdt:P31 wd:Q104157. } UNION { ?lgu wdt:P31 wd:Q24764. }
  ?lgu wdt:P131 wd:Q13826 ;
       wdt:P988 ?psgc .
  BIND(SUBSTR(STR(?lgu), 32) AS ?lguQid)
  ?articleUrl schema:about ?lgu ;
              schema:isPartOf <https://en.wikipedia.org/> .
  BIND(SUBSTR(STR(?articleUrl), 31) AS ?wikipediaTitle)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?articleUrl") v1("?lgu") v3("?lguQid"):::projected v2("?psgc"):::projected v5("?wikipediaTitle"):::projected c2(["wd:Q104157"]):::iri c3(["wd:Q24764"]):::iri c9([https://en.wikipedia.org/]):::iri c11(["bd:serviceParam"]):::iri c5(["wd:Q13826"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c2 end union0r <== or ==> union0l end v1 --"wdt:P131"--> c5 v1 --"wdt:P988"--> v2 bind0[/"substring(str(?lgu),'32^^xsd:integer')"/] v1 --o bind0 bind0 --as--o v3 v4 --"schema:about"--> v1 v4 --"schema:isPartOf"--> c9 bind1[/"substring(str(?articleUrl),'31^^xsd:integer')"/] v4 --o bind1 bind1 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end