query-ea7c385558b1f6b4d515a41b94456b55

rq turtle/ttl

Herzi Pinkidata.gv.at

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
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#>
SELECT ?Gemeinde_in__sterreich ?Gemeinde_in__sterreichLabel ?Gem_in_LandLabel ?burgamasta ?burgamastaLabel WHERE {
  VALUES ?Gem_in_Land {
    wd:Q667509
  }
  {
    ?Gemeinde_in__sterreich wdt:P31 ?Gem_in_Land;
      p:P6 ?HoG.
    ?HoG rdf:type wdno:P6;
      pq:P1932 ?burgamasta.
  }
  UNION
  {
    ?Gemeinde_in__sterreich wdt:P31 ?Gem_in_Land;
      p:P6 ?HoG.
    ?HoG ps:P6 ?burgamasta.
    OPTIONAL { ?HoG pq:P580 ?startzeitpunkt. }    FILTER(NOT EXISTS { ?HoG pq:P582 ?endzeitpunkt. })
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY (?burgamastaLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?Gem_in_Land") v3("?Gemeinde_in__sterreich"):::projected v4("?HoG") v5("?burgamasta"):::projected v1("?burgamastaLabel"):::projected v6("?endzeitpunkt") v7("?startzeitpunkt") c4(["p:novalue/P6"]):::iri c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?Gem_in_Land/] bind0-->v2 bind00(["wd:Q667509"]) bind00 --> bind0 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f1[["not "]] subgraph f1e0["Exists Clause"] e0v1 --"p:qualifier/P582"--> e0v2 e0v1("?HoG"):::projected e0v2("?endzeitpunkt"):::projected end f1--EXISTS--> f1e0 f1 --> v4 f1 --> c6 f1 --> v6 v4 --"p:qualifier/P582"--> v6 v3 --"p:direct/P31"--> v2 v3 --"p:P6"--> v4 v4 --"p:statement/P6"--> v5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P580".-> v7 end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> v2 v3 --"p:P6"--> v4 v4 --"a"--> c4 v4 --"p:qualifier/P1932"--> v5 end union0r <== or ==> union0l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end