query-32eb910e67d2b97def528d25a6b2337f

rq turtle/ttl

title: München: Stadtbezirke, Stadtteile und Stadtviertel SELECT DISTINCT ?name (GROUP_CONCAT(DISTINCT ?klasse; SEPARATOR = ", ") AS ?istEin) ?orgEinheit ?article (GROUP_CONCAT(DISTINCT ?teil; SEPARATOR=", ") as ?teile) (GROUP_CONCAT(DISTINCT ?partOfLabel; SEPARATOR=", ") as ?teilVon) ?item (GROUP_CONCAT(DISTINCT ?lang; SEPARATOR = ", ") AS ?sprachen) WHERE { VALUES ?klassen { wd:Q253019 wd:Q123705 wd:Q253270 } ?item (wdt:P131*) wd:Q1726; wdt:P31 ?klassen. OPTIONAL { ?item wdt:P131 ?territoryEntity. } OPTIONAL { ?item p:P131 :b15. :b15 pq:P582 ?end. } OPTIONAL { ?item wdt:P361 ?partOf. } OPTIONAL { ?item wdt:P31 ?instanceOf. } OPTIONAL { ?article schema:about ?item; schema:isPartOf https://de.wikipedia.org/; schema:name ?page_title. } OPTIONAL { ?page schema:about ?item; schema:inLanguage ?lang. } FILTER((?lang IN("fr", "de", "tr", "it", "pl", "es", "fi", "en", "pt", "hr", "nl", "ro", "bg", "sv", "da", "lb", "cs", "sk", "sl", "hu", "et", "lv", "lt", "el", "fo", "sr"))|| (!(BOUND(?article)))) FILTER(!(BOUND(?end))) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". ?territoryEntity rdfs:label ?orgEinheit. ?instanceOf rdfs:label ?klasse. ?item rdfs:label ?name. ?bezirksteil rdfs:label ?teil. ?partOf rdfs:label ?partOfLabel. } } GROUP BY ?item ?name ?orgEinheit ?article ?end ORDER BY (?orgEinheit) (?name)

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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: München: Stadtbezirke, Stadtteile und Stadtviertel
SELECT DISTINCT ?name (GROUP_CONCAT(DISTINCT ?klasse; SEPARATOR = ", ") AS ?istEin) ?orgEinheit ?article (GROUP_CONCAT(DISTINCT ?teil; SEPARATOR=", ") as ?teile) (GROUP_CONCAT(DISTINCT ?partOfLabel; SEPARATOR=", ") as ?teilVon) ?item (GROUP_CONCAT(DISTINCT ?lang; SEPARATOR = ", ") AS ?sprachen) WHERE {
  VALUES ?klassen {
    wd:Q253019
    wd:Q123705
    wd:Q253270
  }
  ?item (wdt:P131*) wd:Q1726;
    wdt:P31 ?klassen.
  OPTIONAL { ?item wdt:P131 ?territoryEntity. }
  OPTIONAL {
    ?item p:P131 _:b15.
    _:b15 pq:P582 ?end.
  }
  OPTIONAL { ?item wdt:P361 ?partOf. }
  OPTIONAL { ?item wdt:P31 ?instanceOf. }
  OPTIONAL {
    ?article schema:about ?item;
      schema:isPartOf <https://de.wikipedia.org/>;
      schema:name ?page_title.
  }
  OPTIONAL {
    ?page schema:about ?item;
      schema:inLanguage ?lang.
  }
  FILTER((?lang IN("fr", "de", "tr", "it", "pl", "es", "fi", "en", "pt", "hr", "nl", "ro", "bg", "sv", "da", "lb", "cs", "sk", "sl", "hu", "et", "lv", "lt", "el", "fo", "sr"))|| (!(BOUND(?article))))
  FILTER(!(BOUND(?end)))
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
    ?territoryEntity rdfs:label ?orgEinheit.
    ?instanceOf rdfs:label ?klasse.
    ?item rdfs:label ?name.
    ?bezirksteil rdfs:label ?teil.
    ?partOf rdfs:label ?partOfLabel.
  }
}
GROUP BY ?item ?name ?orgEinheit ?article ?end
ORDER BY (?orgEinheit) (?name)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?article"):::projected v14("?bezirksteil") v3("?end") v10("?instanceOf") v17("?istEin") v7("?item"):::projected v13("?klasse"):::projected v6("?klassen") v4("?lang"):::projected v2("?name"):::projected v1("?orgEinheit"):::projected v12("?page") v11("?page_title") v9("?partOf") v16("?partOfLabel"):::projected v20("?sprachen") v15("?teil"):::projected v19("?teilVon") v18("?teile") v8("?territoryEntity") a1((" ")) c35([https://de.wikipedia.org/]):::iri c39(["bd:serviceParam"]):::iri c28(["wd:Q1726"]):::iri c41(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not bound(?end)"]] f0 --> v3 list0c2(["de"]):::literal list0c7(["fi"]):::literal list0c9(["pt"]):::literal list0c13(["bg"]):::literal list0c23(["lt"]):::literal list0c25(["fo"]):::literal list0c10(["hr"]):::literal list0c22(["lv"]):::literal list0c1(["fr"]):::literal list0c20(["hu"]):::literal list0c18(["sk"]):::literal list0c19(["sl"]):::literal list0c26(["sr"]):::literal list0c14(["sv"]):::literal list0c24(["el"]):::literal list0c8(["en"]):::literal list0c4(["it"]):::literal list0c6(["es"]):::literal list0c21(["et"]):::literal list0c17(["cs"]):::literal list0c16(["lb"]):::literal list0c5(["pl"]):::literal list0c12(["ro"]):::literal list0c15(["da"]):::literal list0c3(["tr"]):::literal list0c11(["nl"]):::literal list0c1 --o f1 list0c2 --o f1 list0c3 --o f1 list0c4 --o f1 list0c5 --o f1 list0c6 --o f1 list0c7 --o f1 list0c8 --o f1 list0c9 --o f1 list0c10 --o f1 list0c11 --o f1 list0c12 --o f1 list0c13 --o f1 list0c14 --o f1 list0c15 --o f1 list0c16 --o f1 list0c17 --o f1 list0c18 --o f1 list0c19 --o f1 list0c20 --o f1 list0c21 --o f1 list0c22 --o f1 list0c23 --o f1 list0c24 --o f1 list0c25 --o f1 list0c26 --o f1 f1[["( in || not bound(?article))"]] f1 --> v4 f1 --> v5 bind2[/VALUES ?klassen/] bind2-->v6 bind20(["wd:Q253019"]) bind20 --> bind2 bind21(["wd:Q123705"]) bind21 --> bind2 bind22(["wd:Q253270"]) bind22 --> bind2 v7 --"p:direct/P131"--> c28 v7 --"p:direct/P31"--> v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:direct/P131".-> v8 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:P131".-> a1 a1 --"p:qualifier/P582"--> v3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:direct/P361".-> v9 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v7 -."p:direct/P31".-> v10 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v5 -."schema:about".-> v7 v5 --"schema:isPartOf"--> c35 v5 --"schema:name"--> v11 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v12 -."schema:about".-> v7 v12 --"schema:inLanguage"--> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c39 --"wikibase:language"--> c41 v8 --"rdfs:label"--> v1 v10 --"rdfs:label"--> v13 v7 --"rdfs:label"--> v2 v14 --"rdfs:label"--> v15 v9 --"rdfs:label"--> v16 end bind7[/"?klasse"/] v13 --o bind7 bind7 --as--o v17 bind8[/"?teil"/] v15 --o bind8 bind8 --as--o v18 bind9[/"?partOfLabel"/] v16 --o bind9 bind9 --as--o v19 bind10[/"?lang"/] v4 --o bind10 bind10 --as--o v20