Commit 336a3be4 authored by Nicolas Seydoux's avatar Nicolas Seydoux
Browse files

Updated smart building use case rules

parent 83db3cd8
......@@ -128,10 +128,21 @@ ex:R1ApplicantRule
CONSTRUCT {
$this edr:isInterestedIn adr:Luminosity, adr:Temperature.
$this edr:producesDataOn ex:Symptom1.
?partialDataProvider edr:partialDataProvider ?partialProduction.
ex:R1 edr:isRuleActive "true"^^xsd:boolean.
ex:myAbstractApp edr:consumesResult ex:R1.
?originator edr:consumesResult ex:R1.
} WHERE {
$this a lmu:HostNode.
{
$this lmu:hasDownstreamNode ?partialDataProvider.
?partialDataProvider edr:producesDataOn ?partialProduction.
FILTER NOT EXISTS {
?partialDataProvider edr:producesDataOn adr:Luminosity, adr:Temperature.
}
} UNION {
ex:R1 edr:isRuleActivable "true"^^xsd:boolean.
}
ex:R1 edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:R1 edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -256,13 +267,22 @@ ex:R1 a sh:SPARQLRule ;
?l rdf:type/rdfs:subClassOf* adr:Luminosity;
ssn:isPropertyOf ?feature.
?luminosity_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?luminosityValue;
?l_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?luminosityValue;
ssn:observedProperty ?l;
ssn:observedBy ?luminosity_sensor.
FILTER(?luminosityValue < '800.0'^^xsd:float)
$this a lmu:HostNode.
FILTER NOT EXISTS {
?t_obs edr:usedForDeductionBy ex:R1.
?l_obs edr:usedForDeductionBy ex:R1.
}
FILTER NOT EXISTS {
?otherDeduction edr:deducedWith ex:R1;
edr:deducedFrom ?t_obs, ?l_obs.
}
BIND(URI(CONCAT('http://example.com/ns#R1_deduction', STRUUID())) AS ?deduction )
BIND(NOW() AS ?now)
}
......
......@@ -129,10 +129,21 @@ ex:R2ApplicantRule
CONSTRUCT {
$this edr:isInterestedIn adr:Luminosity, adr:Noise, adr:Temperature.
$this edr:producesDataOn ex:Symptom2.
?partialDataProvider edr:partialDataProvider ?partialProduction.
ex:R2 edr:isRuleActive "true"^^xsd:boolean.
ex:myAbstractApp edr:consumesResult ex:R2.
?originator edr:consumesResult ex:R2.
} WHERE {
$this a lmu:HostNode.
{
$this lmu:hasDownstreamNode ?partialDataProvider.
?partialDataProvider edr:producesDataOn ?partialProduction.
FILTER NOT EXISTS {
?partialDataProvider edr:producesDataOn adr:Luminosity, adr:Temperature, adr:Noise.
}
} UNION {
ex:R2 edr:isRuleActivable "true"^^xsd:boolean.
}
ex:R2 edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:R2 edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -261,6 +272,17 @@ ex:R2 a sh:SPARQLRule ;
ssn:observedBy ?noise_sensor.
FILTER(?noiseValue > '30.0'^^xsd:float)
FILTER NOT EXISTS {
?t_obs edr:usedForDeductionBy ex:R2.
?l_obs edr:usedForDeductionBy ex:R2.
?n_obs edr:usedForDeductionBy ex:R2.
}
FILTER NOT EXISTS {
?deduction edr:deducedWith ex:R2;
edr:deducedFrom ?t_obs, ?l_obs, ?n_obs.
}
?deducer a lmu:HostNode.
BIND(URI(CONCAT('http://example.com/ns#R2_deduction', STRUUID())) AS ?deduction )
BIND(NOW() AS ?now)
......
......@@ -129,10 +129,21 @@ ex:R3ApplicantRule
CONSTRUCT {
$this edr:isInterestedIn adr:Luminosity, adr:Humidity, adr:Temperature.
$this edr:producesDataOn ex:Symptom3.
?partialDataProvider edr:partialDataProvider ?partialProduction.
ex:R3 edr:isRuleActive "true"^^xsd:boolean.
ex:myAbstractApp edr:consumesResult ex:R3.
} WHERE {
$this a lmu:HostNode.
{
$this lmu:hasDownstreamNode ?partialDataProvider.
?partialDataProvider edr:producesDataOn ?partialProduction.
FILTER NOT EXISTS {
?partialDataProvider edr:producesDataOn adr:Luminosity, adr:Humidity, adr:Temperature.
}
} UNION {
ex:R3 edr:isRuleActivable "true"^^xsd:boolean.
}
ex:R3 edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:R3 edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -265,6 +276,17 @@ ex:R3 a sh:SPARQLRule ;
?deducer a lmu:HostNode.
FILTER NOT EXISTS {
?t_obs edr:usedForDeductionBy ex:R3.
?l_obs edr:usedForDeductionBy ex:R3.
?h_obs edr:usedForDeductionBy ex:R3.
}
FILTER NOT EXISTS {
?deduction edr:deducedWith ex:R3;
edr:deducedFrom ?t_obs, ?l_obs, ?h_obs.
}
BIND(URI(CONCAT('http://example.com/ns#R3_deduction', STRUUID())) AS ?deduction )
BIND(NOW() AS ?now)
}
......
......@@ -130,10 +130,21 @@ ex:R4ApplicantRule
CONSTRUCT {
$this edr:isInterestedIn adr:Luminosity, adr:Noise, adr:Temperature, adr:Presence.
$this edr:producesDataOn ex:Symptom4.
?partialDataProvider edr:partialDataProvider ?partialProduction.
ex:R4 edr:isRuleActive "true"^^xsd:boolean.
ex:myAbstractApp edr:consumesResult ex:R4.
?originator edr:consumesResult ex:R4.
} WHERE {
$this a lmu:HostNode.
{
$this lmu:hasDownstreamNode ?partialDataProvider.
?partialDataProvider edr:producesDataOn ?partialProduction.
FILTER NOT EXISTS {
?partialDataProvider edr:producesDataOn adr:Luminosity, adr:Noise, adr:Temperature, adr:Presence.
}
} UNION {
ex:R4 edr:isRuleActivable "true"^^xsd:boolean.
}
ex:R4 edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:R4 edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -274,6 +285,19 @@ ex:R4 a sh:SPARQLRule ;
FILTER(?pValue = 'true'^^xsd:boolean)
?deducer a lmu:HostNode.
FILTER NOT EXISTS {
?t_obs edr:usedForDeductionBy ex:R4.
?l_obs edr:usedForDeductionBy ex:R4.
?n_obs edr:usedForDeductionBy ex:R4.
?p_obs edr:usedForDeductionBy ex:R4.
}
FILTER NOT EXISTS {
?otherDeduction edr:deducedWith ex:R4;
edr:deducedFrom ?t_obs, ?l_obs, ?n_obs, ?p_obs.
}
BIND(URI(CONCAT('http://example.com/ns#R4_deduction', STRUUID())) AS ?deduction )
BIND(NOW() AS ?now)
}
......
......@@ -130,10 +130,21 @@ ex:R5ApplicantRule
CONSTRUCT {
$this edr:isInterestedIn adr:Temperature, adr:Luminosity, adr:PowerProduction, adr:Humidity.
$this edr:producesDataOn ex:Symptom5.
?partialDataProvider edr:partialDataProvider ?partialProduction.
ex:R5 edr:isRuleActive "true"^^xsd:boolean.
ex:myAbstractApp edr:consumesResult ex:R5.
?originator edr:consumesResult ex:R5.
} WHERE {
$this a lmu:HostNode.
{
$this lmu:hasDownstreamNode ?partialDataProvider.
?partialDataProvider edr:producesDataOn ?partialProduction.
FILTER NOT EXISTS {
?partialDataProvider edr:producesDataOn adr:Luminosity, adr:Temperature, adr:PowerProduction, adr:Humidity.
}
} UNION {
ex:R5 edr:isRuleActivable "true"^^xsd:boolean.
}
ex:R5 edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:R5 edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -274,6 +285,19 @@ ex:R5 a sh:SPARQLRule ;
FILTER(?ppValue > '200.0'^^xsd:float)
?deducer a lmu:HostNode.
FILTER NOT EXISTS {
?t_obs edr:usedForDeductionBy ex:R5.
?l_obs edr:usedForDeductionBy ex:R5.
?h_obs edr:usedForDeductionBy ex:R5.
?pp_obs edr:usedForDeductionBy ex:R5.
}
FILTER NOT EXISTS {
?deduction edr:deducedWith ex:R5;
edr:deducedFrom ?t_obs, ?l_obs, ?h_obs, ?pp_obs.
}
BIND(URI(CONCAT('http://example.com/ns#R5_deduction', STRUUID())) AS ?deduction )
BIND(NOW() AS ?now)
}
......
......@@ -128,10 +128,21 @@ ex:R6ApplicantRule
CONSTRUCT {
$this edr:isInterestedIn adr:Temperature, adr:TemperatureRequest.
$this edr:producesDataOn ex:Symptom6.
?partialDataProvider edr:partialDataProvider ?partialProduction.
ex:R6 edr:isRuleActive "true"^^xsd:boolean.
ex:myAbstractApp edr:consumesResult ex:R6.
?originator edr:consumesResult ex:R6.
} WHERE {
$this a lmu:HostNode.
{
$this lmu:hasDownstreamNode ?partialDataProvider.
?partialDataProvider edr:producesDataOn ?partialProduction.
FILTER NOT EXISTS {
?partialDataProvider edr:producesDataOn adr:Temperature, adr:TemperatureRequest.
}
} UNION {
ex:R6 edr:isRuleActivable "true"^^xsd:boolean.
}
ex:R6 edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:R6 edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -248,17 +259,24 @@ ex:R6 a sh:SPARQLRule ;
ssn:observedBy ?temperature_sensor.
?tr rdf:type/rdfs:subClassOf* adr:TemperatureRequest;
ssn:isPropertyOf ?requestFeature.
ssn:isPropertyOf ?feature.
?tr_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?trValue;
ssn:observedProperty ?tr;
ssn:observedBy ?tr_sensor.
FILTER(?trValue <= ?temperatureValue)
# The * allows to have ?feature and ?requestFeature bounded to the same variable
?feature adr:hasIndoorLocation* ?requestFeature
?deducer a lmu:HostNode.
FILTER NOT EXISTS {
?t_obs edr:usedForDeductionBy ex:R6.
?tr_obs edr:usedForDeductionBy ex:R6.
}
FILTER NOT EXISTS {
?deduction edr:deducedWith ex:R6;
edr:deducedFrom ?t_obs, ?tr_obs.
}
BIND(URI(CONCAT('http://example.com/ns#R6_deduction', STRUUID())) AS ?deduction )
BIND(NOW() AS ?now)
}
......
......@@ -129,10 +129,21 @@ ex:R7ApplicantRule
CONSTRUCT {
$this edr:isInterestedIn adr:Temperature, adr:TemperatureRequest, adr:Humidity.
$this edr:producesDataOn ex:Symptom7.
?partialDataProvider edr:partialDataProvider ?partialProduction.
ex:R7 edr:isRuleActive "true"^^xsd:boolean.
ex:myAbstractApp edr:consumesResult ex:R7.
?originator edr:consumesResult ex:R7.
} WHERE {
$this a lmu:HostNode.
{
$this lmu:hasDownstreamNode ?partialDataProvider.
?partialDataProvider edr:producesDataOn ?partialProduction.
FILTER NOT EXISTS {
?partialDataProvider edr:producesDataOn adr:Temperature, adr:TemperatureRequest, adr:Humidity.
}
} UNION {
ex:R7 edr:isRuleActivable "true"^^xsd:boolean.
}
ex:R7 edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:R7 edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -249,15 +260,12 @@ rdfs:comment "T, TR, H -> S7";
ssn:observedBy ?temperature_sensor.
?tr rdf:type/rdfs:subClassOf* adr:TemperatureRequest;
ssn:isPropertyOf ?requestFeature.
ssn:isPropertyOf ?feature.
?tr_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?trValue;
ssn:observedProperty ?tr;
ssn:observedBy ?tr_sensor.
FILTER(?trValue > ?temperatureValue)
# The * allows to have ?feature and ?requestFeature bounded to the same variable
?feature adr:hasIndoorLocation* ?requestFeature
?h rdf:type/rdfs:subClassOf* adr:Humidity;
ssn:isPropertyOf ?feature.
?h_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?humidityValue;
......@@ -267,6 +275,17 @@ rdfs:comment "T, TR, H -> S7";
?deducer a lmu:HostNode.
FILTER NOT EXISTS {
?t_obs edr:usedForDeductionBy ex:R7.
?tr_obs edr:usedForDeductionBy ex:R7.
?h_obs edr:usedForDeductionBy ex:R7.
}
FILTER NOT EXISTS {
?deduction edr:deducedWith ex:R7;
edr:deducedFrom ?t_obs, ?tr_obs, ?h_obs.
}
BIND(URI(CONCAT('http://example.com/ns#R7_deduction', STRUUID())) AS ?deduction )
BIND(NOW() AS ?now)
}
......
......@@ -130,10 +130,21 @@ ex:R8ApplicantRule
CONSTRUCT {
$this edr:isInterestedIn adr:Temperature, adr:TemperatureRequest, adr:PowerProduction, adr:PowerRedistribution.
$this edr:producesDataOn ex:Symptom8.
?partialDataProvider edr:partialDataProvider ?partialProduction.
ex:R8 edr:isRuleActive "true"^^xsd:boolean.
ex:myAbstractApp edr:consumesResult ex:R8.
?originator edr:consumesResult ex:R8.
} WHERE {
$this a lmu:HostNode.
{
$this lmu:hasDownstreamNode ?partialDataProvider.
?partialDataProvider edr:producesDataOn ?partialProduction.
FILTER NOT EXISTS {
?partialDataProvider edr:producesDataOn adr:Temperature, adr:TemperatureRequest, adr:PowerProduction, adr:PowerRedistribution.
}
} UNION {
ex:R8 edr:isRuleActivable "true"^^xsd:boolean.
}
ex:R8 edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:R8 edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -250,15 +261,12 @@ ex:R8 a sh:SPARQLRule ;
ssn:observedBy ?temperature_sensor.
?tr rdf:type/rdfs:subClassOf* adr:TemperatureRequest;
ssn:isPropertyOf ?requestFeature.
ssn:isPropertyOf ?feature.
?tr_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?trValue;
ssn:observedProperty ?tr;
ssn:observedBy ?tr_sensor.
FILTER(?trValue <= ?temperatureValue)
# The * allows to have ?feature and ?requestFeature bounded to the same variable
?feature adr:hasIndoorLocation* ?requestFeature
?pp rdf:type/rdfs:subClassOf* adr:PowerProduction;
ssn:isPropertyOf ?feature.
?pp_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?ppValue;
......@@ -274,6 +282,18 @@ ex:R8 a sh:SPARQLRule ;
?deducer a lmu:HostNode.
FILTER NOT EXISTS {
?t_obs edr:usedForDeductionBy ex:R8.
?tr_obs edr:usedForDeductionBy ex:R8.
?pp_obs edr:usedForDeductionBy ex:R8.
?pr_obs edr:usedForDeductionBy ex:R8.
}
FILTER NOT EXISTS {
?deduction edr:deducedWith ex:R8;
edr:deducedFrom ?t_obs, ?tr_obs, ?pp_obs, ?pr_obs.
}
BIND(URI(CONCAT('http://example.com/ns#R8_deduction', STRUUID())) AS ?deduction )
BIND(NOW() AS ?now)
}
......
......@@ -96,6 +96,7 @@ ex:R9ApplicableShape
FILTER NOT EXISTS {
$this a lmu:HostNode.
$this lmu:hasDownstreamNode ?powerProductionProvider, ?presenceProvider.
?partialDataProvider edr:partialDataProvider ?partialProduction.
?powerProductionProvider edr:producesDataOn adr:PowerProduction.
?presenceProvider edr:producesDataOn adr:Presence.
FILTER NOT EXISTS {
......@@ -129,9 +130,19 @@ ex:R9ApplicantRule
$this edr:isInterestedIn adr:PowerProduction, adr:Presence.
$this edr:producesDataOn ex:Symptom9.
ex:R9 edr:isRuleActive "true"^^xsd:boolean.
ex:myAbstractApp edr:consumesResult ex:R9.
?originator edr:consumesResult ex:R9.
} WHERE {
$this a lmu:HostNode.
{
$this lmu:hasDownstreamNode ?partialDataProvider.
?partialDataProvider edr:producesDataOn ?partialProduction.
FILTER NOT EXISTS {
?partialDataProvider edr:producesDataOn adr:PowerProduction, adr:Presence.
}
} UNION {
ex:R1 edr:isRuleActivable "true"^^xsd:boolean.
}
ex:R9 edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:R9 edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -252,6 +263,16 @@ ex:R9 a sh:SPARQLRule ;
ssn:observedBy ?pp_sensor.
FILTER(?ppValue > '300.0'^^xsd:float)
FILTER NOT EXISTS {
?p_obs edr:usedForDeductionBy ex:R9.
?pp_obs edr:usedForDeductionBy ex:R9.
}
FILTER NOT EXISTS {
?deduction edr:deducedWith ex:R9;
edr:deducedFrom ?p_obs, ?pp_obs.
}
?deducer a lmu:HostNode.
BIND(URI(CONCAT('http://example.com/ns#R9_deduction', STRUUID())) AS ?deduction )
......
......@@ -34,7 +34,8 @@ ex:SuitableComfortableTransferShape
prefix adr: <https://w3id.org/laas-iot/adream#>
prefix ex: <http://example.com/ns#>
SELECT $this {
SELECT $this
WHERE {
FILTER NOT EXISTS {
$this a lmu:Node ;
edr:producesDataOn adr:Temperature, adr:Luminosity ;
......@@ -56,7 +57,6 @@ ex:officeLightComfortRuleTransfer
sh:targetClass lmu:Node ;
sh:rule [
a sh:SPARQLRule ;
sh:prefixes ex:, ssn:, rdf:, rdfs:, xsd:, dul:, edr:, lmu: ;
sh:condition ex:SuitableComfortableTransferShape ;
sh:construct """
PREFIX ssn:<http://purl.oclc.org/NET/ssnx/ssn#>
......@@ -90,7 +90,8 @@ ex:officeLightComfortRuleTransfer
prefix adr: <https://w3id.org/laas-iot/adream#>
prefix ex: <http://example.com/ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT $this {
SELECT $this
WHERE {
FILTER NOT EXISTS {
ex:officeLightComfortRule edr:isRuleActivable "true"^^xsd:boolean.
}
......@@ -119,7 +120,6 @@ ex:officeLightComfortApplicantRule
sh:targetClass lmu:HostNode ;
sh:rule [
a sh:SPARQLRule ;
sh:prefixes adr: ;
sh:condition ex:ComfortableApplicableShape ;
sh:construct """
prefix adr: <https://w3id.org/laas-iot/adream#>
......@@ -130,10 +130,21 @@ ex:officeLightComfortApplicantRule
CONSTRUCT {
$this edr:isInterestedIn adr:Luminosity, adr:Temperature.
$this edr:producesDataOn ex:ComfortableSpot.
?partialDataProvider edr:partialDataProvider ?partialProduction.
ex:officeLightComfortRule edr:isRuleActive "true"^^xsd:boolean.
ex:myComfortApp edr:consumesResult ex:officeLightComfortRule.
?originator edr:consumesResult ex:officeLightComfortRule.
} WHERE {
$this a lmu:HostNode.
{
$this lmu:hasDownstreamNode ?partialDataProvider.
?partialDataProvider edr:producesDataOn ?partialProduction.
FILTER NOT EXISTS {
?partialDataProvider edr:producesDataOn adr:Temperature, adr:Luminosity.
}
} UNION {
ex:officeLightComfortRule edr:isRuleActivable "true"^^xsd:boolean.
}
ex:officeLightComfortRule edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:officeLightComfortRule edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -171,7 +182,8 @@ ex:officeLightComfortResultTransferShape
PREFIX lmu: <http://w3id.org/laas-iot/lmu#>
prefix ex: <http://example.com/ns#>
SELECT $this {
SELECT $this
WHERE {
FILTER NOT EXISTS {
$this a lmu:Node ;
edr:isInterestedIn ex:ComfortableSpot ;
......@@ -191,7 +203,6 @@ ex:officeLightComfortResultTransfer
sh:targetClass lmu:Node ;
sh:rule [
a sh:SPARQLRule ;
sh:prefixes ex:, ssn:, rdf:, rdfs:, xsd:, dul:, edr:, lmu: ;
sh:condition ex:officeLightComfortResultTransferShape ;
sh:construct """
PREFIX ex:<http://example.com/ns#>
......@@ -205,9 +216,10 @@ ex:officeLightComfortResultTransfer
""";
].
ex:myComfortApp iotl:exposes [
iotl:endpoint "http://syndream.laas.fr:8002";
].
ex:myComfortApp a lmu:Application ;
iotl:exposes [
iotl:endpoint "http://syndream.laas.fr:8002";
].
ex:officeLightComfortRuleShape
a sh:NodeShape ;
......@@ -215,7 +227,6 @@ ex:officeLightComfortRuleShape
sh:rule ex:officeLightComfortRule .
ex:officeLightComfortRule a sh:SPARQLRule ;
sh:prefixes ex:, ssn:, rdf:, rdfs:, xsd:, dul:, edr:, lmu: ;
sh:condition ex:ComfortableActiveShape ;
edr:ruleOriginatedFrom ex:myComfortApp ;
edr:originatingEndpoint "http://syndream.laas.fr:8002" ;
......@@ -252,6 +263,14 @@ ex:officeLightComfortRule a sh:SPARQLRule ;
ssn:observedBy ?luminosity_sensor.
$this a lmu:HostNode.
FILTER(?luminosityValue > '150.0'^^xsd:float)
FILTER NOT EXISTS {
?otherDeduction edr:deducedFrom ?temperature_obs, ?luminosity_obs;
edr:deducedWith ex:officeLightComfortRule.
}
FILTER NOT EXISTS {
?temperature_obs edr:usedForDeductionBy ex:officeLightComfortRule.
?luminosity_obs edr:usedForDeductionBy ex:officeLightComfortRule.
}
BIND(URI(CONCAT('http://example.com/ns#comfortableSpotdeduction', STRUUID())) AS ?deduction )
BIND(NOW() AS ?now)
}
......
......@@ -56,7 +56,6 @@ ex:ThresholdTransferRule
sh:targetClass lmu:Node ;
sh:rule [
a sh:SPARQLRule ;
sh:prefixes ex:, ssn:, rdf:, rdfs:, xsd:, dul:, edr:, lmu: ;
sh:condition ex:ThresholdTransferShape ;
sh:construct """
PREFIX ssn:<http://purl.oclc.org/NET/ssnx/ssn#>
......@@ -113,7 +112,6 @@ ex:ThresholdApplicantRule
sh:targetClass lmu:HostNode ;
sh:rule [
a sh:SPARQLRule ;
sh:prefixes adr: ;
sh:condition ex:ThresholdApplicableShape ;
sh:construct """
prefix adr: <https://w3id.org/laas-iot/adream#>
......@@ -125,9 +123,10 @@ ex:ThresholdApplicantRule
$this edr:isInterestedIn adr:Temperature.
$this edr:producesDataOn ex:AboveThresholdTemperature.
ex:ThresholdRule edr:isRuleActive "true"^^xsd:boolean.
ex:myComfortApp edr:consumesResult ex:ThresholdRule.
?originator edr:consumesResult ex:ThresholdRule.
} WHERE {
$this a lmu:HostNode.
ex:ThresholdRule edr:ruleOriginatedFrom ?originator.
OPTIONAL{ex:ThresholdRule edr:isRuleActive "false"^^xsd:boolean.}
}
""";
......@@ -185,7 +184,6 @@ ex:ThresholdRuleResultTransfer
sh:targetClass lmu:Node ;
sh:rule [
a sh:SPARQLRule ;
sh:prefixes ex:, ssn:, rdf:, rdfs:, xsd:, dul:, edr:, lmu: ;
sh:condition ex:ThresholdRuleResultTransferShape ;
sh:construct """
PREFIX ex:<http://example.com/ns#>
......@@ -199,9 +197,10 @@ ex:ThresholdRuleResultTransfer
""";
].
ex:myComfortApp iotl:exposes [
iotl:endpoint "http://syndream.laas.fr:8002";
].
ex:myComfortApp a lmu:Application ;
iotl:exposes [
iotl:endpoint "http://syndream.laas.fr:8002";
].
ex:ThresholdRuleShape
a sh:NodeShape ;
......@@ -242,6 +241,13 @@ ex:ThresholdRule rdf:type sh:SPARQLRule ;
?obsValURI dul:hasDataValue ?value.
$this a lmu:HostNode.
FILTER(?value > '25.0'^^xsd:float)
FILTER NOT EXISTS {
?otherDeduction edr:deducedFrom ?temperature_obs;
edr:deducedWith ex:ThresholdRule.
}
FILTER NOT EXISTS {
?obsURI edr:usedForDeductionBy ex:ThresholdRule.
}
BIND(URI(CONCAT('http://example.com/ns#abovethresholdTemperaturededuction', STRUUID())) AS ?deduction )
BIND(NOW() AS ?now)
}
......
......@@ -34,7 +34,8 @@ ex:UncomfortableTransferShape
prefix adr: <https://w3id.org/laas-iot/adream#>
prefix ex: <http://example.com/ns#>
SELECT $this {
SELECT $this
WHERE {
FILTER NOT EXISTS {
$this a lmu:Node ;
edr:producesDataOn adr:Temperature, adr:Humidity, adr:Luminosity ;
......@@ -89,7 +90,8 @@ ex:UncomfortableApplicableShape
prefix adr: <https://w3id.org/laas-iot/adream#>
prefix ex: <http://example.com/ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT $this {
SELECT $this
WHERE {
FILTER NOT EXISTS {