prefix san: prefix xsd: prefix fn: prefix iter: prefix rdfs: prefix adr: prefix iotl: prefix ssn: prefix ioto: prefix edr: prefix ex: prefix sh: prefix rdf: prefix lmu: prefix dul: prefix time: ex:IIoTR2Envelope edr:hasTransferShape ex:IIoTR2TransferShape ; edr:hasApplyShape ex:IIoTR2ApplicableShape ; edr:hasResultTransferShape ex:IIoTR2ResultTransferShape ; edr:hasDeductionShape ex:IIoTR2ActiveShape. ex:IIoTR2TransferShape a sh:NodeShape ; a edr:TransferShape ; a edr:NodeSensitiveComponent; sh:targetClass lmu:Node ; sh:sparql [ sh:select """ PREFIX edr: PREFIX lmu: PREFIX ssn: prefix adr: prefix ex: SELECT $this WHERE { FILTER NOT EXISTS { $this a lmu:Node ; edr:producesDataOn adr:Presence, adr:Luminosity, adr:ConveyorState ; lmu:hasUpstreamNode [ a lmu:HostNode; ]. FILTER NOT EXISTS { {ex:IIoTR2CoreRule edr:transferredTo $this.} UNION {ex:IIoTR2CoreRule edr:transferableTo $this.} } } } """ ; ]. ex:IIoTR2RuleTransfer a sh:NodeShape ; sh:targetClass lmu:Node ; sh:rule [ a sh:SPARQLRule ; sh:condition ex:IIoTR2TransferShape ; sh:construct """ PREFIX ssn: PREFIX ex: PREFIX rdf: PREFIX rdfs: PREFIX xsd: PREFIX dul: PREFIX edr: PREFIX lmu: CONSTRUCT { ex:IIoTR2CoreRule edr:transferableTo $this. ex:IIoTR2CoreRule edr:transferredFrom ?host. } WHERE { $this lmu:hasUpstreamNode ?host. ?host a lmu:HostNode. } """; ]. ex:IIoTR2ApplicableShape a sh:NodeShape ; a edr:ApplicableShape ; a edr:NodeSensitiveComponent; sh:targetClass lmu:HostNode ; sh:sparql [ sh:select """ PREFIX edr: PREFIX lmu: PREFIX ssn: prefix adr: prefix ex: PREFIX xsd: SELECT $this WHERE { FILTER NOT EXISTS { ex:IIoTR2CoreRule edr:isRuleActivable "true"^^xsd:boolean. } FILTER NOT EXISTS { $this a lmu:HostNode. $this lmu:hasDownstreamNode ?presenceProvider, ?luminosityProvider, ?stateProvider. ?presenceProvider edr:producesDataOn adr:Presence. ?luminosityProvider edr:producesDataOn adr:Luminosity. ?stateProvider edr:producesDataOn adr:ConveyorState. FILTER NOT EXISTS { ex:IIoTR2CoreRule edr:isRuleActive "true"^^xsd:boolean. } FILTER EXISTS { $this lmu:hasDownstreamNode ?lowerNode. FILTER(?lowerNode = ?luminosityProvider || ?lowerNode = ?presenceProvider || ?lowerNode = ?stateProvider) FILTER NOT EXISTS { ?lowerNode edr:producesDataOn adr:Presence, adr:Luminosity, adr:ConveyorState. } } } } """ ; ]. ex:IIoTR2ApplicantRule a sh:NodeShape ; sh:targetClass lmu:HostNode ; sh:rule [ a sh:SPARQLRule ; sh:condition ex:IIoTR2ApplicableShape ; sh:construct """ prefix adr: PREFIX xsd: PREFIX edr: prefix ex: prefix lmu: CONSTRUCT { $this edr:isInterestedIn adr:Luminosity, adr:Presence, adr:ConveyorState. $this edr:producesDataOn ex:LowMachineVisibility. ?partialDataProvider edr:partialDataProvider ?partialProduction. ex:IIoTR2CoreRule edr:isRuleActive "true"^^xsd:boolean. ?originator edr:consumesResult ex:IIoTR2CoreRule. } WHERE { $this a lmu:HostNode. { $this lmu:hasDownstreamNode ?partialDataProvider. ?partialDataProvider edr:producesDataOn ?partialProduction. FILTER NOT EXISTS { ?partialDataProvider edr:producesDataOn adr:Luminosity, adr:Presence, adr:ConveyorState. } } UNION { ex:IIoTR2CoreRule edr:isRuleActivable "true"^^xsd:boolean. } ex:IIoTR2CoreRule edr:ruleOriginatedFrom ?originator. OPTIONAL{ex:IIoTR2CoreRule edr:isRuleActive "false"^^xsd:boolean.} } """; ]. ex:IIoTR2ActiveShape a sh:NodeShape ; sh:targetClass lmu:HostNode ; a edr:ActiveShape ; sh:sparql [ sh:select """ PREFIX edr: PREFIX lmu: PREFIX ssn: prefix adr: prefix ex: PREFIX xsd: SELECT $this WHERE { FILTER NOT EXISTS { $this a lmu:HostNode. ex:IIoTR2CoreRule edr:isRuleActive "true"^^xsd:boolean. } } """ ; ]. ex:IIoTR2ResultTransferShape a sh:NodeShape ; a edr:ResultTransferShape ; a edr:NodeSensitiveComponent; sh:targetClass lmu:Node ; sh:sparql [ sh:select """ PREFIX edr: PREFIX lmu: prefix ex: SELECT $this WHERE { FILTER NOT EXISTS { $this a lmu:Node ; edr:isInterestedIn ex:LowConveyorVisibility ; lmu:hasDownstreamNode [ a lmu:HostNode; ]. FILTER NOT EXISTS { {$this edr:consumesResult ex:IIoTR2CoreRule.} } } } """ ; ]. ex:IIoTR2ResultTransfer a sh:NodeShape ; sh:targetClass lmu:Node ; sh:rule [ a sh:SPARQLRule ; sh:condition ex:IIoTR2ResultTransferShape ; sh:construct """ PREFIX ex: PREFIX edr: PREFIX lmu: CONSTRUCT { $this edr:consumesResult ex:IIoTR2CoreRule. } WHERE { $this a lmu:Node ; } """; ]. ex:myIIoTApp a lmu:Application ; iotl:exposes [ iotl:endpoint "http://140.93.48.11:8006"; ]. ex:IIoTR2RuleShape a sh:NodeShape ; sh:targetClass lmu:HostNode ; sh:rule ex:IIoTR2CoreRule . ex:IIoTR2CoreRule a sh:SPARQLRule ; sh:condition ex:IIoTR2ActiveShape ; edr:ruleOriginatedFrom ex:myIIoTApp ; edr:originatingEndpoint "http://140.93.48.11:8006" ; sh:construct """ PREFIX ssn: PREFIX ex: PREFIX rdf: PREFIX rdfs: PREFIX xsd: PREFIX dul: PREFIX edr: PREFIX lmu: PREFIX iiot: CONSTRUCT { ?deduction a rdf:Statement; rdf:subject ?feature; rdf:predicate rdf:type; rdf:object ex:LowConveyorVisibility; edr:deducedAt ?now; edr:deducedBy $this; edr:deducedWith ex:IIoTR2CoreRule; edr:deducedFrom ?presence_obs, ?luminosity_obs, ?state_obs. } WHERE { ?presence rdf:type/rdfs:subClassOf* ; ssn:isPropertyOf ?presenceFeature. ?presence_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?presenceValue; ssn:observedProperty ?presence; ssn:observedBy ?presence_sensor. FILTER(?presenceValue = '1.0'^^xsd:float) ?luminosity rdf:type/rdfs:subClassOf* ; ssn:isPropertyOf ?feature. ?luminosity_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?luminosityValue; ssn:observedProperty ?luminosity; ssn:observedBy ?luminosity_sensor. FILTER(?luminosityValue < '300.0'^^xsd:float) ?state rdf:type/rdfs:subClassOf* ; ssn:isPropertyOf ?machine. ?state_obs ssn:observationResult/ssn:hasValue/dul:hasDataValue ?stateValue; ssn:observedProperty ?state; ssn:observedBy ?state_sensor. FILTER(?stateValue = '1.0'^^xsd:float) ?machine a iiot:Conveyor; iiot:locatedIn? ?presenceFeature. ?presenceFeature iiot:locatedIn? ?feature. $this a lmu:HostNode. FILTER NOT EXISTS { ?presence_obs edr:usedForDeductionBy ex:IIoTR2CoreRule. ?luminosity_obs edr:usedForDeductionBy ex:IIoTR2CoreRule. ?state_obs edr:usedForDeductionBy ex:IIoTR2CoreRule. } FILTER NOT EXISTS { ?otherDeduction edr:deducedWith ex:IIoTR2CoreRule; edr:deducedFrom ?presence_obs, ?luminosity_obs, ?state_obs. } BIND(URI(CONCAT('http://example.com/ns#comfortableSpotdeduction', STRUUID())) AS ?deduction ) BIND(NOW() AS ?now) } """. ex:LowConveyorVisibility rdfs:subClassOf .