File tree Expand file tree Collapse file tree
documentation/user-guides/design-patterns/Design Pattern 1/facility location/sparql Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# CQ1: Where is a specific facility located?
22# Returns the immediate site(s) where a given facility is located
33
4- PREFIX : <https ://www.commoncoreontologies .org/CommonCoreOntologiesMerged/ >
4+ PREFIX rdfs : <http ://www.w3 .org/2000/01/rdf-schema# >
55PREFIX cco: <https://www.commoncoreontologies.org/>
66PREFIX obo: <http://purl.obolibrary.org/obo/>
7- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
7+ PREFIX facility: <https://www.commoncoreontologies.org/ont00000192>
8+ PREFIX located_in: <http://purl.obolibrary.org/obo/BFO_0000171>
89
910SELECT ?facility ?facilityLabel ?site ?siteLabel
1011WHERE {
11- ?facility a cco:ont00000192 ;
12+ ?facility a facility: ;
1213 rdfs:label ?facilityLabel ;
13- obo:BFO_0000171 ?site .
14+ located_in: ?site .
1415 ?site rdfs:label ?siteLabel .
1516}
17+
Original file line number Diff line number Diff line change 22# that the facility is also located in that are within the bigger site?
33# Uses property paths to find the full location hierarchy
44
5- PREFIX : <https ://www.commoncoreontologies .org/CommonCoreOntologiesMerged/ >
5+ PREFIX rdfs : <http ://www.w3 .org/2000/01/rdf-schema# >
66PREFIX cco: <https://www.commoncoreontologies.org/>
77PREFIX obo: <http://purl.obolibrary.org/obo/>
8- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
8+ PREFIX facility: <https://www.commoncoreontologies.org/ont00000192>
9+ PREFIX located_in: <http://purl.obolibrary.org/obo/BFO_0000171>
910
1011SELECT ?facility ?facilityLabel ?immediateSite ?immediateSiteLabel ?largerSite ?largerSiteLabel
1112WHERE {
12- ?facility a cco:ont00000192 ;
13+ ?facility a facility: ;
1314 rdfs:label ?facilityLabel ;
14- obo:BFO_0000171 ?immediateSite .
15+ located_in: ?immediateSite .
1516 ?immediateSite rdfs:label ?immediateSiteLabel ;
16- obo:BFO_0000171 + ?largerSite .
17+ located_in: + ?largerSite .
1718 ?largerSite rdfs:label ?largerSiteLabel .
1819}
1920ORDER BY ?facility ?largerSite
20-
Original file line number Diff line number Diff line change 11# CQ3: What are all the facilities located within a particular site?
22# Finds facilities directly or transitively located within a site
33
4- PREFIX : <https ://www.commoncoreontologies .org/CommonCoreOntologiesMerged/ >
4+ PREFIX rdfs : <http ://www.w3 .org/2000/01/rdf-schema# >
55PREFIX cco: <https://www.commoncoreontologies.org/>
66PREFIX obo: <http://purl.obolibrary.org/obo/>
7- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
7+ PREFIX site: <http://purl.obolibrary.org/obo/BFO_0000029>
8+ PREFIX facility: <https://www.commoncoreontologies.org/ont00000192>
9+ PREFIX located_in: <http://purl.obolibrary.org/obo/BFO_0000171>
810
911SELECT ?site ?siteLabel ?facility ?facilityLabel
1012WHERE {
11- ?site a obo:BFO_0000029 ;
13+ ?site a site: ;
1214 rdfs:label ?siteLabel .
13- ?facility a cco:ont00000192 ;
15+ ?facility a facility: ;
1416 rdfs:label ?facilityLabel ;
15- obo:BFO_0000171 + ?site .
17+ located_in: + ?site .
1618}
1719ORDER BY ?site ?facility
You can’t perform that action at this time.
0 commit comments