From c791cd0daefaf3805ad2a0dfb875aa64e07c179a Mon Sep 17 00:00:00 2001 From: Gabe Fierro Date: Wed, 27 Sep 2023 12:44:13 -0600 Subject: [PATCH] implement inference rules for charging directionality --- bricksrc/rules.ttl | 22 +++++++++++++++++++++- examples/evse/evse.ttl | 5 ++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/bricksrc/rules.ttl b/bricksrc/rules.ttl index 1e5f3b99..7f707053 100644 --- a/bricksrc/rules.ttl +++ b/bricksrc/rules.ttl @@ -414,4 +414,24 @@ bsh:AddDefaultEVSEChargerDirection a sh:NodeShape ; ] ; . -# inherit +# inherit the directionality of the EVSE charger to the ports +bsh:InheritEVSEChargerDirection a sh:NodeShape ; + sh:targetClass brick:Electric_Vehicle_Charging_Port ; + sh:rule [ + a sh:SPARQLRule ; + sh:prefixes ; + sh:construct """ + CONSTRUCT { + $this brick:electricVehicleChargerDirectionality ?direction + } WHERE { + $this rdf:type brick:Electric_Vehicle_Charging_Port . + $this brick:isPartOf ?charger . + ?charger a brick:Electric_Vehicle_Charging_Station . + ?charger brick:electricVehicleChargerDirectionality ?direction . + FILTER NOT EXISTS { + $this brick:electricVehicleChargerDirectionality ?other_direction . + } + } + """ ; + ] ; +. diff --git a/examples/evse/evse.ttl b/examples/evse/evse.ttl index d96b8287..331ee782 100644 --- a/examples/evse/evse.ttl +++ b/examples/evse/evse.ttl @@ -10,12 +10,12 @@ brick:hasPart :station1, :station2 . :station1 a brick:Electric_Vehicle_Charging_Station ; - brick:electricVehicleChargerDirectionality [ brick:value "bidirectional" ] ; brick:electricVehicleChargerType [ brick:value "Level 1" ] ; brick:hasPart :port1-1, :port1-2 ; . :port1-1 a brick:Electric_Vehicle_Charging_Port ; + brick:electricVehicleChargerDirectionality [ brick:value "bidirectional" ] ; brick:electricVehicleConnectorType [ brick:value "Level 1 (SAE J1772)" ] ; brick:currentFlowType [ brick:value "AC" ] ; brick:electricalPhaseCount [ brick:value "1" ] ; @@ -26,6 +26,7 @@ . :port1-2 a brick:Electric_Vehicle_Charging_Port ; + brick:electricVehicleChargerDirectionality [ brick:value "bidirectional" ] ; brick:electricVehicleConnectorType [ brick:value "Level 1 (SAE J1772)" ] ; brick:currentFlowType [ brick:value "AC" ] ; brick:electricalPhaseCount [ brick:value "1" ] ; @@ -36,11 +37,13 @@ . :station2 a brick:Electric_Vehicle_Charging_Station ; + brick:electricVehicleChargerDirectionality [ brick:value "unidirectional" ] ; brick:electricVehicleChargerType [ brick:value "Level 2" ] ; brick:hasPart :port2-1 ; . :port2-1 a brick:Electric_Vehicle_Charging_Port ; + # this should inherit 'unidirectional' from the station brick:electricVehicleConnectorType [ brick:value "Level 2 (IEC 62196)" ] ; brick:currentFlowType [ brick:value "AC" ] ; brick:electricalPhaseCount [ brick:value "3" ] ;