Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding 223 example #642

Merged
merged 6 commits into from
Jun 21, 2024
Merged
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
2 changes: 1 addition & 1 deletion bricksrc/env.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from ontoenv import OntoEnv, Config
cfg = Config(["support/"], strict=False, offline=True)
cfg = Config(["support/", "extensions/", "examples/"], strict=False, offline=True)
env = OntoEnv(cfg)
13 changes: 8 additions & 5 deletions bricksrc/root_class_shapes.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ brick:Point a sh:NodeShape;
sh:maxCount 0 ;
sh:message "Points cannot have locations; use 'isPointOf' instead" ;
] ;
sh:property [
sh:path brick:isPointOf ;
sh:or ( [ sh:class brick:Equipment ] [ sh:class brick:Location ] [ sh:class rec:Space ] );
sh:message "A Point can be a Point of Equipment, Location or Space."
] ;
.

brick:Collection a sh:NodeShape;
Expand Down Expand Up @@ -139,3 +134,11 @@ bsh:hasHotColdDeck
sh:message "DDAHU must have a brick:Cold_Deck" ;
] ;
.

bsh:isPointOfShape a sh:PropertyShape ;
sh:targetClass brick:Point ;
sh:path brick:isPointOf ;
sh:or ( [ sh:class brick:Equipment ] [ sh:class brick:Location ] [ sh:class rec:Space ] );
sh:message "A Point can be a Point of Equipment, Location or Space."
.

39 changes: 39 additions & 0 deletions examples/connections/duct.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix s223: <http://data.ashrae.org/standard223#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix : <urn:duct_example/> .

<urn:duct_example> a owl:Ontology ;
owl:imports <https://brickschema.org/schema/1.4/Brick>,
<https://brickschema.org/extension/s223extension> .

:saf1 a brick:Supply_Air_Flow_Sensor ;
rdfs:label "Supply Air Flow Sensor" .

# define the AHU with a air supply connection point
:ahu a brick:AHU ;
rdfs:label "AHU" ;
s223:hasConnectionPoint :ahu_air_supply .

:ahu_air_supply a s223:OutletConnectionPoint ;
rdfs:label "AHU air supply" ;
s223:hasRole s223:Role-Supply ;
brick:hasPoint :saf1 ; # put the supply air flow sensor at the outlet of the AHU
s223:hasMedium s223:Medium-Air .

# define the VAV with a air inlet connection point
:vav a brick:VAV ;
rdfs:label "VAV" ;
s223:hasConnectionPoint :vav_air_inlet .
:vav_air_inlet a s223:InletConnectionPoint ;
rdfs:label "VAV air inlet" ;
s223:hasMedium s223:Medium-Air .

# now that we have connection points, we can define the duct using s223:cnx,
# which will infer the rest of the relationship and the correct direction
# of the connection
:duct a s223:Duct ;
rdfs:label "duct" ;
s223:hasMedium s223:Medium-Air ;
s223:cnx :ahu_air_supply, :vav_air_inlet .
77 changes: 77 additions & 0 deletions examples/connections/rvav.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix s223: <http://data.ashrae.org/standard223#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix : <urn:rvav_example/> .


<urn:rvav_example> a owl:Ontology ;
owl:imports <https://brickschema.org/schema/1.4/Brick>,
<https://brickschema.org/extension/s223extension> .

# define the VAV with air and water connection points
:vav a brick:VAV ;
rdfs:label "VAV" ;
brick:hasPart :coil, :damper ;
s223:hasConnectionPoint :vav_air_inlet, :vav_air_outlet, :vav_water_inlet, :vav_water_outlet .

:vav_air_inlet a s223:InletConnectionPoint ;
rdfs:label "VAV air inlet" ;
s223:hasMedium s223:Medium-Air .

:vav_air_outlet a s223:OutletConnectionPoint ;
rdfs:label "VAV air outlet" ;
s223:hasMedium s223:Medium-Air .

:vav_water_inlet a s223:InletConnectionPoint ;
rdfs:label "VAV water inlet" ;
s223:hasMedium s223:Medium-Water .

:vav_water_outlet a s223:OutletConnectionPoint ;
rdfs:label "VAV water outlet" ;
s223:hasMedium s223:Medium-Water .


# define the coil with water connection points
:coil a brick:Hot_Water_Coil ;
rdfs:label "Heating Coil" ;
s223:hasConnectionPoint :coil_water_inlet, :coil_water_outlet .

:coil_water_inlet a s223:InletConnectionPoint ;
rdfs:label "Coil water inlet" ;
s223:mapsTo :vav_water_inlet ;
s223:hasMedium s223:Medium-Water .

:coil_water_outlet a s223:OutletConnectionPoint ;
rdfs:label "Coil water outlet" ;
s223:mapsTo :vav_water_outlet ;
s223:hasMedium s223:Medium-Water .

# define the damper
:damper a brick:Damper ;
rdfs:label "Damper" .

# define the boiler
:boiler a brick:Boiler ;
rdfs:label "Boiler" ;
s223:hasConnectionPoint :boiler_water_supply, :boiler_water_return .

:boiler_water_supply a s223:OutletConnectionPoint ;
rdfs:label "Boiler water supply" ;
s223:hasMedium s223:Medium-Water .

:boiler_water_return a s223:InletConnectionPoint ;
rdfs:label "Boiler water return" ;
s223:hasMedium s223:Medium-Water .

# define the pipes
:pipe1 a s223:Pipe ;
rdfs:label "Pipe 1" ;
s223:hasMedium s223:Medium-Water ;
s223:cnx :boiler_water_supply, :coil_water_inlet .

:pipe2 a s223:Pipe ;
rdfs:label "Pipe 2" ;
s223:hasMedium s223:Medium-Water ;
s223:cnx :coil_water_outlet, :boiler_water_return .

4 changes: 2 additions & 2 deletions examples/simple_apartment/apartment.ttl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@prefix apt: <apartment#> .
@prefix apt: <urn:apartment#> .
@prefix brick: <https://brickschema.org/schema/Brick#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .

<apartment> a owl:Ontology ;
<urn:apartment> a owl:Ontology ;
owl:imports <https://brickschema.org/schema/1.4/Brick> .

apt:bedroom a brick:Room ;
Expand Down
36 changes: 19 additions & 17 deletions extensions/brick_extension_interpret_223.shapes.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,25 @@ s223:DomainSpace
sh:subject sh:this ;
] ;
.
s223:EnumerationKind-Medium
sh:rule [
a sh:TripleRule ;
sh:object [
sh:path s223tobrick:translatesTo ;
] ;
sh:predicate brick:hasSubstance ;
sh:subject [
sh:path (
[
sh:inversePath s223:hasMedium ;
]
s223:isConnectionPointOf
) ;
] ;
] ;
.
# TODO: the rule execution in topquaadrant does not seem to evaluate the blank node
# expressions inside sh:object, sh:subject
#s223:EnumerationKind-Medium
# sh:rule [
# a sh:TripleRule ;
# sh:object [
# sh:path s223tobrick:translatesTo ;
# ] ;
# sh:predicate brick:hasSubstance ;
# sh:subject [
# sh:path (
# [
# sh:inversePath s223:hasMedium ;
# ]
# s223:isConnectionPointOf
# ) ;
# ] ;
# ] ;
#.
s223:Setpoint
sh:rule [
a sh:TripleRule ;
Expand Down
6 changes: 4 additions & 2 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
Tests all example files. See tests/conftest.py for the fixture that generates each of the individual test cases
"""
import ontoenv
from rdflib import OWL, RDF
from brickschema import Graph

env = ontoenv.OntoEnv(read_only=True)


def test_example_file_with_reasoning(brick_with_imports, filename):
g = brick_with_imports
def test_example_file_with_reasoning(filename):
g = Graph()
g.load_file(filename)
env.import_dependencies(g)
g.expand("shacl", backend="topquadrant")
Expand Down
Loading