query-a5e22b9cd5c8cc6a1f853a1616314533

rq turtle/ttl

Propertiesinstance of (P31)affiliation (P1416)parent organization (P749)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 ?hospital ?hospitalLabel ?university ?universityLabel WHERE {
   ?hospital wdt:P31 wd:Q1059324;            
         { 
           {?hospital wdt:P1416 ?university} # affiliation with
           UNION 
           {?hospital wdt:P749 ?university} # has parent organization
         }  
   UNION
         {
           ?hospital wdt:P361 ?university          
         } .
   ?university wdt:P31 wd:Q3918.
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
 }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?hospital"):::projected v2("?university"):::projected c2(["wd:Q1059324"]):::iri c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal c6(["wd:Q3918"]):::iri v1 --"wdt:P31"--> c2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P361"--> v2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P749"--> v2 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P1416"--> v2 end union1r <== or ==> union1l end end union0r <== or ==> union0l end v2 --"wdt:P31"--> c6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end