From 2957fdb43f0afd823e60bab4e1f3d45192af741c Mon Sep 17 00:00:00 2001 From: Gabe Fierro Date: Thu, 24 Oct 2024 15:22:01 -0600 Subject: [PATCH] removing Brick Collection -> REC Collection --- bricksrc/deprecations.py | 6 ++++ bricksrc/relationships.py | 4 +-- bricksrc/root_class_shapes.ttl | 28 +++--------------- bricksrc/rules.ttl | 53 +++++++++++++++++----------------- generate_brick.py | 3 +- 5 files changed, 40 insertions(+), 54 deletions(-) diff --git a/bricksrc/deprecations.py b/bricksrc/deprecations.py index 897041a9..5561effc 100644 --- a/bricksrc/deprecations.py +++ b/bricksrc/deprecations.py @@ -1,6 +1,12 @@ from .namespaces import BRICK, RDFS, SKOS, A, REC deprecations = { + BRICK.Collection: { + "version": "1.5.0", + "mitigation_message": "Brick Collection is deprecated in favor of REC Collection to remove redundancy between the two ontologies.", + "replace_with": REC.Collection, + RDFS.subClassOf: BRICK.Entity, + }, BRICK.Speed_Status: { "version": "1.4.0", "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.", diff --git a/bricksrc/relationships.py b/bricksrc/relationships.py index bc16bd05..425f9a73 100644 --- a/bricksrc/relationships.py +++ b/bricksrc/relationships.py @@ -169,14 +169,14 @@ OWL.inverseOf: BRICK.isMeteredBy, "domain": BRICK.Meter, # this is a special property that implements the 'range' as a SHACL shape - "range": [BRICK.Equipment, BRICK.Location, BRICK.Collection], + "range": [BRICK.Equipment, BRICK.Location, REC.Collection], RDFS.label: Literal("meters", lang="en"), }, "isMeteredBy": { A: [OWL.ObjectProperty, OWL.AsymmetricProperty, OWL.IrreflexiveProperty], OWL.inverseOf: BRICK.meters, # this is a special property that implements the 'domain' as a SHACL shape - "domain": [BRICK.Equipment, BRICK.Location, BRICK.Collection], + "domain": [BRICK.Equipment, BRICK.Location, REC.Collection], "range": BRICK.Meter, RDFS.label: Literal("is metered by", lang="en"), }, diff --git a/bricksrc/root_class_shapes.ttl b/bricksrc/root_class_shapes.ttl index 36c2f869..ec2217bc 100644 --- a/bricksrc/root_class_shapes.ttl +++ b/bricksrc/root_class_shapes.ttl @@ -16,7 +16,7 @@ brick:Location a sh:NodeShape ; [sh:not [ sh:class brick:Equipment ] ; sh:message "Location is an exclusive top class." ], [sh:not [ sh:class brick:Substance ] ; sh:message "Location is an exclusive top class." ], [sh:not [ sh:class brick:Quantity ] ; sh:message "Location is an exclusive top class." ], - [sh:not [ sh:class brick:Collection ] ; sh:message "Location is an exclusive top class." ] ; + [sh:not [ sh:class rec:Collection ] ; sh:message "Location is an exclusive top class." ] ; sh:property [ sh:path brick:hasPart; sh:or ( [ sh:class brick:Location] [ sh:class rec:Space ] ); @@ -44,7 +44,7 @@ brick:Equipment a sh:NodeShape ; [sh:not [ sh:class brick:Location ] ; sh:message "Equipment is an exclusive top class." ], [sh:not [ sh:class brick:Substance ] ; sh:message "Equipment is an exclusive top class." ], [sh:not [ sh:class brick:Quantity ] ; sh:message "Equipment is an exclusive top class." ], - [sh:not [ sh:class brick:Collection ] ; sh:message "Equipment is an exclusive top class." ] ; + [sh:not [ sh:class rec:Collection ] ; sh:message "Equipment is an exclusive top class." ] ; sh:property [ sh:path brick:hasPart; sh:class brick:Equipment; @@ -60,7 +60,7 @@ brick:Equipment a sh:NodeShape ; sh:or ( [ sh:class brick:System ] [ sh:class brick:Equipment ] - [ sh:class brick:Collection ] + [ sh:class rec:Collection ] ); sh:message "Equipment can be part of a Collection, System or other Equipment." ]; @@ -86,7 +86,7 @@ brick:Point a sh:NodeShape; [sh:not [ sh:class rec:Space ] ; sh:message "Point is an exclusive top class." ], [sh:not [ sh:class brick:Substance ] ; sh:message "Point is an exclusive top class." ], [sh:not [ sh:class brick:Quantity ] ; sh:message "Point is an exclusive top class." ], - [sh:not [ sh:class brick:Collection ] ; sh:message "Point is an exclusive top class." ] ; + [sh:not [ sh:class rec:Collection ] ; sh:message "Point is an exclusive top class." ] ; sh:property [ sh:path brick:hasLocation ; sh:maxCount 0 ; @@ -94,26 +94,6 @@ brick:Point a sh:NodeShape; ] ; . -brick:Collection a sh:NodeShape; - sh:node [sh:not [ sh:class brick:Equipment ] ; sh:message "Collection is an exclusive top class." ], - [sh:not [ sh:class brick:Location ] ; sh:message "Collection is an exclusive top class." ], - [sh:not [ sh:class rec:Space ] ; sh:message "Collection is an exclusive top class." ], - [sh:not [ sh:class brick:Substance ] ; sh:message "Collection is an exclusive top class." ], - [sh:not [ sh:class brick:Quantity ] ; sh:message "Collection is an exclusive top class." ], - [sh:not [ sh:class brick:Point ] ; sh:message "Collection is an exclusive top class." ] ; - sh:property [ - sh:path brick:hasPart; - sh:or ( - [ sh:class brick:Equipment ] - [ sh:class brick:Location ] - [ sh:class rec:Space ] - [ sh:class brick:Point ] - [ sh:class brick:Collection ] - ); - sh:message "A Collection can be associated with Equipments, Locations/Spaces, Points, and other Collections." - ]; - . - bsh:hasHotColdDeck a sh:NodeShape ; sh:targetClass brick:DDAHU ; diff --git a/bricksrc/rules.ttl b/bricksrc/rules.ttl index 24526442..20a481da 100644 --- a/bricksrc/rules.ttl +++ b/bricksrc/rules.ttl @@ -481,33 +481,34 @@ bsh:hasSubstance a sh:NodeShape ; . +# TODO: remove this? # rule to add rec:includes when a brick:Collection contains a brick:Equipment -bsh:CollectionIncludesEquipment a sh:NodeShape ; - sh:targetClass brick:Collection, brick:System, brick:Equipment ; - sh:rule [ - a sh:SPARQLRule ; - sh:construct """ - CONSTRUCT { - $this rec:includes ?eq . - } - WHERE { - $this brick:hasPart ?eq . - { - ?eq rdf:type/rdfs:subClassOf* brick:Equipment . - } - UNION - { - ?eq rdf:type/rdfs:subClassOf* brick:Collection . - } - UNION - { - ?eq rdf:type/rdfs:subClassOf* brick:System . - } - } - """ ; - sh:prefixes ; - ] ; -. +#bsh:CollectionIncludesEquipment a sh:NodeShape ; +# sh:targetClass brick:Collection, brick:System, brick:Equipment ; +# sh:rule [ +# a sh:SPARQLRule ; +# sh:construct """ +# CONSTRUCT { +# $this rec:includes ?eq . +# } +# WHERE { +# $this brick:hasPart ?eq . +# { +# ?eq rdf:type/rdfs:subClassOf* brick:Equipment . +# } +# UNION +# { +# ?eq rdf:type/rdfs:subClassOf* brick:Collection . +# } +# UNION +# { +# ?eq rdf:type/rdfs:subClassOf* brick:System . +# } +# } +# """ ; +# sh:prefixes ; +# ] ; +#. # add unidirectional charging to all EVsE chargers as a default value # UNLESS there is already a brick:electricVehicleChargerDirectionality attribute diff --git a/generate_brick.py b/generate_brick.py index d3fc8ac3..f39ead67 100755 --- a/generate_brick.py +++ b/generate_brick.py @@ -871,7 +871,6 @@ def handle_concept_labels(): }, "Point": {"tags": [TAG.Point]}, "Measurable": {"tags": [TAG.Measurable]}, - "Collection": {"tags": [TAG.Collection]}, } define_classes(roots, BRICK.Class) # <= Brick v1.3.0 define_classes(roots, BRICK.Entity) # >= Brick v1.3.0 @@ -914,7 +913,7 @@ def handle_concept_labels(): # define other root class structures define_classes(location_subclasses, BRICK.Location) define_classes(equipment_subclasses, BRICK.Equipment) -define_classes(collection_classes, BRICK.Collection) +define_classes(collection_classes, REC.Collection) define_classes(hvac_subclasses, BRICK.HVAC_Equipment) define_classes(hvac_valve_subclasses, BRICK.HVAC_Equipment) define_classes(valve_subclasses, BRICK.Equipment)