query-658a18d2e52d40278f2e3ddf0e625e2e
Number of free (unoccupied) beds per hospital SELECT ?hospital ?hospitalLabel ?beds ?bedsOccupied ?bedsFree WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de". } ?hospital wdt:P31 wd:Q16917; wdt:P131 wd:Q64; wdt:P6801 ?beds; wdt:P8049 ?bedsOccupied. #wdt:P1128 ?bedsOccupied. #for testing purposes BIND (?beds - ?bedsOccupied AS ?bedsFree) }
Use at
- https://query.wikidata.org/sparql
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#>
#Number of free (unoccupied) beds per hospital
SELECT ?hospital ?hospitalLabel ?beds ?bedsOccupied ?bedsFree WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de". }
?hospital wdt:P31 wd:Q16917;
wdt:P131 wd:Q64;
wdt:P6801 ?beds;
wdt:P8049 ?bedsOccupied.
#wdt:P1128 ?bedsOccupied. #for testing purposes
BIND (?beds - ?bedsOccupied AS ?bedsFree)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?beds"):::projected
v4("?bedsFree"):::projected
v3("?bedsOccupied"):::projected
v1("?hospital"):::projected
c4(["#91;AUTO_LANGUAGE#93;,de"]):::literal
c2(["bd:serviceParam"]):::iri
c6(["wd:Q16917"]):::iri
c8(["wd:Q64"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v1 --"wdt:P31"--> c6
v1 --"wdt:P131"--> c8
v1 --"wdt:P6801"--> v2
v1 --"wdt:P8049"--> v3
bind0[/"?beds - ?bedsOccupied"/]
v2 --o bind0
v3 --o bind0
bind0 --as--o v4