Skip to content

Commit

Permalink
swapping out brick quantitykinds for QUDT QKs when Brick adds nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
gtfierro committed Sep 27, 2023
1 parent c7c6a67 commit 628793e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 59 deletions.
6 changes: 3 additions & 3 deletions bricksrc/entity_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from collections import defaultdict
from rdflib import Literal
from .namespaces import BRICK, RDFS, SKOS, UNIT, XSD, SH, BSH, REF
from .namespaces import BRICK, RDFS, SKOS, UNIT, XSD, SH, BSH, REF, QUDTQK

# these are the "relationship"/predicates/OWL properties that
# relate a Brick entity to a structured value.
Expand Down Expand Up @@ -461,7 +461,7 @@
BRICK.longitude: {"datatype": BSH.NumericValue},
},
},
BSH.TiltShape: {"unitsFromQuantity": BRICK.Angle, "datatype": BSH.NumericValue},
BSH.TiltShape: {"unitsFromQuantity": QUDTQK.Angle, "datatype": BSH.NumericValue},
BSH.TemperatureShape: {
"unitsFromQuantity": BRICK.Temperature,
"datatype": BSH.NumericValue,
Expand All @@ -471,7 +471,7 @@
"datatype": BSH.NumericValue,
},
BSH.AzimuthShape: {
"unitsFromQuantity": BRICK.Angle,
"unitsFromQuantity": QUDTQK.Angle,
"datatype": BSH.NumericValue,
"rotationalDirection": {"values": ["clockwise", "counterclockwise"]},
"referenceDirection": {"values": ["North", "South", "East", "West"]},
Expand Down
45 changes: 7 additions & 38 deletions bricksrc/quantities.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,29 +174,15 @@ def all_units():
},
},
},
"Angle": {BRICK.hasQUDTReference: QUDTQK["Angle"]},
"Conductivity": {BRICK.hasQUDTReference: QUDTQK["Conductivity"]},
"Capacity": {BRICK.hasQUDTReference: QUDTQK["Capacity"]},
"Enthalpy": {
"GrainsOfMoisture": {
QUDT.applicableUnit: UNIT.GRAIN,
QUDT.hasDimensionVector: QUDTDV["A0E0L0I0M1H0T0D0"],
RDFS.isDefinedBy: URIRef(str(BRICK).strip("#")),
RDFS.label: Literal("GrainsOfMoisture"),
SKOS.definition: Literal(
"(also known as heat content), thermodynamic quantity equal to the sum of the internal energy of a system plus the product of the pressure volume work done on the system. H = E + pv, where H = enthalpy or total heat content, E = internal energy of the system, p = pressure, and v = volume. (Compare to [[specific enthalpy]].)"
"Mass of moisture per pround of air, measured in grains of water"
),
BRICK.hasQUDTReference: QUDTQK["Enthalpy"],
},
"Mass": {
BRICK.hasQUDTReference: QUDTQK["Mass"],
SKOS.narrower: {
"GrainsOfMoisture": {
QUDT.applicableUnit: UNIT.GRAIN,
QUDT.hasDimensionVector: QUDTDV["A0E0L0I0M1H0T0D0"],
RDFS.isDefinedBy: URIRef(str(BRICK).strip("#")),
RDFS.label: Literal("GrainsOfMoisture"),
SKOS.definition: Literal(
"Mass of moisture per pround of air, measured in grains of water"
),
SKOS.broader: QUDTQK.Mass,
}
},
SKOS.broader: QUDTQK.Mass,
},
"Phasor": {
SKOS.related: {
Expand Down Expand Up @@ -244,22 +230,6 @@ def all_units():
"Power": {
BRICK.hasQUDTReference: QUDTQK["Power"],
SKOS.narrower: {
"Electric_Power": {
BRICK.hasQUDTReference: QUDTQK["ElectricPower"],
SKOS.narrower: {
"Apparent_Power": {BRICK.hasQUDTReference: QUDTQK["ApparentPower"]},
"Active_Power": {
OWL.sameAs: BRICK["Real_Power"],
BRICK.hasQUDTReference: QUDTQK["ActivePower"],
},
"Real_Power": {
OWL.sameAs: BRICK["Active_Power"],
BRICK.hasQUDTReference: QUDTQK["ActivePower"],
},
"Reactive_Power": {BRICK.hasQUDTReference: QUDTQK["ReactivePower"]},
"Complex_Power": {BRICK.hasQUDTReference: QUDTQK["ComplexPower"]},
},
},
"Peak_Power": {
SKOS.broader: QUDTQK.Power,
QUDT.applicableUnit: [UNIT.KiloW, UNIT.MegaW, UNIT.MilliW, UNIT.W],
Expand Down Expand Up @@ -768,7 +738,6 @@ def all_units():
# TODO: what are these?
SKOS.narrower: {"Acceleration_Time": {}, "Deceleration_Time": {}},
},
"Torque": {BRICK.hasQUDTReference: QUDTQK["Torque"]},
# TODO: https://ci.mines-stetienne.fr/seas/WeatherOntology-0.9#AirTemperature ?
"Volume": {
BRICK.hasQUDTReference: QUDTQK["Volume"],
Expand Down
2 changes: 1 addition & 1 deletion bricksrc/relationships.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
A: [OWL.AsymmetricProperty, OWL.IrreflexiveProperty],
RDFS.label: Literal("Has Quantity"),
RDFS.subPropertyOf: QUDT.hasQuantityKind,
"range": BRICK.Quantity,
"range": [BRICK.Quantity, QUDT.QuantityKind],
"domain": BRICK.Point,
},
"value": {
Expand Down
30 changes: 15 additions & 15 deletions bricksrc/sensor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from rdflib import Literal
from .namespaces import BRICK, TAG, OWL, RDFS, QUDT
from .namespaces import BRICK, TAG, OWL, RDFS, QUDT, QUDTQK

sensor_definitions = {
"Sensor": {
Expand Down Expand Up @@ -300,7 +300,7 @@
},
},
"Angle_Sensor": {
BRICK.hasQuantity: BRICK.Angle,
BRICK.hasQuantity: QUDTQK.Angle,
"subclasses": {
"Solar_Azimuth_Angle_Sensor": {
"tags": [
Expand All @@ -325,15 +325,15 @@
},
"Capacity_Sensor": {
"tags": [TAG.Point, TAG.Sensor, TAG.Capacity],
BRICK.hasQuantity: BRICK.Capacity,
BRICK.hasQuantity: QUDTQK.Capacity,
},
"Contact_Sensor": {"tags": [TAG.Point, TAG.Sensor, TAG.Contact]},
"Conductivity_Sensor": {
# IFC ConductanceSensor
# TODO: pull from
# https://technical.buildingsmart.org/standards/ifc/ifc-schema-specifications/
"tags": [TAG.Point, TAG.Sensor, TAG.Conductivity],
BRICK.hasQuantity: BRICK.Conductivity,
BRICK.hasQuantity: QUDTQK.Conductivity,
"subclasses": {
"Deionised_Water_Conductivity_Sensor": {
"tags": [
Expand All @@ -343,14 +343,14 @@
TAG.Water,
TAG.Deionised,
],
BRICK.hasQuantity: BRICK.Conductivity,
BRICK.hasQuantity: QUDTQK.Conductivity,
BRICK.hasSubstance: BRICK.Deionized_Water,
}
},
},
"Current_Sensor": {
"tags": [TAG.Point, TAG.Sensor, TAG.Current],
BRICK.hasQuantity: BRICK.Electric_Current,
BRICK.hasQuantity: QUDTQK.ElectricCurrent,
"subclasses": {
"Load_Current_Sensor": {
"tags": [TAG.Point, TAG.Load, TAG.Current, TAG.Sensor],
Expand Down Expand Up @@ -539,10 +539,10 @@
},
"Enthalpy_Sensor": {
"tags": [TAG.Point, TAG.Sensor, TAG.Enthalpy],
BRICK.hasQuantity: BRICK.Enthalpy,
BRICK.hasQuantity: QUDTQK.Enthalpy,
"subclasses": {
"Air_Enthalpy_Sensor": {
BRICK.hasQuantity: BRICK.Enthalpy,
BRICK.hasQuantity: QUDTQK.Enthalpy,
BRICK.hasSubstance: BRICK.Air,
"subclasses": {
"Outside_Air_Enthalpy_Sensor": {
Expand All @@ -553,7 +553,7 @@
TAG.Enthalpy,
TAG.Sensor,
],
BRICK.hasQuantity: BRICK.Enthalpy,
BRICK.hasQuantity: QUDTQK.Enthalpy,
BRICK.hasSubstance: BRICK.Outside_Air,
},
"Return_Air_Enthalpy_Sensor": {
Expand All @@ -564,7 +564,7 @@
TAG.Enthalpy,
TAG.Sensor,
],
BRICK.hasQuantity: BRICK.Enthalpy,
BRICK.hasQuantity: QUDTQK.Enthalpy,
BRICK.hasSubstance: BRICK.Return_Air,
},
},
Expand Down Expand Up @@ -1273,7 +1273,7 @@
},
"Electric_Power_Sensor": {
"tags": [TAG.Point, TAG.Sensor, TAG.Power, TAG.Electric],
BRICK.hasQuantity: BRICK.Electric_Power,
BRICK.hasQuantity: QUDTQK.ElectricPower,
"subclasses": {
"Reactive_Power_Sensor": {
"tags": [
Expand All @@ -1283,7 +1283,7 @@
TAG.Reactive,
TAG.Electric,
],
BRICK.hasQuantity: BRICK.Reactive_Power,
BRICK.hasQuantity: QUDTQK.ReactivePower,
},
"Active_Power_Sensor": {
"tags": [
Expand All @@ -1293,7 +1293,7 @@
TAG.Real,
TAG.Electric,
],
BRICK.hasQuantity: BRICK.Active_Power,
BRICK.hasQuantity: QUDTQK.ActivePower,
},
},
},
Expand Down Expand Up @@ -1344,7 +1344,7 @@
},
"Torque_Sensor": {
"tags": [TAG.Point, TAG.Sensor, TAG.Torque],
BRICK.hasQuantity: BRICK.Torque,
BRICK.hasQuantity: QUDTQK.Torque,
"subclasses": {
"Motor_Torque_Sensor": {
"tags": [TAG.Point, TAG.Motor, TAG.Torque, TAG.Sensor],
Expand All @@ -1353,7 +1353,7 @@
},
"Voltage_Sensor": {
"tags": [TAG.Point, TAG.Sensor, TAG.Voltage],
BRICK.hasQuantity: BRICK.Voltage,
BRICK.hasQuantity: QUDTQK.Voltage,
"subclasses": {
"Battery_Voltage_Sensor": {
"tags": [TAG.Point, TAG.Sensor, TAG.Voltage, TAG.Battery],
Expand Down
4 changes: 2 additions & 2 deletions bricksrc/setpoint.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .namespaces import TAG, BRICK, RDFS, OWL, QUDT
from .namespaces import TAG, BRICK, RDFS, OWL, QUDT, QUDTQK
from rdflib import Literal

setpoint_definitions = {
Expand All @@ -22,7 +22,7 @@
"tags": [TAG.Point, TAG.Setpoint, TAG.Illuminance]
},
"Enthalpy_Setpoint": {
BRICK.hasQuantity: BRICK.Enthalpy,
BRICK.hasQuantity: QUDTQK.Enthalpy,
"tags": [TAG.Point, TAG.Setpoint, TAG.Enthalpy],
},
"Dewpoint_Setpoint": {
Expand Down

0 comments on commit 628793e

Please sign in to comment.