query-7fcd02fa199d438087aac1e2bca21653

rq turtle/ttl

title:S-Bahnhöfe in Oberbayern SELECT ?page_title ?article ?item (GROUP_CONCAT(?klasse; SEPARATOR = ", ") AS ?ist_ein) ?pq_obj ?verbund (GROUP_CONCAT(DISTINCT ?velabel; SEPARATOR = ", ") AS ?verwaltungseinheiten) ?location WHERE { ?item wdt:P31 wd:Q1793804; (wdt:P131*) wd:Q10562; wdt:P31 ?instance. OPTIONAL { ?item wdt:P625 ?location. } OPTIONAL { ?item wdt:P131 ?ve. } OPTIONAL { ?item p:P31 ?statement. ?statement ps:P31 wd:Q1793804; pq:P642 ?pq_obj. ?pq_qual wikibase:qualifier pq:P642. } OPTIONAL { ?dewiki schema:about ?item; schema:isPartOf https://de.wikipedia.org/; schema:name ?de_title. } OPTIONAL { ?enwiki schema:about ?item; schema:isPartOf https://en.wikipedia.org/; schema:name ?en_title. } BIND(IF(BOUND(?dewiki), ?dewiki, ?enwiki) AS ?article) BIND(IF(BOUND(?de_title), ?de_title, IF(BOUND(?en_title), ?en_title, ?itemName)) AS ?page_title) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en". ?item rdfs:label ?itemName. ?pq_obj rdfs:label ?verbund. ?instance rdfs:label ?klasse. ?ve rdfs:label ?velabel. } } GROUP BY ?page_title ?article ?item ?pq_obj ?verbund ?location

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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:S-Bahnhöfe in Oberbayern
SELECT ?page_title ?article ?item (GROUP_CONCAT(?klasse; SEPARATOR = ", ") AS ?ist_ein) ?pq_obj ?verbund (GROUP_CONCAT(DISTINCT ?velabel; SEPARATOR = ", ") AS ?verwaltungseinheiten) ?location WHERE {
  ?item wdt:P31 wd:Q1793804;
    (wdt:P131*) wd:Q10562;
    wdt:P31 ?instance.
  OPTIONAL { ?item wdt:P625 ?location. }
  OPTIONAL { ?item wdt:P131 ?ve. }
  OPTIONAL {
    ?item p:P31 ?statement.
    ?statement ps:P31 wd:Q1793804;
      pq:P642 ?pq_obj.
    ?pq_qual wikibase:qualifier pq:P642.
  }
  OPTIONAL {
    ?dewiki schema:about ?item;
      schema:isPartOf <https://de.wikipedia.org/>;
      schema:name ?de_title.
  }
  OPTIONAL {
    ?enwiki schema:about ?item;
      schema:isPartOf <https://en.wikipedia.org/>;
      schema:name ?en_title.
  }
  BIND(IF(BOUND(?dewiki), ?dewiki, ?enwiki) AS ?article)
  BIND(IF(BOUND(?de_title), ?de_title, IF(BOUND(?en_title), ?en_title, ?itemName)) AS ?page_title)
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en".
    ?item rdfs:label ?itemName.
    ?pq_obj rdfs:label ?verbund.
    ?instance rdfs:label ?klasse.
    ?ve rdfs:label ?velabel.
  }
}
GROUP BY ?page_title ?article ?item ?pq_obj ?verbund ?location

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v12("?article"):::projected v9("?de_title") v8("?dewiki") v11("?en_title") v10("?enwiki") v2("?instance") v18("?ist_ein") v1("?item"):::projected v14("?itemName") v16("?klasse"):::projected v3("?location"):::projected v13("?page_title"):::projected v6("?pq_obj"):::projected v7("?pq_qual") v5("?statement") v4("?ve") v17("?velabel"):::projected v15("?verbund"):::projected v19("?verwaltungseinheiten") c8(["p:qualifier/P642"]):::iri c12([https://de.wikipedia.org/]):::iri c18(["#91;AUTO_LANGUAGE#93;, en"]):::literal c2(["wd:Q1793804"]):::iri c4(["wd:Q10562"]):::iri c14([https://en.wikipedia.org/]):::iri c16(["bd:serviceParam"]):::iri v1 --"p:direct/P31"--> c2 v1 --"p:direct/P131"--> c4 v1 --"p:direct/P31"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P625".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P131".-> v4 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P31".-> v5 v5 --"p:statement/P31"--> c2 v5 -->c8--> v6 v7 --"wikibase:qualifier"--> c8 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v8 -."schema:about".-> v1 v8 --"schema:isPartOf"--> c12 v8 --"schema:name"--> v9 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v10 -."schema:about".-> v1 v10 --"schema:isPartOf"--> c14 v10 --"schema:name"--> v11 end bind0[/"if(bound(?dewiki),?dewiki,?enwiki)"/] v8 --o bind0 v10 --o bind0 bind0 --as--o v12 bind1[/"if(bound(?de_title),?de_title,if(bound(?en_title),?en_title,?itemName))"/] v9 --o bind1 v11 --o bind1 v14 --o bind1 bind1 --as--o v13 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c16 --"wikibase:language"--> c18 v1 --"rdfs:label"--> v14 v6 --"rdfs:label"--> v15 v2 --"rdfs:label"--> v16 v4 --"rdfs:label"--> v17 end bind4[/"?klasse"/] v16 --o bind4 bind4 --as--o v18 bind5[/"?velabel"/] v17 --o bind5 bind5 --as--o v19