query-8155860f836c09ba40f22406f8ad543e

rq turtle/ttl

Propertiescountry (P17)instance of (P31)subclass of (P279)located in the administrative territorial entity (P131)route number (P1671)owned by (P127)operator (P137)part of (P361)

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#>
SELECT
  ?item
  ?itemLabel
  ?instanceLabel
  (GROUP_CONCAT(DISTINCT ?strecke; SEPARATOR = ", ") AS ?strecke_)
  ?parentLabel
  ?ownerLabel
  ?operatorLabel
WHERE 
{


  ?item wdt:P17 wd:Q183.
  ?item wdt:P31/wdt:P279* wd:Q728937.
  FILTER EXISTS { ?item wdt:P131 wd:Q1197. }

  ?item wdt:P31 ?instance.

  OPTIONAL { ?item wdt:P1671 ?strecke. }
  OPTIONAL { ?item wdt:P127 ?owner. }
  OPTIONAL { ?item wdt:P137 ?operator. }
  OPTIONAL { ?item wdt:P361 ?parent. }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,nl". }
}
GROUP BY ?item ?itemLabel ?instanceLabel ?ownerLabel ?operatorLabel ?parentLabel
ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?instance") v2("?item"):::projected v1("?itemLabel"):::projected v6("?operator") v5("?owner") v7("?parent") v4("?strecke"):::projected v8("?strecke_") a1((" ")) c15(["de,nl"]):::literal c7(["wd:Q728937"]):::iri c13(["bd:serviceParam"]):::iri c2(["wd:Q1197"]):::iri c4(["wd:Q183"]):::iri f0[[" "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P131"--> e0c2 e0v1("?item"):::projected e0c2(["wd:Q1197"]):::iri end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> c2 v2 --"wdt:P131"--> c2 v2 --"wdt:P17"--> c4 v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c7 v2 --"wdt:P31"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P1671".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P127".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P137".-> v6 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P361".-> v7 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end bind2[/"?strecke"/] v4 --o bind2 bind2 --as--o v8