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

V1.4.0 Release Candidate 1 #613

Merged
merged 17 commits into from
Jan 24, 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/deprecations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .namespaces import BRICK, RDFS, SKOS, A
from .namespaces import BRICK, RDFS, SKOS, A, REC

deprecations = {
BRICK.Condenser: {
Expand Down
2 changes: 1 addition & 1 deletion bricksrc/quantities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from brickschema.graph import Graph
from ontoenv import OntoEnv
from rdflib import Literal, URIRef
from .namespaces import SKOS, OWL, RDFS, BRICK, QUDTQK, QUDTDV, QUDT, UNIT
from .namespaces import SKOS, RDFS, BRICK, QUDTQK, QUDTDV, QUDT, UNIT

env = OntoEnv(initialize=True, search_dirs=["support/"])
g = Graph()
Expand Down
1 change: 1 addition & 0 deletions bricksrc/rules.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ CONSTRUCT {
$this rdfs:range ?shape .
?shape a sh:NodeShape .
?ent $this ?val .
FILTER NOT EXISTS { ?val a ?shape }
}""" ;
sh:prefixes <https://brickschema.org/schema/1.3/Brick> ;
] ;
Expand Down
6 changes: 3 additions & 3 deletions bricksrc/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

# Minor version: increment for substantial additions to the ontology that
# are backwards compatible
BRICK_MINOR_VERSION = 3
BRICK_MINOR_VERSION = 4

# Patch version: increment for minor additions/changes to the ontology that
# are largely backwards compatible (bug-fixes exempted)
BRICK_PATCH_VERSION = 0

# the simplified (no patch version) version number for Brick. Intended for
# inclusion in the Brick namespace URI
BRICK_VERSION = f"{BRICK_MAJOR_VERSION}.{BRICK_MINOR_VERSION}"
BRICK_VERSION = f"{BRICK_MAJOR_VERSION}.{BRICK_MINOR_VERSION}-rc1"

# the full "semantic verersion" including the patch number
BRICK_FULL_VERSION = f"{BRICK_VERSION}.{BRICK_PATCH_VERSION}"
BRICK_FULL_VERSION = f"{BRICK_VERSION}.{BRICK_PATCH_VERSION}-rc1"
2 changes: 1 addition & 1 deletion examples/last_known_value/last_known_value.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ bldg:sensor1 a brick:Air_Temperature_Sensor ;

bldg:sensor1_reading1 a rec:TemperatureObservation ;
brick:value "72.0"^^xsd:double ;
brick:timestamp "2020-01-01T00:00:00Z"^^xsd:dateTime ;
brick:timestamp "2024-01-01T00:00:00Z"^^xsd:dateTime ;
rec:sourcePoint bldg:sensor1 .
64 changes: 64 additions & 0 deletions examples/rec-with-brick/building.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
@prefix ex: <http://example.com#> .
@prefix rec: <https://w3id.org/rec/core/> .
@prefix brick: <https://brickschema.org/schema/1.1/Brick#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

ex:Building1 a rec:Building .

# Floors
ex:Floor1 a rec:Storey ;
rec:isPartOf ex:Building1 .
ex:Floor2 a rec:Storey ;
rec:isPartOf ex:Building1 .

# Zones for each floor
ex:Floor1Zone1 a rec:Zone ;
rec:isPartOf ex:Floor1 .
ex:Floor1Zone2 a rec:Zone ;
rec:isPartOf ex:Floor1 .
ex:Floor2Zone1 a rec:Zone ;
rec:isPartOf ex:Floor2 .
ex:Floor2Zone2 a rec:Zone ;
rec:isPartOf ex:Floor2 .

# Rooms for each zone
ex:Room1 a rec:Space ;
rec:isPartOf ex:Floor1Zone1 .
ex:Room2 a rec:Space ;
rec:isPartOf ex:Floor1Zone1 .
ex:Room3 a rec:Space ;
rec:isPartOf ex:Floor1Zone2 .
ex:Room4 a rec:Space ;
rec:isPartOf ex:Floor1Zone2 .
ex:Room5 a rec:Space ;
rec:isPartOf ex:Floor2Zone1 .
ex:Room6 a rec:Space ;
rec:isPartOf ex:Floor2Zone1 .
ex:Room7 a rec:Space ;
rec:isPartOf ex:Floor2Zone2 .
ex:Room8 a rec:Space ;
rec:isPartOf ex:Floor2Zone2 .

# AHU and VAVs
ex:MainAHU a brick:Air_Handler_Unit ;
brick:feeds ex:RVAV1, ex:RVAV2, ex:RVAV3, ex:RVAV4 .

ex:RVAV1 a brick:Variable_Air_Volume_Box_With_Reheat ;
brick:feeds ex:Floor1Zone1 .
ex:RVAV2 a brick:Variable_Air_Volume_Box_With_Reheat ;
brick:feeds ex:Floor1Zone2 .
ex:RVAV3 a brick:Variable_Air_Volume_Box_With_Reheat ;
brick:feeds ex:Floor2Zone1 .
ex:RVAV4 a brick:Variable_Air_Volume_Box_With_Reheat ;
brick:feeds ex:Floor2Zone2 .

# Sensors and Setpoints for each RVAV (only doing for RVAV1 as example, repeat for others)
ex:AirTempSensor_RVAV1 a brick:Air_Temperature_Sensor ;
brick:isPointOf ex:RVAV1 .

ex:AirTempSetpoint_RVAV1 a brick:Temperature_Setpoint ;
brick:hasPoint ex:RVAV1 .

ex:AirFlowSensor_RVAV1 a brick:Air_Flow_Sensor ;
brick:isPointOf ex:RVAV1 .
18 changes: 12 additions & 6 deletions generate_brick.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,9 +1073,14 @@ def handle_deprecations():
fp.write(graph.serialize(format="turtle").rstrip())
fp.write("\n")

# add rec stuff
env = ontoenv.OntoEnv(initialize=True, search_dirs=["support/"])
env.import_graph(G, "support/rec.ttl")
env.import_graph(G, "support/brickpatches.ttl")

# add inferred information to Brick
# logger.info("Adding inferred information to Brick")
# G.expand('shacl', backend='topquadrant')
#logger.info("Adding inferred information to Brick")
#G.expand('shacl', backend='topquadrant')

# serialize Brick to output
with open("Brick.ttl", "w", encoding="utf-8") as fp:
Expand All @@ -1089,11 +1094,12 @@ def handle_deprecations():

# create new directory for storing imports
os.makedirs("imports", exist_ok=True)
env = ontoenv.OntoEnv(initialize=True, search_dirs=["support/"])
for name, uri in ontology_imports.items():
depg, loc = env.resolve_uri(str(uri))
depg.serialize(Path("imports") / f"{name}.ttl", format="ttl")
G += depg # add the imported graph to Brick so we can do validation
graph, _ = env.resolve_uri(uri)
env.import_graph(G, graph)

# add new Brick to ontology environment
env.refresh()

# validate Brick
valid, _, report = G.validate(engine="topquadrant")
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ flake8>=6.0
semver>=2.10.1
pytest-xdist[psutil]
html5lib
ontoenv>=0.4.0a8
ontoenv>=0.4.0a12
Loading