diff --git a/bricksrc/definitions.csv b/bricksrc/definitions.csv index 9d3c0918..5a112392 100644 --- a/bricksrc/definitions.csv +++ b/bricksrc/definitions.csv @@ -796,8 +796,8 @@ https://brickschema.org/schema/Brick#Parking_Space,An area large enough to park https://brickschema.org/schema/Brick#Parking_Structure,A building or part of a building devoted to vehicle parking, https://brickschema.org/schema/Brick#Particulate_Matter_Sensor,Detects pollutants in the ambient air, https://brickschema.org/schema/Brick#Passive_Chilled_Beam,A chilled beam that does not have an integral air supply and instead relies on natural convection to draw air through the device., +https://brickschema.org/schema/Brick#Peak_Demand_Sensor,The peak power consumed by a process over some period of time, https://brickschema.org/schema/Brick#Peak_Power,Tracks the highest (peak) observed power in some interval, -https://brickschema.org/schema/Brick#Peak_Power_Demand_Sensor,The peak power consumed by a process over some period of time, https://brickschema.org/schema/Brick#Photovoltaic_Array,A collection of photovoltaic panels, https://brickschema.org/schema/Brick#Photovoltaic_Current_Output_Sensor,Senses the amperes of electrical current produced as output by a photovoltaic device, https://brickschema.org/schema/Brick#Piezoelectric_Sensor,"Senses changes pressure, acceleration, temperature, force or strain via the piezoelectric effect", @@ -852,7 +852,7 @@ https://brickschema.org/schema/Brick#Radiator,Heat exchangers designed to transf https://brickschema.org/schema/Brick#Radioactivity_Concentration_Sensor,Measures the concentration of radioactivity, https://brickschema.org/schema/Brick#Radon_Concentration_Sensor,Measures the concentration of radioactivity due to radon, https://brickschema.org/schema/Brick#Rain_Duration_Sensor,Measures the duration of precipitation within some time frame, -https://brickschema.org/schema/Brick#Rain_Sensor,Measures the amount of precipitation fallen, +https://brickschema.org/schema/Brick#Rain_Level_Sensor,Measures the amount of precipitation fallen, https://brickschema.org/schema/Brick#Rated_Speed_Setpoint,Sets rated speed, https://brickschema.org/schema/Brick#Reactive_Energy_Sensor,Measures the integral of reactive power, https://brickschema.org/schema/Brick#Reactive_Power,"Reactive Power}, for a linear two-terminal element or two-terminal circuit, under sinusoidal conditions, is the quantity equal to the product of the apparent power (S) and the sine of the displacement angle (\psi). The absolute value of the reactive power is equal to the non-active power. The ISO (and SI) unit for reactive power is the voltampere. The special name var and symbol \textit{var are given in IEC 60027 1.", diff --git a/bricksrc/deprecations.ttl b/bricksrc/deprecations.ttl index 5a0403e9..e05de528 100644 --- a/bricksrc/deprecations.ttl +++ b/bricksrc/deprecations.ttl @@ -74,3 +74,22 @@ brick:Exhaust_Fan_Enable_Command brick:deprecation [ sh:targetClass brick:Exhaust_Fan_Enable_Command ; ] ; ] . + +brick:Rain_Sensor brick:deprecation [ + brick:deprecatedInVersion "1.3.0" ; + brick:deprecationMitigationMessage "Rain_Sensor is deprecated in favor of Rain_Level_Sensor as the former term is ambiguous" ; + brick:deprecationMigitationRule [ + a sh:NodeShape ; + sh:rule [ + a sh:SPARQLRule ; + sh:construct """ + CONSTRUCT { + $this rdf:type brick:Rain_Level_Sensor . + } WHERE { + $this rdf:type brick:Rain_Sensor. + }""" ; + sh:prefixes rdf:, brick: ; + ] ; + sh:targetClass brick:Rain_Sensor ; + ] ; +] . diff --git a/bricksrc/sensor.py b/bricksrc/sensor.py index 16ac4633..4b298729 100644 --- a/bricksrc/sensor.py +++ b/bricksrc/sensor.py @@ -20,11 +20,6 @@ }, }, }, - "Natural_Gas_Flow_Sensor": { - BRICK.hasSubstance: BRICK.Natural_Gas, - BRICK.hasQuantity: BRICK.Flow, - "tags": [TAG.Point, TAG.Sensor, TAG.Natural, TAG.Gas, TAG.Flow], - }, "Air_Quality_Sensor": { "tags": [TAG.Point, TAG.Sensor, TAG.Air, TAG.Quality], "subclasses": { @@ -397,6 +392,17 @@ "Demand_Sensor": { "tags": [TAG.Point, TAG.Sensor, TAG.Demand], "subclasses": { + "Peak_Demand_Sensor": { + "tags": [ + TAG.Point, + TAG.Peak, + TAG.Power, + TAG.Demand, + TAG.Sensor, + TAG.Electric, + ], + BRICK.hasQuantity: BRICK.Peak_Power, + }, "Cooling_Demand_Sensor": { "tags": [TAG.Point, TAG.Sensor, TAG.Demand, TAG.Cool], "subclasses": { @@ -575,8 +581,9 @@ BRICK.hasQuantity: BRICK.Flow, "subclasses": { "Natural_Gas_Flow_Sensor": { - "tags": [TAG.Point, TAG.Sensor, TAG.Flow, TAG.Natural, TAG.Gas], BRICK.hasSubstance: BRICK.Natural_Gas, + BRICK.hasQuantity: BRICK.Flow, + "tags": [TAG.Point, TAG.Sensor, TAG.Natural, TAG.Gas, TAG.Flow], }, "Air_Flow_Sensor": { "tags": [TAG.Point, TAG.Sensor, TAG.Flow, TAG.Air], @@ -1038,9 +1045,6 @@ "Occupancy_Sensor": { "tags": [TAG.Point, TAG.Sensor, TAG.Occupancy], BRICK.hasQuantity: BRICK.Occupancy, - "subclasses": { - "PIR_Sensor": {"tags": [TAG.Point, TAG.PIR, TAG.Sensor]} - }, }, "Occupancy_Count_Sensor": { "tags": [TAG.Point, TAG.Sensor, TAG.Occupancy, TAG.Count], @@ -1359,31 +1363,14 @@ ], BRICK.hasQuantity: BRICK.Active_Power, }, - "Peak_Power_Demand_Sensor": { - "tags": [ - TAG.Point, - TAG.Peak, - TAG.Power, - TAG.Demand, - TAG.Sensor, - TAG.Electric, - ], - BRICK.hasQuantity: BRICK.Peak_Power, - "parents": [BRICK.Demand_Sensor], - }, }, }, }, }, - "Rain_Sensor": { + "Rain_Level_Sensor": { "tags": [TAG.Point, TAG.Sensor, TAG.Rain], # TODO: substances BRICK.hasQuantity: BRICK.Precipitation, - "subclasses": { - "Rain_Duration_Sensor": { - "tags": [TAG.Point, TAG.Sensor, TAG.Rain, TAG.Duration], - } - }, }, "Duration_Sensor": { "tags": [TAG.Point, TAG.Sensor, TAG.Duration], diff --git a/shacl/BrickShape.ttl b/shacl/BrickShape.ttl index ec9ed68b..5a4569ea 100644 --- a/shacl/BrickShape.ttl +++ b/shacl/BrickShape.ttl @@ -1,9 +1,9 @@ @prefix brick: . @prefix bsh: . @prefix owl: . +@prefix qudt: . @prefix rdf: . @prefix sh: . -@prefix unit: . @prefix vcard: . @prefix xsd: . @@ -56,7 +56,7 @@ bsh:hasLocationRangeShape a sh:NodeShape ; sh:path brick:hasLocation ] ; sh:targetSubjectsOf brick:hasLocation . -bsh:hasLocationShape a sh:Nodeshape ; +bsh:hasLocationShape a sh:NodeShape ; sh:message "Points are a virtual concept and always belonging to a physical device, represented by Equipment. Thus, it cannot have a Location alone." ; sh:not [ sh:class brick:Point ] ; sh:targetSubjectsOf brick:hasLocation . @@ -91,7 +91,7 @@ bsh:hasTagRangeShape a sh:NodeShape ; sh:targetSubjectsOf brick:hasTag . bsh:hasUnitRangeShape a sh:NodeShape ; - sh:property [ sh:class unit:Unit ; + sh:property [ sh:class qudt:Unit ; sh:message "Property hasUnit has object with incorrect type" ; sh:path brick:hasUnit ] ; sh:targetSubjectsOf brick:hasUnit . @@ -152,15 +152,9 @@ brick:Collection a sh:NodeShape ; 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:or ( sh:property [ sh:class brick:Equipment ; - sh:message "A Collection can be associated with Equipments, Locations, Points, and other Collections." ; - sh:path brick:hasPart ] sh:property [ sh:class brick:Location ; - sh:message "A Collection can be associated with Equipments, Locations, Points, and other Collections." ; - sh:path brick:hasPart ] sh:property [ sh:class brick:Point ; - sh:message "A Collection can be associated with Equipments, Locations, Points, and other Collections." ; - sh:path brick:hasPart ] sh:property [ sh:class brick:Collection ; - sh:message "A Collection can be associated with Equipments, Locations, Points, and other Collections." ; - sh:path brick:hasPart ] ) . + sh:property [ sh:message "A Collection can be associated with Equipments, Locations, Points, and other Collections." ; + sh:or ( [ sh:class brick:Equipment ] [ sh:class brick:Location ] [ sh:class brick:Point ] [ sh:class brick:Collection ] ) ; + sh:path brick:hasPart ] . brick:Equipment a sh:NodeShape ; sh:and ( [ sh:message "Equipment is an exclusive top class." ; @@ -170,24 +164,18 @@ brick:Equipment a sh:NodeShape ; 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:or ( sh:property [ sh:class brick:System ; - sh:message "Equipment can be part of a Collection, System or other Equipment" ; - sh:path brick:isPartOf ] sh:property [ sh:class brick:Equipment ; - sh:message "Equipment can be part of a Collection, System or other Equipment" ; - sh:path brick:isPartOf ] sh:property [ sh:class brick:Collection ; - sh:message "Equipment can be part of a Collection, System or other Equipment" ; - sh:path brick:isPartOf ] ), - ( sh:property [ sh:class brick:Equipment ; - sh:message "A piece of Equipment can feed a Equipment" ; - sh:path brick:feeds ] sh:property [ sh:class brick:Location ; - sh:message "A piece of Equipment can feed a Location" ; - sh:path brick:feeds ] ) ; sh:property [ sh:class brick:Equipment ; sh:message "A piece of Equipment's parts should be always other Equipment." ; sh:path brick:hasPart ], + [ sh:message "Equipment can be part of a Collection, System or other Equipment." ; + sh:or ( [ sh:class brick:System ] [ sh:class brick:Equipment ] [ sh:class brick:Collection ] ) ; + sh:path brick:isPartOf ], [ sh:class brick:Location ; sh:message "A piece of Equipment can be located only at a Location" ; sh:path brick:hasLocation ], + [ sh:message "A piece of Equipment can feed a Equipment or Location." ; + sh:or ( [ sh:class brick:Equipment ] [ sh:class brick:Location ] ) ; + sh:path brick:feeds ], [ sh:class brick:Point ; sh:message "A piece of Equipment may have associated Points" ; sh:path brick:hasPoint ] . @@ -200,25 +188,18 @@ brick:Point a sh:NodeShape ; 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:or ( sh:property [ sh:class brick:Location ; - sh:message "A point can be associated with Locations or Equipment" ; - sh:path brick:isPointOf ] sh:property [ sh:class brick:Equipment ; - sh:message "A point can be associated with Locations or Equipment" ; - sh:path brick:isPointOf ] ) . + sh:property [ sh:message "A point can be associated with Locations or Equipment." ; + sh:or ( [ sh:class brick:Location ] [ sh:class brick:Equipment ] ) ; + sh:path brick:isPointOf ] . brick:Location a sh:NodeShape ; sh:and ( [ sh:message "Location is an exclusive top class." ; - sh:not [ sh:class brick:Point ] ] [ sh:message "Location is an exclusive top class." ; - 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 brick:Point ] ] [ sh:message "Location is an exclusive top class." ; 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:property [ sh:class brick:Location ; sh:message "A Location's parts should be always Locations." ; sh:path brick:hasPart ], @@ -228,18 +209,6 @@ brick:Location a sh:NodeShape ; [ sh:class brick:Equipment ; sh:message "Locations can be fed only by other Equipment." ; sh:path brick:isFedBy ], - [ sh:class brick:Point ; - sh:message "A Location may have associated Points" ; - sh:path brick:hasPoint ], - [ sh:class brick:Location ; - sh:message "A Location's parts should be always Locations." ; - sh:path brick:hasPart ], - [ sh:class brick:Location ; - sh:message "A Location's parts should be always Locations." ; - sh:path brick:isPartOf ], - [ sh:class brick:Equipment ; - sh:message "Locations can be fed only by other Equipment." ; - sh:path brick:isFedBy ], [ sh:class brick:Point ; sh:message "A Location may have associated Points" ; sh:path brick:hasPoint ] . diff --git a/tools/sort_definitions.py b/tools/sort_definitions.py index 060d7f7b..b18d5707 100644 --- a/tools/sort_definitions.py +++ b/tools/sort_definitions.py @@ -5,7 +5,7 @@ print("Usage: python sort_definitions.py ") sys.exit(1) -with open(sys.argv[1], "r") as f: +with open(sys.argv[1], "r", encoding="utf-8") as f: reader = csv.reader(f) data = list(reader) # remove duplicates @@ -20,6 +20,6 @@ # sort by term terms = sorted(terms, key=lambda tup: tup[0]) -with open(sys.argv[1], "w") as f: +with open(sys.argv[1], "w", encoding="utf-8") as f: writer = csv.writer(f) writer.writerows(terms)