Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Pattern Name
Facility Location

# Intent

To represent location relationships where material entities (e.g., facilities, equipment, infrastructure) are situated within progressively larger geographic regions or sites (e.g., building → campus → city → state → country), enabling multi-level location queries and reasoning. The specific entity types and site hierarchies shown are examples. This pattern generalizes to any material entity that can be located at sites, and any hierarchical organization of sites.

# Competency Questions

1. Where is a specific facility located?
2. What bigger site is this facility located in, and are there smaller sites that the facility is located in that are also located in the bigger site?
3. What are all the facilities located within a particular site?

# Structure

Represents the location of a site and their appropriate relations with a broader area.

Helps with creating transitive relations between sites.

Visual model through mermaid and png.

*Note: Entity types and location hierarchies shown are illustrative examples. This pattern applies to any material entities and site taxonomies relevant to your domain.*
```mermaid
flowchart BT
A@{ label: "<font color=\"#000000\">Facility 1</font>" } -- LocatedIn<br>BFO:0000171 --> B@{ label: "<font color=\"#000000\">City 1</font>" }
B -- LocatedIn<br>BFO:0000171 --> C@{ label: "<font color=\"#000000\">State 1</font>" }
A -- rdf:type --> D@{ label: "<span style=\"color:black\"><b>Facility<br>ont00000192</b></span><br>" }
B -- rdf:type --> E@{ label: "<span style=\"color:black\"><b>Site<br>BFO_0000029</b></span><br>" }
C -- rdf:type --> E
A -. rdfs:label .-> F["Building 1"]
B -. rdfs:label .-> G["NY City"]
C -. rdfs:label .-> H["NY State"]

subgraph Legend[" "]
direction LR
AA{Individual}
BB[Class]
CC[data]
AA --> |relation| CC
end

A ~~~ Legend

A@{ shape: diam}
B@{ shape: diam}
C@{ shape: diam}
D@{ shape: rect}
E@{ shape: rect}
F@{ shape: rect}
G@{ shape: rect}
H@{ shape: rect}
A:::purple
B:::purple
C:::purple
D:::yellow
E:::yellow
F:::white
G:::white
H:::white
classDef yellow fill:#ffe680
classDef purple fill:#dbc9ef
classDef white fill:#FFFFFF
class BB yellow
class AA purple
class CC white
```

# File Structure
```
facility-location/
├── README.md
├── mermaid/
│ ├── FacilityLocation.md # Mermaid source file
│ └── FacilityLocation.png # Exported PNG diagram
└── sparql/
├── CQ1.sparql # Where is a specific facility located?
├── CQ2.sparql # What larger/smaller sites contain this facility?
├── CQ3.sparql # What facilities are within a particular site?
└── example.ttl # Test data for SPARQL queries
```

## File Descriptions

### mermaid/
| File | Description |
|------|-------------|
| `FacilityLocation.md` | Mermaid diagram source showing the pattern structure |
| `FacilityLocation.png` | PNG export of the diagram for documentation |

### sparql/
| File | Competency Question |
|------|---------------------|
| `CQ1.sparql` | Where is a specific facility located? |
| `CQ2.sparql` | What bigger site is this facility located in, and are there smaller sites that the facility is located in that are also located in the bigger site? |
| `CQ3.sparql` | What are all the facilities located within a particular site? |
| `example.ttl` | Turtle file with test instances (states, cities, campuses, buildings, facilities) |

# Additional Notes

- Related pattern: Geospatial Coordinate Pattern
- Key classes: `obo:BFO_0000029` (Site), `cco:ont00000192` (Facility)
- Key property: `obo:BFO_0000171` (located in)

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
flowchart BT
A@{ label: "<font color=\"#000000\">Facility 1</font>" } -- LocatedIn<br>BFO:0000171 --> B@{ label: "<font color=\"#000000\">City 1</font>" }
B -- LocatedIn<br>BFO:0000171 --> C@{ label: "<font color=\"#000000\">State 1</font>" }
A -- rdf:type --> D@{ label: "<span style=\"color:black\"><b>Facility<br>ont00000192</b></span><br>" }
B -- rdf:type --> E@{ label: "<span style=\"color:black\"><b>Site<br>BFO_0000029</b></span><br>" }
C -- rdf:type --> E
A -. rdfs:label .-> F["Building 1"]
B -. rdfs:label .-> G["NY City"]
C -. rdfs:label .-> H["NY State"]

subgraph Legend[" "]
direction LR
AA{Individual}
BB[Class]
CC[data]
AA --> |relation| CC
end

A ~~~ Legend

A@{ shape: diam}
B@{ shape: diam}
C@{ shape: diam}
D@{ shape: rect}
E@{ shape: rect}
F@{ shape: rect}
G@{ shape: rect}
H@{ shape: rect}
A:::purple
B:::purple
C:::purple
D:::yellow
E:::yellow
F:::white
G:::white
H:::white
classDef yellow fill:#ffe680
classDef purple fill:#dbc9ef
classDef white fill:#FFFFFF
class BB yellow
class AA purple
class CC white

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# CQ1: Where is a specific facility located?
# Returns the immediate site(s) where a given facility is located

PREFIX : <https://www.commoncoreontologies.org/CommonCoreOntologiesMerged/>
PREFIX cco: <https://www.commoncoreontologies.org/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?facility ?facilityLabel ?site ?siteLabel
WHERE {
?facility a cco:ont00000192 ;
rdfs:label ?facilityLabel ;
obo:BFO_0000171 ?site .
?site rdfs:label ?siteLabel .
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# CQ2: What bigger site is this facility located in, and are there smaller sites
# that the facility is also located in that are within the bigger site?
# Uses property paths to find the full location hierarchy

PREFIX : <https://www.commoncoreontologies.org/CommonCoreOntologiesMerged/>
PREFIX cco: <https://www.commoncoreontologies.org/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?facility ?facilityLabel ?immediateSite ?immediateSiteLabel ?largerSite ?largerSiteLabel
WHERE {
?facility a cco:ont00000192 ;
rdfs:label ?facilityLabel ;
obo:BFO_0000171 ?immediateSite .
?immediateSite rdfs:label ?immediateSiteLabel ;
obo:BFO_0000171+ ?largerSite .
?largerSite rdfs:label ?largerSiteLabel .
}
ORDER BY ?facility ?largerSite

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# CQ3: What are all the facilities located within a particular site?
# Finds facilities directly or transitively located within a site

PREFIX : <https://www.commoncoreontologies.org/CommonCoreOntologiesMerged/>
PREFIX cco: <https://www.commoncoreontologies.org/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?site ?siteLabel ?facility ?facilityLabel
WHERE {
?site a obo:BFO_0000029 ;
rdfs:label ?siteLabel .
?facility a cco:ont00000192 ;
rdfs:label ?facilityLabel ;
obo:BFO_0000171+ ?site .
}
ORDER BY ?site ?facility
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
@prefix : <https://www.commoncoreontologies.org/CommonCoreOntologiesMerged/> .
@prefix cco: <https://www.commoncoreontologies.org/> .
@prefix obo: <http://purl.obolibrary.org/obo/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .

#################################################################
# Object Properties
#################################################################

### http://purl.obolibrary.org/obo/BFO_0000171
obo:BFO_0000171 rdf:type owl:ObjectProperty ;
dc:identifier "234-BFO" ;
rdfs:label "located in"@en ;
skos:definition "b located in c =Def b is an independent continuant & c is an independent & neither is a spatial region & there is some time t such that the spatial region which b occupies at t is continuant part of the spatial region which c occupies at t"@en ;
skos:scopeNote "Users that require more sophisticated representations of time are encouraged to import a temporal extension of BFO-Core provided by the BFO development team."@en .

#################################################################
# Classes
#################################################################

### http://purl.obolibrary.org/obo/BFO_0000029
obo:BFO_0000029 rdf:type owl:Class ;
dc:identifier "034-BFO" ;
rdfs:label "site"@en ;
skos:definition "(Elucidation) A site is a three-dimensional immaterial entity whose boundaries either (partially or wholly) coincide with the boundaries of one or more material entities or have locations determined in relation to some material entity"@en ;
skos:example "A hole in a portion of cheese; a rabbit hole; the Grand Canyon; the Piazza San Marco; the kangaroo-joey-containing hole of a kangaroo pouch; your left nostril (a fiat part - the opening - of your left nasal cavity); the lumen of your gut; the hold of a ship; the interior of the trunk of your car; hole in an engineered floor joist"@en .

### https://www.commoncoreontologies.org/ont00000192
cco:ont00000192 rdf:type owl:Class ;
rdfs:label "Facility"@en ;
skos:definition "A Material Artifact that is designed as a building or campus dedicated to some specific purpose."@en ;
cco:ont00001760 "https://www.commoncoreontologies.org/ArtifactOntology"^^xsd:anyURI .

#################################################################
# Individuals - Sites (Hierarchy)
#################################################################

# States
:state_ny rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "NY State" .

:state_ca rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "California" .

:state_tx rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "Texas" .

# Cities
:city_nyc rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "New York City" ;
obo:BFO_0000171 :state_ny .

:city_buffalo rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "Buffalo" ;
obo:BFO_0000171 :state_ny .

:city_la rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "Los Angeles" ;
obo:BFO_0000171 :state_ca .

:city_houston rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "Houston" ;
obo:BFO_0000171 :state_tx .

# Campuses
:campus_manhattan rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "Manhattan Campus" ;
obo:BFO_0000171 :city_nyc .

:campus_downtown_la rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "Downtown LA Campus" ;
obo:BFO_0000171 :city_la .

# Buildings
:building_tower1 rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "Tower 1" ;
obo:BFO_0000171 :campus_manhattan .

:building_tower2 rdf:type owl:NamedIndividual ,
obo:BFO_0000029 ;
rdfs:label "Tower 2" ;
obo:BFO_0000171 :campus_manhattan .

#################################################################
# Individuals - Facilities
#################################################################

:facility_warehouse_nyc rdf:type owl:NamedIndividual ,
cco:ont00000192 ;
rdfs:label "NYC Main Warehouse" ;
obo:BFO_0000171 :building_tower1 .

:facility_office_nyc rdf:type owl:NamedIndividual ,
cco:ont00000192 ;
rdfs:label "NYC Corporate Office" ;
obo:BFO_0000171 :building_tower2 .

:facility_lab_nyc rdf:type owl:NamedIndividual ,
cco:ont00000192 ;
rdfs:label "NYC Research Lab" ;
obo:BFO_0000171 :campus_manhattan .

:facility_warehouse_buffalo rdf:type owl:NamedIndividual ,
cco:ont00000192 ;
rdfs:label "Buffalo Distribution Center" ;
obo:BFO_0000171 :city_buffalo .

:facility_warehouse_la rdf:type owl:NamedIndividual ,
cco:ont00000192 ;
rdfs:label "LA Warehouse" ;
obo:BFO_0000171 :campus_downtown_la .

:facility_office_la rdf:type owl:NamedIndividual ,
cco:ont00000192 ;
rdfs:label "LA Regional Office" ;
obo:BFO_0000171 :city_la .

:facility_plant_houston rdf:type owl:NamedIndividual ,
cco:ont00000192 ;
rdfs:label "Houston Manufacturing Plant" ;
obo:BFO_0000171 :city_houston .


7 changes: 7 additions & 0 deletions documentation/user-guides/design-patterns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ This folder contains common CCO design patterns.
Each entry includes a mermaid graph, a visualization of that graph, a description of competency questions answered, and a sparql query to support the competency questions.

Users are encouraged to reuse these design patterns in their knowledge graphs to speed up data mapping and querying while ensuring greater consistency and interoperability across knowledge graphs.

## Folder Directory

| Folder Name | Description |
|------------------|--------------------------------------------|
| Design Pattern 1 | facility location |