Skip to content

Commit f221175

Browse files
committed
Merge origin/v1.5.0 into v1.5.0
2 parents cb18482 + 8011f91 commit f221175

11 files changed

Lines changed: 56 additions & 119 deletions

bricksrc/deprecations.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
from .namespaces import BRICK, RDFS, SKOS, A, QUDTQK
1+
from .namespaces import BRICK, RDFS, SKOS, A, QUDTQK, REC
22

33
deprecations = {
4+
BRICK.Collection: {
5+
"version": "1.5.0",
6+
"mitigation_message": "Brick Collection is deprecated in favor of REC Collection to remove redundancy between the two ontologies.",
7+
"replace_with": REC.Collection,
8+
RDFS.subClassOf: BRICK.Entity,
9+
},
410
BRICK.Speed_Status: {
511
"version": "1.4.0",
612
"mitigation_message": "Speed Status is no longer necessary. Use Speed Mode Status for motors with various categorical speed settings, such as low, medium, and high. To further clarify, points representing the current speed of a variable speed fan as an analog value or input, use Speed Sensor.",

bricksrc/relationships.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"isTagOf": {
133133
A: [OWL.ObjectProperty, OWL.AsymmetricProperty, OWL.IrreflexiveProperty],
134134
"domain": BRICK.Tag,
135-
"range": [BRICK.Entity, BRICK.Measurable],
135+
"range": [BRICK.Entity, BRICK.Measurable, REC.Collection],
136136
RDFS.label: Literal("Is tag of", lang="en"),
137137
},
138138
"hasAssociatedTag": {
@@ -194,14 +194,24 @@
194194
OWL.inverseOf: BRICK.isMeteredBy,
195195
"domain": BRICK.Meter,
196196
# this is a special property that implements the 'range' as a SHACL shape
197-
"range": [BRICK.Equipment, BRICK.Location, BRICK.Collection, REC.Architecture],
197+
"range": [
198+
BRICK.Equipment,
199+
BRICK.Location,
200+
REC.Collection,
201+
REC.Architecture,
202+
],
198203
RDFS.label: Literal("meters", lang="en"),
199204
},
200205
"isMeteredBy": {
201206
A: [OWL.ObjectProperty, OWL.AsymmetricProperty, OWL.IrreflexiveProperty],
202207
OWL.inverseOf: BRICK.meters,
203208
# this is a special property that implements the 'domain' as a SHACL shape
204-
"domain": [BRICK.Equipment, BRICK.Location, BRICK.Collection, REC.Architecture],
209+
"domain": [
210+
BRICK.Equipment,
211+
BRICK.Location,
212+
REC.Collection,
213+
REC.Architecture,
214+
],
205215
"range": BRICK.Meter,
206216
RDFS.label: Literal("is metered by", lang="en"),
207217
},

bricksrc/root_class_shapes.ttl

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ brick:Location a sh:NodeShape ;
1616
[sh:not [ sh:class brick:Equipment ] ; sh:message "Location is an exclusive top class." ],
1717
[sh:not [ sh:class brick:Substance ] ; sh:message "Location is an exclusive top class." ],
1818
[sh:not [ sh:class brick:Quantity ] ; sh:message "Location is an exclusive top class." ],
19-
[sh:not [ sh:class brick:Collection ] ; sh:message "Location is an exclusive top class." ] ;
19+
[sh:not [ sh:class rec:Collection ] ; sh:message "Location is an exclusive top class." ] ;
2020
sh:property [
2121
sh:path brick:hasPart;
2222
sh:or ( [ sh:class brick:Location] [ sh:class rec:Space ] );
@@ -43,7 +43,7 @@ brick:Equipment a sh:NodeShape ;
4343
sh:not [ sh:class brick:Location ; sh:message "Instances of Equipment cannot be Locations." ] ,
4444
[ sh:class brick:Substance ; sh:message "Instances of Equipment cannot be Substances." ],
4545
[ sh:class brick:Quantity ; sh:message "Instances of Equipment cannot be Quantities." ],
46-
[ sh:class brick:Collection ; sh:message "Instances of Equipment cannot be Collections." ],
46+
[ sh:class rec:Collection ; sh:message "Instances of Equipment cannot be Collections." ],
4747
[ sh:class brick:Point ; sh:message "Instances of Equipment cannot be Points." ],
4848
[ sh:class brick:EntityProperty ; sh:message "Instances of Equipment cannot be EntityProperties." ] ;
4949
sh:property [
@@ -66,7 +66,7 @@ brick:Equipment a sh:NodeShape ;
6666
sh:or (
6767
[ sh:class brick:System ]
6868
[ sh:class brick:Equipment ]
69-
[ sh:class brick:Collection ]
69+
[ sh:class rec:Collection ]
7070
);
7171
sh:message "Equipment can be part of a Collection, System or other Equipment."
7272
];
@@ -122,7 +122,7 @@ brick:Point a sh:NodeShape;
122122
[ sh:class brick:Location ; sh:message "Instances of Point cannot be Locations." ],
123123
[ sh:class brick:Substance ; sh:message "Instances of Point cannot be Substances." ],
124124
[ sh:class brick:Quantity ; sh:message "Instances of Point cannot be Quantities." ],
125-
[ sh:class brick:Collection ; sh:message "Instances of Point cannot be Collections." ],
125+
[ sh:class rec:Collection ; sh:message "Instances of Point cannot be Collections." ],
126126
[ sh:class brick:EntityProperty ; sh:message "Instances of Point cannot be EntityProperties." ] ;
127127
sh:property [
128128
sh:path brick:hasLocation ;
@@ -137,31 +137,6 @@ brick:Point a sh:NodeShape;
137137
] ;
138138
.
139139

140-
brick:Collection a sh:NodeShape;
141-
sh:node [sh:not [ sh:class brick:Equipment ] ; sh:message "Collection is an exclusive top class." ],
142-
[sh:not [ sh:class brick:Location ] ; sh:message "Collection is an exclusive top class." ],
143-
[sh:not [ sh:class rec:Space ] ; sh:message "Collection is an exclusive top class." ],
144-
[sh:not [ sh:class brick:Substance ] ; sh:message "Collection is an exclusive top class." ],
145-
[sh:not [ sh:class brick:Quantity ] ; sh:message "Collection is an exclusive top class." ],
146-
[sh:not [ sh:class brick:Point ] ; sh:message "Collection is an exclusive top class." ] ;
147-
sh:property [
148-
sh:path brick:hasPart;
149-
sh:maxCount 0 ;
150-
sh:message "Collections must use rec:includes instead of brick:hasPart."
151-
];
152-
sh:property [
153-
sh:path rec:includes;
154-
sh:or (
155-
[ sh:class brick:Equipment ]
156-
[ sh:class brick:Location ]
157-
[ sh:class rec:Space ]
158-
[ sh:class brick:Point ]
159-
[ sh:class brick:Collection ]
160-
);
161-
sh:message "A Collection can include Equipment, Locations/Spaces, Points, and other Collections."
162-
];
163-
.
164-
165140
bsh:hasHotColdDeck
166141
a sh:NodeShape ;
167142
sh:targetClass brick:DDAHU ;

bricksrc/rules.ttl

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -496,35 +496,6 @@ bsh:hasSubstance a sh:NodeShape ;
496496
sh:class brick:Substance ;
497497
.
498498

499-
500-
# rule to add rec:includes when a brick:Collection contains a brick:Equipment
501-
bsh:CollectionIncludesEquipment a sh:NodeShape ;
502-
sh:targetClass brick:Collection, brick:System, brick:Equipment ;
503-
sh:rule [
504-
a sh:SPARQLRule ;
505-
sh:construct """
506-
CONSTRUCT {
507-
$this rec:includes ?eq .
508-
}
509-
WHERE {
510-
$this brick:hasPart ?eq .
511-
{
512-
?eq rdf:type/rdfs:subClassOf* brick:Equipment .
513-
}
514-
UNION
515-
{
516-
?eq rdf:type/rdfs:subClassOf* brick:Collection .
517-
}
518-
UNION
519-
{
520-
?eq rdf:type/rdfs:subClassOf* brick:System .
521-
}
522-
}
523-
""" ;
524-
sh:prefixes <https://brickschema.org/schema/1.4/Brick> ;
525-
] ;
526-
.
527-
528499
bsh:SystemLoopLegacyHasPartIncludes a sh:NodeShape ;
529500
sh:targetClass brick:System, brick:Loop ;
530501
sh:rule [

examples/connections/duct.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@prefix : <http://example.com/duct_example/> .
66

77
<http://example.com/duct_example> a owl:Ontology ;
8-
owl:imports <https://brickschema.org/schema/1.4/Brick>,
8+
owl:imports <https://brickschema.org/schema/1.5/Brick>,
99
<https://brickschema.org/extension/s223extension> .
1010

1111
:saf1 a brick:Supply_Air_Flow_Sensor ;

examples/connections/rvav.ttl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
<http://example.com/rvav_example> a owl:Ontology ;
9-
owl:imports <https://brickschema.org/schema/1.4/Brick>,
9+
owl:imports <https://brickschema.org/schema/1.5/Brick>,
1010
<https://brickschema.org/extension/s223extension> .
1111

1212
# define the VAV with air and water connection points
@@ -75,4 +75,3 @@
7575
rdfs:label "Pipe 2" ;
7676
s223:hasMedium s223:Fluid-Water ;
7777
s223:cnx :vav_water_outlet, :boiler_water_return .
78-

extensions/brick_extension_interpret_223.shapes.ttl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# imports: http://data.ashrae.org/standard223/1.0/model/all
33
# imports: http://www.w3.org/ns/shacl#
44
# imports: https://brickschema.org/extension/mappings_223
5-
# imports: https://brickschema.org/schema/1.4/Brick
5+
# imports: https://brickschema.org/schema/1.5/Brick
66
# prefix: s223tobrick
77

88
@prefix brick: <https://brickschema.org/schema/Brick#> .
@@ -254,7 +254,7 @@ $this s223:hasMeasurementLocation/s223:isConnectionPointOf/rdf:type ?class .
254254
owl:imports <http://data.ashrae.org/standard223/1.0/model/all> ;
255255
owl:imports sh: ;
256256
owl:imports <https://brickschema.org/extension/mappings_223> ;
257-
owl:imports <https://brickschema.org/schema/1.4/Brick> ;
257+
owl:imports <https://brickschema.org/schema/1.5/Brick> ;
258258
owl:versionInfo "Created with TopBraid Composer" ;
259259
sh:declare [
260260
sh:namespace "http://data.ashrae.org/standard223#"^^xsd:anyURI ;

extensions/brick_extension_s223_extension.shapes.ttl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# imports: http://data.ashrae.org/standard223/1.0/model/all
33
# imports: http://www.w3.org/ns/shacl#
44
# imports: https://brickschema.org/extension/brick_extension_interpret_223
5-
# imports: https://brickschema.org/schema/1.4/Brick
5+
# imports: https://brickschema.org/schema/1.5/Brick
66
# prefix: s223ext
77

88
@prefix brick: <https://brickschema.org/schema/Brick#> .
@@ -25,7 +25,7 @@
2525
owl:imports <http://data.ashrae.org/standard223/1.0/model/all> ;
2626
owl:imports sh: ;
2727
owl:imports <https://brickschema.org/extension/brick_extension_interpret_223> ;
28-
owl:imports <https://brickschema.org/schema/1.4/Brick> ;
28+
owl:imports <https://brickschema.org/schema/1.5/Brick> ;
2929
owl:versionInfo "Created with TopBraid Composer" ;
3030
sh:declare [ sh:namespace "http://data.ashrae.org/standard223#"^^xsd:anyURI ;
3131
sh:prefix "s223" ],

generate_brick.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,6 @@ def add_definitions(graph=G):
710710
# add seeAlso only if provided
711711
graph.add((term, RDFS.seeAlso, URIRef(definition[2])))
712712

713-
714713
qstr = """
715714
select ?param where {
716715
?param rdfs:subClassOf* brick:Limit.
@@ -765,7 +764,7 @@ def add_definitions(graph=G):
765764
)
766765

767766

768-
def handle_deprecations(graph: Graph=G):
767+
def handle_deprecations(graph: Graph = G):
769768
for deprecated_term, md in deprecations.items():
770769
term_type = md.get(A)
771770
if term_type:
@@ -815,7 +814,9 @@ def handle_deprecations(graph: Graph=G):
815814
adds it to the graph. If available, adds the source information of
816815
through RDFS.seeAlso.
817816
"""
818-
with open(Path("./bricksrc/deprecated_definitions.csv"), encoding="utf-8") as dictionary_file:
817+
with open(
818+
Path("./bricksrc/deprecated_definitions.csv"), encoding="utf-8"
819+
) as dictionary_file:
819820
dictionary = csv.reader(dictionary_file)
820821

821822
header = next(dictionary)
@@ -832,10 +833,9 @@ def handle_deprecations(graph: Graph=G):
832833
if len(definition) > 2 and definition[2]:
833834
# add seeAlso only if provided
834835
graph.add((term, RDFS.seeAlso, URIRef(definition[2])))
835-
836836

837837

838-
def handle_concept_labels(graph: Graph=G):
838+
def handle_concept_labels(graph: Graph = G):
839839
"""
840840
Adds labels to all concepts in the Brick namespace, unless they already have one.
841841
Brick concepts are all subclasses of Brick.Entity and subproperties of Brick.Relationship.
@@ -896,7 +896,6 @@ def handle_concept_labels(graph: Graph=G):
896896
},
897897
"Point": {"tags": [TAG.Point]},
898898
"Measurable": {"tags": [TAG.Measurable]},
899-
"Collection": {"tags": [TAG.Collection]},
900899
}
901900
define_classes(roots, BRICK.Class) # <= Brick v1.3.0
902901
define_classes(roots, BRICK.Entity) # >= Brick v1.3.0
@@ -936,7 +935,7 @@ def handle_concept_labels(graph: Graph=G):
936935
# define other root class structures
937936
define_classes(location_subclasses, BRICK.Location)
938937
define_classes(equipment_subclasses, BRICK.Equipment)
939-
define_classes(collection_classes, BRICK.Collection)
938+
define_classes(collection_classes, REC.Collection)
940939
define_classes(hvac_subclasses, BRICK.HVAC_Equipment)
941940
define_classes(hvac_valve_subclasses, BRICK.HVAC_Equipment)
942941
define_classes(valve_subclasses, BRICK.Equipment)

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44
import pytest
55
from rdflib import Namespace
6-
import ontoenv
76
from ontoenv import OntoEnv
87
import brickschema
98
import glob
@@ -32,6 +31,7 @@ def pytest_configure(config):
3231
"markers", "slow: mark tests as slow (deselect w/ '-m \"not slow\"')"
3332
)
3433

34+
3535
@pytest.fixture()
3636
def brick():
3737
g = brickschema.Graph()
@@ -43,6 +43,7 @@ def brick():
4343
g.remove((None, OWL.imports, None))
4444
return g
4545

46+
4647
@pytest.fixture()
4748
def brick_with_imports():
4849
env = OntoEnv(read_only=True)

0 commit comments

Comments
 (0)