query-570ec681340fe6c6eb9ddd6153bad0da

rq turtle/ttl

Propertiescoordinate location (P625)instance of (P31)subclass of (P279)country (P17)state of use (P5817)OpenStreetMap relation ID (P402)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?geo ?osmnode ?status ?itemLabel  WHERE {
  ?item wdt:P625 ?geo. #liegt in der Schweiz
  { ?item (wdt:P31/(wdt:P279*)) wd:Q16917. } #Spital
  UNION
  { ?item (wdt:P31/(wdt:P279*)) wd:Q22908. } #Altersheim
  UNION
  { ?item (wdt:P31/(wdt:P279*)) wd:Q837142. } #Pflegeheim
  UNION
  { ?item (wdt:P31/(wdt:P279*)) wd:Q4260475. } #medizinische Einrichtung
  ?item wdt:P17 wd:Q39.
  FILTER NOT EXISTS { ?item wdt:P5817 wd:Q56651571 }
  OPTIONAL { ?item wdt:P402 ?osmnode. } # OSM-Node
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "de-ch,de,fr,it,rm,en". #Reihenfolge der Sprache (rm = rätromanisch)
    ?item rdfs:label ?itemLabel.
  }
} 
ORDER BY (?itemLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?geo"):::projected v2("?item"):::projected v1("?itemLabel"):::projected v4("?osmnode"):::projected a1((" ")) a2((" ")) a3((" ")) a4((" ")) c16(["de-ch,de,fr,it,rm,en"]):::literal c11(["wd:Q39"]):::iri c7(["wd:Q22908"]):::iri c14(["bd:serviceParam"]):::iri c8(["wd:Q837142"]):::iri c9(["wd:Q4260475"]):::iri c6(["wd:Q16917"]):::iri c2(["wd:Q56651571"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P5817"--> e0c2 e0v1("?item"):::projected e0c2(["wd:Q56651571"]):::iri end f0--EXISTS--> f0e0 f0 --> v2 f0 --> c1 f0 --> c2 v2 --"wdt:P5817"--> c2 v2 --"wdt:P625"--> v3 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a4 a4 --"wdt:P279"--> c9 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a3 a3 --"wdt:P279"--> c8 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c7 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c6 end union0r <== or ==> union0l end v2 --"wdt:P17"--> c11 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P402".-> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 v2 --"rdfs:label"--> v1 end