diff --git a/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.html b/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.html index 15cd1ab..683ea2f 100644 --- a/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.html +++ b/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.html @@ -10,7 +10,6 @@ unitCode: {value:""}, - observable: {value:""}, name: {value:""}, iptype: {value:"iot:CarbonDioxideConcentration"}, capability: {value:""}, @@ -58,18 +57,11 @@

- -

Optional
@@ -113,7 +105,7 @@

Configurations

UnitCode - +
diff --git a/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.js b/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.js index 06c76fd..210f059 100644 --- a/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.js +++ b/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.js @@ -25,9 +25,7 @@ module.exports = function(RED) { configJ["configParams"]["FeatureOfInterestType"] = config.foitype; configJ["configParams"]["FeatureOfInterest"] = config.foi; configJ["configParams"]["unitCode"] = config.unitCode - - configJ["configParams"]["observable"] = config.observable; - configJ["configParams"]["operation"] = config.operation; + configJ["configParams"]["operation"] = config.operation; output = configInt.addConfigAttributes(source, configJ); let graph = []; graph = configInt.removeDuplicates(output["@graph"]); diff --git a/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.jsonld b/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.jsonld index 5c43ad7..11c8262 100644 --- a/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.jsonld +++ b/nodes/iotschema/carbondioxideconcentration-package/carbondioxideconcentration.jsonld @@ -16,10 +16,10 @@ "sh:and": { "@list": [ { - "@id": "_:ub732bL5C1" + "@id": "_:ub69bL37C1" }, { - "@id": "_:ub732bL10C1" + "@id": "_:ub69bL42C1" } ] }, @@ -28,75 +28,82 @@ } }, { - "@id": "_:ub732bL24C1", + "@id": "_:ub69bL28C1", "sh:property": { - "@id": "_:ub732bL24C14" + "@id": "_:ub69bL28C14" } }, { - "@id": "_:ub732bL29C1", - "sh:not": { - "@id": "_:ub732bL29C10" + "@id": "_:ub69bL25C13", + "sh:minCount": 1, + "sh:path": { + "@id": "iot:acceptsInputData" } }, { - "@id": "_:ub732bL10C15", - "sh:in": { - "@list": [ - { - "@id": "iot:PartsPerMillion" - }, - { - "@id": "iot:PartsPerMillion" - }, - { - "@id": "iot:Percent" - } - ] + "@id": "_:ub69bL37C15", + "sh:datatype": { + "@id": "xsd:float" }, "sh:maxCount": 1, "sh:minCount": 1, "sh:path": { - "@id": "schema:unitCode" + "@id": "schema:propertyType" } }, { - "@id": "_:ub732bL5C15", - "sh:datatype": { - "@id": "xsd:float" - }, + "@id": "_:ub69bL14C15", "sh:maxCount": 1, "sh:minCount": 1, + "sh:node": { + "@id": "iot:CarbonDioxideConcentrationData" + }, "sh:path": { - "@id": "schema:propertyType" + "@id": "iot:providesOutputData" } }, { - "@id": "_:ub732bL33C1", + "@id": "_:ub69bL19C1", "sh:property": { - "@id": "_:ub732bL33C14" + "@id": "_:ub69bL19C14" } }, { - "@id": "_:ub732bL30C13", - "sh:minCount": 1, - "sh:path": { - "@id": "iot:acceptsInputData" + "@id": "_:ub69bL42C1", + "sh:property": { + "@id": "_:ub69bL42C15" } }, { - "@id": "_:ub732bL24C14", - "sh:hasValue": false, - "sh:maxCount": 1, + "@id": "_:ub69bL24C10", + "sh:property": { + "@id": "_:ub69bL25C13" + } + }, + { + "@id": "_:ub69bL9C1", + "sh:property": { + "@id": "_:ub69bL9C15" + } + }, + { + "@id": "_:ub69bL5C15", "sh:minCount": 1, + "sh:node": { + "@list": [ + { + "@id": "iot:AmbientAir" + } + ] + }, "sh:path": { - "@id": "iot:writable" + "@id": "iot:capability" } }, { - "@id": "_:ub732bL10C1", + "@id": "_:ub69bL5C1", "sh:property": { - "@id": "_:ub732bL10C15" + "@id": "_:ub69bL5C15" } }, { @@ -105,16 +112,22 @@ "sh:and": { "@list": [ { - "@id": "_:ub732bL19C1" + "@id": "_:ub69bL5C1" + }, + { + "@id": "_:ub69bL9C1" + }, + { + "@id": "_:ub69bL14C1" }, { - "@id": "_:ub732bL24C1" + "@id": "_:ub69bL19C1" }, { - "@id": "_:ub732bL29C1" + "@id": "_:ub69bL24C1" }, { - "@id": "_:ub732bL33C1" + "@id": "_:ub69bL28C1" } ] }, @@ -123,18 +136,16 @@ } }, { - "@id": "_:ub732bL19C15", + "@id": "_:ub69bL19C14", + "sh:hasValue": false, "sh:maxCount": 1, "sh:minCount": 1, - "sh:node": { - "@id": "iot:CarbonDioxideConcentrationData" - }, "sh:path": { - "@id": "iot:providesOutputData" + "@id": "iot:writable" } }, { - "@id": "_:ub732bL33C14", + "@id": "_:ub69bL28C14", "sh:datatype": { "@id": "xsd:boolean" }, @@ -145,21 +156,47 @@ } }, { - "@id": "_:ub732bL5C1", + "@id": "_:ub69bL37C1", "sh:property": { - "@id": "_:ub732bL5C15" + "@id": "_:ub69bL37C15" } }, { - "@id": "_:ub732bL19C1", - "sh:property": { - "@id": "_:ub732bL19C15" + "@id": "_:ub69bL42C15", + "sh:in": { + "@list": [ + { + "@id": "iot:GasInAirConcentrationUnit" + } + ] + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:unitCode" } }, { - "@id": "_:ub732bL29C10", + "@id": "_:ub69bL14C1", "sh:property": { - "@id": "_:ub732bL30C13" + "@id": "_:ub69bL14C15" + } + }, + { + "@id": "_:ub69bL24C1", + "sh:not": { + "@id": "_:ub69bL24C10" + } + }, + { + "@id": "_:ub69bL9C15", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:Property" + }, + "sh:path": { + "@id": "rdfs:subClassOf" } } ] diff --git a/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.html b/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.html index 1f4ac27..6f392e9 100644 --- a/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.html +++ b/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.html @@ -4,6 +4,12 @@ color: '#00A4B4', defaults: { + + propertyType: {value:""}, + + + unitCode: {value:""}, + name: {value:""}, iptype: {value:"iot:CarbonDioxideConcentrationLimit"}, capability: {value:""}, @@ -43,6 +49,19 @@ +
+ +
+
+ +
+ +
+
+

@@ -64,6 +83,32 @@ is a Property. + It provides output + which + is + CarbonDioxideConcentrationLimitData .


+ + CarbonDioxideConcentrationLimitData can be configured with + propertyType + unitCode +

+

Configurations

+
+
PropertyType + Integer + +
    +
    +
    +
    +
    UnitCode + + +
    • PartsPerMillion
    • Percent
    +
    +
    + + diff --git a/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.js b/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.js index ef4bd5a..c18f5d8 100644 --- a/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.js +++ b/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.js @@ -24,6 +24,7 @@ module.exports = function(RED) { configJ["configParams"]["capability"] = config.capability; configJ["configParams"]["FeatureOfInterestType"] = config.foitype; configJ["configParams"]["FeatureOfInterest"] = config.foi; + configJ["configParams"]["unitCode"] = config.unitCode configJ["configParams"]["operation"] = config.operation; output = configInt.addConfigAttributes(source, configJ); let graph = []; diff --git a/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.jsonld b/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.jsonld index 6b2c349..6923a87 100644 --- a/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.jsonld +++ b/nodes/iotschema/carbondioxideconcentrationlimit-package/carbondioxideconcentrationlimit.jsonld @@ -11,13 +11,124 @@ }, "@graph": [ { - "@id": "_:ub230bL5C1", + "@id": "_:ub67bL19C14", + "sh:hasValue": false, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "iot:writable" + } + }, + { + "@id": "_:ub67bL5C1", + "sh:property": { + "@id": "_:ub67bL5C15" + } + }, + { + "@id": "_:ub67bL24C1", + "sh:not": { + "@id": "_:ub67bL24C10" + } + }, + { + "@id": "_:ub67bL9C15", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:Property" + }, + "sh:path": { + "@id": "rdfs:subClassOf" + } + }, + { + "@id": "_:ub67bL25C13", + "sh:minCount": 1, + "sh:path": { + "@id": "iot:acceptsInputData" + } + }, + { + "@id": "_:ub67bL42C1", + "sh:property": { + "@id": "_:ub67bL42C15" + } + }, + { + "@id": "_:ub67bL37C15", + "sh:datatype": { + "@id": "xsd:integer" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:propertyType" + } + }, + { + "@id": "_:ub67bL14C1", + "sh:property": { + "@id": "_:ub67bL14C15" + } + }, + { + "@id": "_:ub67bL5C15", + "sh:minCount": 1, + "sh:node": { + "@list": [ + { + "@id": "iot:AmbientAir" + } + ] + }, + "sh:path": { + "@id": "iot:capability" + } + }, + { + "@id": "_:ub67bL24C10", "sh:property": { - "@id": "_:ub230bL5C14" + "@id": "_:ub67bL25C13" } }, { - "@id": "_:ub230bL10C14", + "@id": "iotsh:CarbonDioxideConcentrationLimitShape", + "@type": "sh:NodeShape", + "sh:and": { + "@list": [ + { + "@id": "_:ub67bL5C1" + }, + { + "@id": "_:ub67bL9C1" + }, + { + "@id": "_:ub67bL14C1" + }, + { + "@id": "_:ub67bL19C1" + }, + { + "@id": "_:ub67bL24C1" + }, + { + "@id": "_:ub67bL28C1" + } + ] + }, + "sh:targetClass": { + "@id": "iot:CarbonDioxideConcentrationLimit" + } + }, + { + "@id": "_:ub67bL28C1", + "sh:property": { + "@id": "_:ub67bL28C14" + } + }, + { + "@id": "_:ub67bL28C14", "sh:datatype": { "@id": "xsd:boolean" }, @@ -28,35 +139,67 @@ } }, { - "@id": "_:ub230bL10C1", + "@id": "_:ub67bL9C1", "sh:property": { - "@id": "_:ub230bL10C14" + "@id": "_:ub67bL9C15" } }, { - "@id": "_:ub230bL5C14", - "sh:hasValue": true, + "@id": "_:ub67bL37C1", + "sh:property": { + "@id": "_:ub67bL37C15" + } + }, + { + "@id": "_:ub67bL42C15", + "sh:in": { + "@list": [ + { + "@id": "iot:PartsPerMillion" + }, + { + "@id": "iot:Percent" + } + ] + }, "sh:maxCount": 1, "sh:minCount": 1, "sh:path": { - "@id": "iot:writable" + "@id": "schema:unitCode" } }, { - "@id": "iotsh:CarbonDioxideConcentrationLimitShape", + "@id": "iotsh:CarbonDioxideConcentrationLimitDataShape", "@type": "sh:NodeShape", "sh:and": { "@list": [ { - "@id": "_:ub230bL5C1" + "@id": "_:ub67bL37C1" }, { - "@id": "_:ub230bL10C1" + "@id": "_:ub67bL42C1" } ] }, "sh:targetClass": { - "@id": "iot:CarbonDioxideConcentrationLimit" + "@id": "iot:CarbonDioxideConcentrationLimitData" + } + }, + { + "@id": "_:ub67bL14C15", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:CarbonDioxideConcentrationLimitData" + }, + "sh:path": { + "@id": "iot:providesOutputData" + } + }, + { + "@id": "_:ub67bL19C1", + "sh:property": { + "@id": "_:ub67bL19C14" } } ] diff --git a/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.html b/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.html index 6fd7961..6ed1de9 100644 --- a/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.html +++ b/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.html @@ -4,6 +4,12 @@ color: '#00A4B4', defaults: { + + propertyType: {value:""}, + + + unitCode: {value:""}, + name: {value:""}, iptype: {value:"iot:DemandControlledVentilation"}, capability: {value:""}, @@ -43,6 +49,18 @@ +
    + +
    +
    + +
    + +
    +
    +

    @@ -64,6 +82,32 @@ is a Property. + It provides output + which + is + DemandControlledVentilationData .


    + + DemandControlledVentilationData can be configured with + propertyType + unitCode +

    +

    Configurations

    +
    +
    PropertyType + Float + +
      +
      +
      +
      +
      UnitCode + + +
      • GasInAirConcentrationUnit
      +
      +
      + + diff --git a/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.js b/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.js index 7e45900..04977cc 100644 --- a/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.js +++ b/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.js @@ -24,6 +24,7 @@ module.exports = function(RED) { configJ["configParams"]["capability"] = config.capability; configJ["configParams"]["FeatureOfInterestType"] = config.foitype; configJ["configParams"]["FeatureOfInterest"] = config.foi; + configJ["configParams"]["unitCode"] = config.unitCode configJ["configParams"]["operation"] = config.operation; output = configInt.addConfigAttributes(source, configJ); let graph = []; diff --git a/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.jsonld b/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.jsonld index 41b097b..311d850 100644 --- a/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.jsonld +++ b/nodes/iotschema/demandcontrolledventilation-package/demandcontrolledventilation.jsonld @@ -10,16 +10,127 @@ "xsd": "http://www.w3.org/2001/XMLSchema#" }, "@graph": [ + { + "@id": "_:ub71bL14C15", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:DemandControlledVentilationData" + }, + "sh:path": { + "@id": "iot:providesOutputData" + } + }, + { + "@id": "_:ub71bL9C1", + "sh:property": { + "@id": "_:ub71bL9C15" + } + }, + { + "@id": "_:ub71bL37C1", + "sh:property": { + "@id": "_:ub71bL37C15" + } + }, + { + "@id": "_:ub71bL28C1", + "sh:property": { + "@id": "_:ub71bL28C14" + } + }, + { + "@id": "_:ub71bL24C10", + "sh:property": { + "@id": "_:ub71bL25C13" + } + }, + { + "@id": "_:ub71bL19C1", + "sh:property": { + "@id": "_:ub71bL19C14" + } + }, + { + "@id": "_:ub71bL19C14", + "sh:hasValue": false, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "iot:writable" + } + }, + { + "@id": "iotsh:DemandControlledVentilationDataShape", + "@type": "sh:NodeShape", + "sh:and": { + "@list": [ + { + "@id": "_:ub71bL37C1" + }, + { + "@id": "_:ub71bL42C1" + } + ] + }, + "sh:targetClass": { + "@id": "iot:DemandControlledVentilationData" + } + }, + { + "@id": "_:ub71bL9C15", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:Property" + }, + "sh:path": { + "@id": "rdfs:subClassOf" + } + }, + { + "@id": "_:ub71bL5C1", + "sh:property": { + "@id": "_:ub71bL5C15" + } + }, + { + "@id": "_:ub71bL42C15", + "sh:in": { + "@list": [ + { + "@id": "iot:GasInAirConcentrationUnit" + } + ] + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:unitCode" + } + }, { "@id": "iotsh:DemandControlledVentilationShape", "@type": "sh:NodeShape", "sh:and": { "@list": [ { - "@id": "_:ub246bL5C1" + "@id": "_:ub71bL5C1" }, { - "@id": "_:ub246bL10C1" + "@id": "_:ub71bL9C1" + }, + { + "@id": "_:ub71bL14C1" + }, + { + "@id": "_:ub71bL19C1" + }, + { + "@id": "_:ub71bL24C1" + }, + { + "@id": "_:ub71bL28C1" } ] }, @@ -28,35 +139,64 @@ } }, { - "@id": "_:ub246bL5C14", - "sh:hasValue": true, - "sh:maxCount": 1, + "@id": "_:ub71bL24C1", + "sh:not": { + "@id": "_:ub71bL24C10" + } + }, + { + "@id": "_:ub71bL25C13", "sh:minCount": 1, "sh:path": { - "@id": "iot:writable" + "@id": "iot:acceptsInputData" } }, { - "@id": "_:ub246bL10C14", + "@id": "_:ub71bL37C15", "sh:datatype": { - "@id": "xsd:boolean" + "@id": "xsd:float" }, "sh:maxCount": 1, "sh:minCount": 1, "sh:path": { - "@id": "iot:observable" + "@id": "schema:propertyType" + } + }, + { + "@id": "_:ub71bL5C15", + "sh:minCount": 1, + "sh:node": { + "@list": [ + { + "@id": "iot:AmbientAir" + } + ] + }, + "sh:path": { + "@id": "iot:capability" } }, { - "@id": "_:ub246bL5C1", + "@id": "_:ub71bL42C1", "sh:property": { - "@id": "_:ub246bL5C14" + "@id": "_:ub71bL42C15" + } + }, + { + "@id": "_:ub71bL28C14", + "sh:datatype": { + "@id": "xsd:boolean" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "iot:observable" } }, { - "@id": "_:ub246bL10C1", + "@id": "_:ub71bL14C1", "sh:property": { - "@id": "_:ub246bL10C14" + "@id": "_:ub71bL14C15" } } ] diff --git a/nodes/iotschema/highcarbondioxideconcentrationalarm-package/ConfigAttrIntegrator.js b/nodes/iotschema/highcarbondioxideconcentrationalarm-package/ConfigAttrIntegrator.js index c468bf1..b013cb9 100644 --- a/nodes/iotschema/highcarbondioxideconcentrationalarm-package/ConfigAttrIntegrator.js +++ b/nodes/iotschema/highcarbondioxideconcentrationalarm-package/ConfigAttrIntegrator.js @@ -202,7 +202,7 @@ function integrateFoiConfig(bn){ capNode["sh:path"] = {}; if(observable){ - capNode["sh:path"]["@id"] = "iot:isEventOf"; + capNode["sh:path"]["@id"] = "iot:isPropertyOf"; capNode["sh:hasValue"] = foi;} else{ capNode["sh:path"]["@id"] = "iot:isActionOf"; diff --git a/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.html b/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.html index 7d753f1..21f7b47 100644 --- a/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.html +++ b/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.html @@ -4,14 +4,20 @@ color: '#00A4B4', defaults: { + + propertyType: {value:""}, + + + unitCode: {value:""}, + name: {value:""}, - iptype: {value:"iot:HighCarbondioxideConcentrationAlarm"}, + iptype: {value:"iot:HighCarbonDioxideConcentrationAlarm"}, capability: {value:""}, foitype: {value:""}, foi: {value:""}, operation:{value:""} }, - inputs:0, + inputs:1, outputs:2, icon: "file.png", label: function() { @@ -43,6 +49,19 @@ +
      + +
      +
      + +
      + +
      +
      +

      @@ -50,16 +69,46 @@
      diff --git a/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.js b/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.js index a3d9518..f210c3a 100644 --- a/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.js +++ b/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.js @@ -24,6 +24,7 @@ module.exports = function(RED) { configJ["configParams"]["capability"] = config.capability; configJ["configParams"]["FeatureOfInterestType"] = config.foitype; configJ["configParams"]["FeatureOfInterest"] = config.foi; + configJ["configParams"]["unitCode"] = config.unitCode configJ["configParams"]["operation"] = config.operation; output = configInt.addConfigAttributes(source, configJ); let graph = []; diff --git a/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.jsonld b/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.jsonld index e4ad825..7ab43d5 100644 --- a/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.jsonld +++ b/nodes/iotschema/highcarbondioxideconcentrationalarm-package/highcarbondioxideconcentrationalarm.jsonld @@ -11,74 +11,195 @@ }, "@graph": [ { - "@id": "_:ub244bL11C13", + "@id": "_:ub73bL19C1", + "sh:property": { + "@id": "_:ub73bL19C15" + } + }, + { + "@id": "_:ub73bL10C1", + "sh:property": { + "@id": "_:ub73bL10C15" + } + }, + { + "@id": "_:ub73bL33C1", + "sh:property": { + "@id": "_:ub73bL33C14" + } + }, + { + "@id": "_:ub73bL28C15", + "sh:maxCount": 1, "sh:minCount": 1, + "sh:node": { + "@id": "iot:CarbonDioxideConcentrationLimitData" + }, "sh:path": { - "@id": "iot:acceptsInputData" + "@id": "iot:providesOutputData" } }, { - "@id": "_:ub244bL5C14", - "sh:hasValue": false, - "sh:maxCount": 1, + "@id": "_:ub73bL19C15", "sh:minCount": 1, + "sh:node": { + "@list": [ + { + "@id": "iot:AmbientAir" + } + ] + }, "sh:path": { - "@id": "iot:writable" + "@id": "iot:capability" } }, { - "@id": "_:ub244bL10C1", + "@id": "_:ub73bL38C1", "sh:not": { - "@id": "_:ub244bL10C10" + "@id": "_:ub73bL38C10" + } + }, + { + "@id": "_:ub73bL42C1", + "sh:property": { + "@id": "_:ub73bL42C14" } }, { - "@id": "_:ub244bL14C1", + "@id": "_:ub73bL5C1", "sh:property": { - "@id": "_:ub244bL14C14" + "@id": "_:ub73bL5C15" + } + }, + { + "@id": "_:ub73bL23C1", + "sh:property": { + "@id": "_:ub73bL23C15" + } + }, + { + "@id": "_:ub73bL39C13", + "sh:minCount": 1, + "sh:path": { + "@id": "iot:acceptsInputData" + } + }, + { + "@id": "_:ub73bL23C15", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:Event" + }, + "sh:path": { + "@id": "rdfs:subClassOf" + } + }, + { + "@id": "_:ub73bL42C14", + "sh:datatype": { + "@id": "xsd:boolean" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "iot:observable" } }, { - "@id": "iotsh:HighCarbondioxideConcentrationAlarmShape", + "@id": "iotsh:HighCarbonDioxideConcentrationAlarmShape", "@type": "sh:NodeShape", "sh:and": { "@list": [ { - "@id": "_:ub244bL5C1" + "@id": "_:ub73bL19C1" }, { - "@id": "_:ub244bL10C1" + "@id": "_:ub73bL23C1" + }, + { + "@id": "_:ub73bL28C1" + }, + { + "@id": "_:ub73bL33C1" + }, + { + "@id": "_:ub73bL38C1" + }, + { + "@id": "_:ub73bL42C1" + } + ] + }, + "sh:targetClass": { + "@id": "iot:HighCarbonDioxideConcentrationAlarm" + } + }, + { + "@id": "_:ub73bL28C1", + "sh:property": { + "@id": "_:ub73bL28C15" + } + }, + { + "@id": "_:ub73bL38C10", + "sh:property": { + "@id": "_:ub73bL39C13" + } + }, + { + "@id": "iotsh:CarbonDioxideConcentrationLimitDataShape", + "@type": "sh:NodeShape", + "sh:and": { + "@list": [ + { + "@id": "_:ub73bL5C1" }, { - "@id": "_:ub244bL14C1" + "@id": "_:ub73bL10C1" } ] }, "sh:targetClass": { - "@id": "iot:HighCarbondioxideConcentrationAlarm" + "@id": "iot:CarbonDioxideConcentrationLimitData" } }, { - "@id": "_:ub244bL14C14", + "@id": "_:ub73bL5C15", "sh:datatype": { - "@id": "xsd:boolean" + "@id": "xsd:integer" }, "sh:maxCount": 1, "sh:minCount": 1, "sh:path": { - "@id": "iot:observable" + "@id": "schema:propertyType" } }, { - "@id": "_:ub244bL5C1", - "sh:property": { - "@id": "_:ub244bL5C14" + "@id": "_:ub73bL33C14", + "sh:hasValue": false, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "iot:writable" } }, { - "@id": "_:ub244bL10C10", - "sh:property": { - "@id": "_:ub244bL11C13" + "@id": "_:ub73bL10C15", + "sh:in": { + "@list": [ + { + "@id": "iot:PartsPerMillion" + }, + { + "@id": "iot:Percent" + } + ] + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:unitCode" } } ] diff --git a/nodes/iotschema/rampdown-package/ConfigAttrIntegrator.js b/nodes/iotschema/rampdown-package/ConfigAttrIntegrator.js new file mode 100644 index 0000000..b013cb9 --- /dev/null +++ b/nodes/iotschema/rampdown-package/ConfigAttrIntegrator.js @@ -0,0 +1,224 @@ +'use strict' +/* +IPShapeParser.js: +---------------- +parses an input iot.schema.org Interaction Pattern (IP) shape and +extracts configuration attributes for the given IP node. +This code is used to create a Node-RED node for an iot.schema.org IP. +*/ + +const sep = require('path').sep; +var ids = []; +var shapes = []; +var shapeJson; +function addConfigAttributes(shapej, configj){ + shapeJson = shapej; + parseShape(shapej); + parseConfigAttr(configj); + return shapeJson; +} +function parseShape(data){ + // var json = JSON.parse(data); + for (var i = 0, j = 0; i < (data['@graph']).length; i++, j++) { + shapes[j] = data['@graph'][i]; + ids[j] = shapes[j].id; + } + if (data == null) { + console.log("Please provide a SHACL shape as input parameter"); + } +} +var minval; +var maxval; +var unit = ""; +var values = []; +var observable; +var name = ""; +var capability = ""; +var foi = ""; + +function parseConfigAttr(json){ + + //var json = JSON.parse(data); + minval = json["configParams"]["minValue"]; + maxval = json["configParams"]["maxValue"]; + unit = json["configParams"]["unitCode"]; + values = json["configParams"]["propertyValues"]; + observable = json["configParams"]["observable"]; + name = json["configParams"]["name"]; + capability = json["configParams"]["capability"]; + foi = json["configParams"]["FeatureOfInterestType"]; + ingrateIntoShape(); +} + +function ingrateIntoShape(){ + var requiredShape = {}; + if(minval !=undefined){ + requiredShape = getshape("schema:minValue"); + integrateMinConfig(requiredShape, minval); + } + if(minval !=undefined){ + requiredShape = getshape("schema:maxValue"); + integrateMaxConfig(requiredShape, maxval); + } + if(unit !=undefined){ + requiredShape = getshape("schema:unitCode"); + integrateUnitConfig(requiredShape, unit); + } + if(observable !=undefined){ + requiredShape = getshape("iot:observable"); + integrateObservableConfig(requiredShape, observable); + } + if(capability !=undefined){ + for(var m = 0; m < shapes.length; m++){ + if(shapes[m]["sh:targetClass"]){ + if(!shapes[m]["@id"].includes("Data")){ + var temp = {}; + temp = shapes[m]; + if(name!="") + temp["name"] = name; + if(capability!=""){ + var bn = "_:"+randomString(); + temp["sh:and"]["@list"].push({"@id": bn}); + integrateCapabilityConfig(bn); + } + if(foi!=""){ + var bn = "_:"+randomString(); + var rnode = {}; + rnode["@id"] = bn; + temp["sh:and"]["@list"].push(rnode); + integrateFoiConfig(bn); + } + delete shapeJson['@graph'].temp; + shapeJson['@graph'].push(temp); + } + } + } + } + /*if(foi !=undefined){ + requiredShape = getshape("sh:targetClass"); + integrateFoiConfig(requiredShape, foi); + }*/ +} + +function randomString() { + var charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + var blankNode = ''; + for (var i = 0; i < 10; i++) { + var randomPoz = Math.floor(Math.random() * charSet.length); + blankNode += charSet.substring(randomPoz,randomPoz+1); + } + return blankNode; +} + +function integrateMinConfig(shape, attr){ + var index = shapeJson['@graph'].indexOf(shape); + shapeJson['@graph'].splice( index, 1 ); + var propTypeNode = getPropertyTypeShape(); + delete shapeJson.propTypeNode; + propTypeNode["sh:minInclusive"] = {}; + propTypeNode["sh:minInclusive"] = attr; + shapeJson['@graph'].push(propTypeNode); +} + +function getPropertyTypeShape(){ + for(var i = 0; i < shapes.length; i++){ + if(shapes[i]["sh:path"]){ + if(shapes[i]["sh:path"]["@id"] == "schema:propertyType"){ + return shapes[i]; + } + } + } +} + +function integrateMaxConfig(shape, attr){ + var index = shapeJson['@graph'].indexOf(shape); + shapeJson['@graph'].splice( index, 1 ); + var propTypeNode = getPropertyTypeShape(); + delete shapeJson['@graph'].propTypeNode; + propTypeNode["sh:maxInclusive"] = {}; + propTypeNode["sh:maxInclusive"] = attr; + shapeJson['@graph'].push(propTypeNode); +} + +function integrateUnitConfig(shape, attr){ + var temp = shape; + delete shapeJson['@graph'].shape; + delete temp["sh:in"]; + temp["sh:hasValue"] = attr; + shapeJson['@graph'].push(temp); +} + +function integrateObservableConfig(shape, attr){ + delete shapeJson['@graph'].shape; + delete shape["sh:hasValue"]; + shape["sh:hasValue"] = attr; + shapeJson['@graph'].push(shape); +} + +function getshape(shapeAttr){ + /* for(var m = 0; m < shapes.length; m++){ + console.log(shapes[m]); + }*/ + for(var m = 0; m < shapes.length; m++){ + if(shapes[m]["sh:path"]){ + if(shapes[m]["sh:path"]["@id"] == shapeAttr){ + return shapes[m]; + } + } + } +} + +function integrateCapabilityConfig(bn){ + var rnode = {}; + var bn2 = "_:"+randomString(); + rnode["@id"] = bn; + rnode["sh:property"] = {}; + rnode["sh:property"]["@id"] = bn2; + shapeJson['@graph'].push(rnode); + + var capNode = {}; + capNode["@id"] = bn2; + capNode["sh:maxCount"] = 1; + capNode["sh:minCount"] = 1; + capNode["sh:hasValue"] = capability; + capNode["sh:path"] = {}; + capNode["sh:path"]["@id"] = "iot:capability"; + shapeJson['@graph'].push(capNode); + +} + +function integrateFoiConfig(bn){ + var rnode = {}; + var bn2 = "_:"+randomString(); + rnode["@id"] = bn; + rnode["sh:property"] = {}; + rnode["sh:property"]["@id"] = bn2; + shapeJson['@graph'].push(rnode); + + var capNode = {}; + capNode["@id"] = bn2; + capNode["sh:maxCount"] = 1; + capNode["sh:minCount"] = 1; + + capNode["sh:path"] = {}; + if(observable){ + capNode["sh:path"]["@id"] = "iot:isPropertyOf"; + capNode["sh:hasValue"] = foi;} + else{ + capNode["sh:path"]["@id"] = "iot:isActionOf"; + capNode["sh:hasValue"] = foi;} + shapeJson['@graph'].push(capNode); + +} +function removeDuplicates(arr){ + var unique_array = [] + for(var i = 0;i < arr.length; i++){ + if(unique_array.indexOf(arr[i]) == -1){ + unique_array.push(arr[i]) + } + } + return unique_array +} + +module.exports.addConfigAttributes = addConfigAttributes; +module.exports.removeDuplicates = removeDuplicates; \ No newline at end of file diff --git a/nodes/iotschema/rampdown-package/package.json b/nodes/iotschema/rampdown-package/package.json new file mode 100644 index 0000000..c4c7789 --- /dev/null +++ b/nodes/iotschema/rampdown-package/package.json @@ -0,0 +1,11 @@ +{ + "name": "rampdown-package", + "version": "1.0.0", + "description": "undefined", + "main": "rampdown.js", + "node-red" : { + "nodes": { + "rampdown": "rampdown.js" + } + } +} diff --git a/nodes/iotschema/rampdown-package/rampdown.html b/nodes/iotschema/rampdown-package/rampdown.html new file mode 100644 index 0000000..0c0a2b7 --- /dev/null +++ b/nodes/iotschema/rampdown-package/rampdown.html @@ -0,0 +1,166 @@ + + + + + diff --git a/nodes/iotschema/rampdown-package/rampdown.js b/nodes/iotschema/rampdown-package/rampdown.js new file mode 100644 index 0000000..3881a13 --- /dev/null +++ b/nodes/iotschema/rampdown-package/rampdown.js @@ -0,0 +1,50 @@ +"use strict"; + +let configInt = require('./ConfigAttrIntegrator.js'); + +module.exports = function(RED) { + function rampdown(config) { + RED.nodes.createNode(this, config); + let node = this; + let source; + let output; + let fs = require('fs'); + let path = require('path'); + let shapePath = path.join(__dirname,"rampdown.jsonld"); + + + + fs.readFile(shapePath, {encoding: 'utf-8'}, function(err,data){ + if (!err) { + source = JSON.parse(data); + let configJ = {}; + configJ["configParams"] = {}; + configJ["configParams"]["name"] = config.name; + configJ["configParams"]["InteractionPatternType"] = config.iptype; + configJ["configParams"]["capability"] = config.capability; + configJ["configParams"]["FeatureOfInterestType"] = config.foitype; + configJ["configParams"]["FeatureOfInterest"] = config.foi; + configJ["configParams"]["unitCode"] = config.unitCode + configJ["configParams"]["minValue"] = config.minValue + configJ["configParams"]["maxValue"] = config.maxValue + configJ["configParams"]["operation"] = config.operation; + output = configInt.addConfigAttributes(source, configJ); + let graph = []; + graph = configInt.removeDuplicates(output["@graph"]); + delete output["@graph"]; + output["@graph"] = []; + output["@graph"] = graph; + node.send([{payload:output},null]); + } + else { + console.log(err); + } + }); + + node.on('input', function(msg) { + node.send([null,{payload:msg}]); + }); +} + + RED.nodes.registerType("rampdown", rampdown); +}; diff --git a/nodes/iotschema/rampdown-package/rampdown.jsonld b/nodes/iotschema/rampdown-package/rampdown.jsonld new file mode 100644 index 0000000..5272792 --- /dev/null +++ b/nodes/iotschema/rampdown-package/rampdown.jsonld @@ -0,0 +1,266 @@ +{ + "@context": { + "dash": "http://datashapes.org/dash#", + "iot": "http://iotschema.org/", + "iotsh": "http://iotschema.org/shapes/", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "schema": "http://schema.org/", + "sh": "http://www.w3.org/ns/shacl#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@graph": [ + { + "@id": "_:ub75bL57C1", + "sh:property": { + "@id": "_:ub75bL57C16" + } + }, + { + "@id": "_:ub75bL38C15", + "sh:datatype": { + "@id": "xsd:integer" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:propertyType" + } + }, + { + "@id": "_:ub75bL5C1", + "sh:property": { + "@id": "_:ub75bL5C15" + } + }, + { + "@id": "_:ub75bL29C1", + "sh:property": { + "@id": "_:ub75bL29C14" + } + }, + { + "@id": "_:ub75bL57C16", + "sh:datatype": { + "@id": "xsd:integer" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:minValue" + } + }, + { + "@id": "_:ub75bL52C15", + "sh:datatype": { + "@id": "xsd:integer" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:propertyType" + } + }, + { + "@id": "iotsh:RampTimeDataShape", + "@type": "sh:NodeShape", + "sh:and": { + "@list": [ + { + "@id": "_:ub75bL52C1" + }, + { + "@id": "_:ub75bL57C1" + }, + { + "@id": "_:ub75bL62C1" + } + ] + }, + "sh:targetClass": { + "@id": "iot:RampTimeData" + } + }, + { + "@id": "_:ub75bL14C14", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:RampData" + }, + "sh:path": { + "@id": "iot:acceptsInputData" + } + }, + { + "@id": "_:ub75bL52C1", + "sh:property": { + "@id": "_:ub75bL52C15" + } + }, + { + "@id": "_:ub75bL9C1", + "sh:property": { + "@id": "_:ub75bL9C15" + } + }, + { + "@id": "_:ub75bL29C14", + "sh:datatype": { + "@id": "xsd:boolean" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "iot:observable" + } + }, + { + "@id": "_:ub75bL62C1", + "sh:property": { + "@id": "_:ub75bL62C16" + } + }, + { + "@id": "_:ub75bL5C15", + "sh:minCount": 1, + "sh:node": { + "@list": [] + }, + "sh:path": { + "@id": "iot:capability" + } + }, + { + "@id": "_:ub75bL14C1", + "sh:property": { + "@id": "_:ub75bL14C14" + } + }, + { + "@id": "_:ub75bL9C15", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:Action" + }, + "sh:path": { + "@id": "rdfs:subClassOf" + } + }, + { + "@id": "iotsh:RampDataShape", + "@type": "sh:NodeShape", + "sh:and": { + "@list": [ + { + "@id": "_:ub75bL38C1" + }, + { + "@id": "_:ub75bL43C1" + } + ] + }, + "sh:targetClass": { + "@id": "iot:RampData" + } + }, + { + "@id": "_:ub75bL38C1", + "sh:property": { + "@id": "_:ub75bL38C15" + } + }, + { + "@id": "_:ub75bL43C1", + "sh:property": { + "@id": "_:ub75bL43C15" + } + }, + { + "@id": "_:ub75bL24C1", + "sh:property": { + "@id": "_:ub75bL24C14" + } + }, + { + "@id": "iotsh:RampDownShape", + "@type": "sh:NodeShape", + "sh:and": { + "@list": [ + { + "@id": "_:ub75bL5C1" + }, + { + "@id": "_:ub75bL9C1" + }, + { + "@id": "_:ub75bL14C1" + }, + { + "@id": "_:ub75bL19C1" + }, + { + "@id": "_:ub75bL24C1" + }, + { + "@id": "_:ub75bL29C1" + } + ] + }, + "sh:targetClass": { + "@id": "iot:RampDown" + } + }, + { + "@id": "_:ub75bL62C16", + "sh:datatype": { + "@id": "xsd:integer" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:maxValue" + } + }, + { + "@id": "_:ub75bL43C15", + "sh:in": { + "@list": [] + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:unitCode" + } + }, + { + "@id": "_:ub75bL19C14", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:RampTimeData" + }, + "sh:path": { + "@id": "iot:acceptsInputData" + } + }, + { + "@id": "_:ub75bL19C1", + "sh:property": { + "@id": "_:ub75bL19C14" + } + }, + { + "@id": "_:ub75bL24C14", + "sh:hasValue": { + "@id": "xsd:boolean" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "iot:writable" + } + } + ] +} \ No newline at end of file diff --git a/nodes/iotschema/rampup-package/ConfigAttrIntegrator.js b/nodes/iotschema/rampup-package/ConfigAttrIntegrator.js new file mode 100644 index 0000000..b013cb9 --- /dev/null +++ b/nodes/iotschema/rampup-package/ConfigAttrIntegrator.js @@ -0,0 +1,224 @@ +'use strict' +/* +IPShapeParser.js: +---------------- +parses an input iot.schema.org Interaction Pattern (IP) shape and +extracts configuration attributes for the given IP node. +This code is used to create a Node-RED node for an iot.schema.org IP. +*/ + +const sep = require('path').sep; +var ids = []; +var shapes = []; +var shapeJson; +function addConfigAttributes(shapej, configj){ + shapeJson = shapej; + parseShape(shapej); + parseConfigAttr(configj); + return shapeJson; +} +function parseShape(data){ + // var json = JSON.parse(data); + for (var i = 0, j = 0; i < (data['@graph']).length; i++, j++) { + shapes[j] = data['@graph'][i]; + ids[j] = shapes[j].id; + } + if (data == null) { + console.log("Please provide a SHACL shape as input parameter"); + } +} +var minval; +var maxval; +var unit = ""; +var values = []; +var observable; +var name = ""; +var capability = ""; +var foi = ""; + +function parseConfigAttr(json){ + + //var json = JSON.parse(data); + minval = json["configParams"]["minValue"]; + maxval = json["configParams"]["maxValue"]; + unit = json["configParams"]["unitCode"]; + values = json["configParams"]["propertyValues"]; + observable = json["configParams"]["observable"]; + name = json["configParams"]["name"]; + capability = json["configParams"]["capability"]; + foi = json["configParams"]["FeatureOfInterestType"]; + ingrateIntoShape(); +} + +function ingrateIntoShape(){ + var requiredShape = {}; + if(minval !=undefined){ + requiredShape = getshape("schema:minValue"); + integrateMinConfig(requiredShape, minval); + } + if(minval !=undefined){ + requiredShape = getshape("schema:maxValue"); + integrateMaxConfig(requiredShape, maxval); + } + if(unit !=undefined){ + requiredShape = getshape("schema:unitCode"); + integrateUnitConfig(requiredShape, unit); + } + if(observable !=undefined){ + requiredShape = getshape("iot:observable"); + integrateObservableConfig(requiredShape, observable); + } + if(capability !=undefined){ + for(var m = 0; m < shapes.length; m++){ + if(shapes[m]["sh:targetClass"]){ + if(!shapes[m]["@id"].includes("Data")){ + var temp = {}; + temp = shapes[m]; + if(name!="") + temp["name"] = name; + if(capability!=""){ + var bn = "_:"+randomString(); + temp["sh:and"]["@list"].push({"@id": bn}); + integrateCapabilityConfig(bn); + } + if(foi!=""){ + var bn = "_:"+randomString(); + var rnode = {}; + rnode["@id"] = bn; + temp["sh:and"]["@list"].push(rnode); + integrateFoiConfig(bn); + } + delete shapeJson['@graph'].temp; + shapeJson['@graph'].push(temp); + } + } + } + } + /*if(foi !=undefined){ + requiredShape = getshape("sh:targetClass"); + integrateFoiConfig(requiredShape, foi); + }*/ +} + +function randomString() { + var charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + var blankNode = ''; + for (var i = 0; i < 10; i++) { + var randomPoz = Math.floor(Math.random() * charSet.length); + blankNode += charSet.substring(randomPoz,randomPoz+1); + } + return blankNode; +} + +function integrateMinConfig(shape, attr){ + var index = shapeJson['@graph'].indexOf(shape); + shapeJson['@graph'].splice( index, 1 ); + var propTypeNode = getPropertyTypeShape(); + delete shapeJson.propTypeNode; + propTypeNode["sh:minInclusive"] = {}; + propTypeNode["sh:minInclusive"] = attr; + shapeJson['@graph'].push(propTypeNode); +} + +function getPropertyTypeShape(){ + for(var i = 0; i < shapes.length; i++){ + if(shapes[i]["sh:path"]){ + if(shapes[i]["sh:path"]["@id"] == "schema:propertyType"){ + return shapes[i]; + } + } + } +} + +function integrateMaxConfig(shape, attr){ + var index = shapeJson['@graph'].indexOf(shape); + shapeJson['@graph'].splice( index, 1 ); + var propTypeNode = getPropertyTypeShape(); + delete shapeJson['@graph'].propTypeNode; + propTypeNode["sh:maxInclusive"] = {}; + propTypeNode["sh:maxInclusive"] = attr; + shapeJson['@graph'].push(propTypeNode); +} + +function integrateUnitConfig(shape, attr){ + var temp = shape; + delete shapeJson['@graph'].shape; + delete temp["sh:in"]; + temp["sh:hasValue"] = attr; + shapeJson['@graph'].push(temp); +} + +function integrateObservableConfig(shape, attr){ + delete shapeJson['@graph'].shape; + delete shape["sh:hasValue"]; + shape["sh:hasValue"] = attr; + shapeJson['@graph'].push(shape); +} + +function getshape(shapeAttr){ + /* for(var m = 0; m < shapes.length; m++){ + console.log(shapes[m]); + }*/ + for(var m = 0; m < shapes.length; m++){ + if(shapes[m]["sh:path"]){ + if(shapes[m]["sh:path"]["@id"] == shapeAttr){ + return shapes[m]; + } + } + } +} + +function integrateCapabilityConfig(bn){ + var rnode = {}; + var bn2 = "_:"+randomString(); + rnode["@id"] = bn; + rnode["sh:property"] = {}; + rnode["sh:property"]["@id"] = bn2; + shapeJson['@graph'].push(rnode); + + var capNode = {}; + capNode["@id"] = bn2; + capNode["sh:maxCount"] = 1; + capNode["sh:minCount"] = 1; + capNode["sh:hasValue"] = capability; + capNode["sh:path"] = {}; + capNode["sh:path"]["@id"] = "iot:capability"; + shapeJson['@graph'].push(capNode); + +} + +function integrateFoiConfig(bn){ + var rnode = {}; + var bn2 = "_:"+randomString(); + rnode["@id"] = bn; + rnode["sh:property"] = {}; + rnode["sh:property"]["@id"] = bn2; + shapeJson['@graph'].push(rnode); + + var capNode = {}; + capNode["@id"] = bn2; + capNode["sh:maxCount"] = 1; + capNode["sh:minCount"] = 1; + + capNode["sh:path"] = {}; + if(observable){ + capNode["sh:path"]["@id"] = "iot:isPropertyOf"; + capNode["sh:hasValue"] = foi;} + else{ + capNode["sh:path"]["@id"] = "iot:isActionOf"; + capNode["sh:hasValue"] = foi;} + shapeJson['@graph'].push(capNode); + +} +function removeDuplicates(arr){ + var unique_array = [] + for(var i = 0;i < arr.length; i++){ + if(unique_array.indexOf(arr[i]) == -1){ + unique_array.push(arr[i]) + } + } + return unique_array +} + +module.exports.addConfigAttributes = addConfigAttributes; +module.exports.removeDuplicates = removeDuplicates; \ No newline at end of file diff --git a/nodes/iotschema/rampup-package/package.json b/nodes/iotschema/rampup-package/package.json new file mode 100644 index 0000000..7bb4e8c --- /dev/null +++ b/nodes/iotschema/rampup-package/package.json @@ -0,0 +1,11 @@ +{ + "name": "rampup-package", + "version": "1.0.0", + "description": "undefined", + "main": "rampup.js", + "node-red" : { + "nodes": { + "rampup": "rampup.js" + } + } +} diff --git a/nodes/iotschema/rampup-package/rampup.html b/nodes/iotschema/rampup-package/rampup.html new file mode 100644 index 0000000..c83b06f --- /dev/null +++ b/nodes/iotschema/rampup-package/rampup.html @@ -0,0 +1,166 @@ + + + + + diff --git a/nodes/iotschema/rampup-package/rampup.js b/nodes/iotschema/rampup-package/rampup.js new file mode 100644 index 0000000..1ad7ee6 --- /dev/null +++ b/nodes/iotschema/rampup-package/rampup.js @@ -0,0 +1,50 @@ +"use strict"; + +let configInt = require('./ConfigAttrIntegrator.js'); + +module.exports = function(RED) { + function rampup(config) { + RED.nodes.createNode(this, config); + let node = this; + let source; + let output; + let fs = require('fs'); + let path = require('path'); + let shapePath = path.join(__dirname,"rampup.jsonld"); + + + + fs.readFile(shapePath, {encoding: 'utf-8'}, function(err,data){ + if (!err) { + source = JSON.parse(data); + let configJ = {}; + configJ["configParams"] = {}; + configJ["configParams"]["name"] = config.name; + configJ["configParams"]["InteractionPatternType"] = config.iptype; + configJ["configParams"]["capability"] = config.capability; + configJ["configParams"]["FeatureOfInterestType"] = config.foitype; + configJ["configParams"]["FeatureOfInterest"] = config.foi; + configJ["configParams"]["unitCode"] = config.unitCode + configJ["configParams"]["minValue"] = config.minValue + configJ["configParams"]["maxValue"] = config.maxValue + configJ["configParams"]["operation"] = config.operation; + output = configInt.addConfigAttributes(source, configJ); + let graph = []; + graph = configInt.removeDuplicates(output["@graph"]); + delete output["@graph"]; + output["@graph"] = []; + output["@graph"] = graph; + node.send([{payload:output},null]); + } + else { + console.log(err); + } + }); + + node.on('input', function(msg) { + node.send([null,{payload:msg}]); + }); +} + + RED.nodes.registerType("rampup", rampup); +}; diff --git a/nodes/iotschema/rampup-package/rampup.jsonld b/nodes/iotschema/rampup-package/rampup.jsonld new file mode 100644 index 0000000..062dc9d --- /dev/null +++ b/nodes/iotschema/rampup-package/rampup.jsonld @@ -0,0 +1,266 @@ +{ + "@context": { + "dash": "http://datashapes.org/dash#", + "iot": "http://iotschema.org/", + "iotsh": "http://iotschema.org/shapes/", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "schema": "http://schema.org/", + "sh": "http://www.w3.org/ns/shacl#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@graph": [ + { + "@id": "_:ub77bL24C1", + "sh:property": { + "@id": "_:ub77bL24C16" + } + }, + { + "@id": "_:ub77bL19C15", + "sh:datatype": { + "@id": "xsd:integer" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:propertyType" + } + }, + { + "@id": "_:ub77bL10C15", + "sh:in": { + "@list": [] + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:unitCode" + } + }, + { + "@id": "_:ub77bL38C1", + "sh:property": { + "@id": "_:ub77bL38C15" + } + }, + { + "@id": "_:ub77bL42C15", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:Action" + }, + "sh:path": { + "@id": "rdfs:subClassOf" + } + }, + { + "@id": "_:ub77bL62C14", + "sh:datatype": { + "@id": "xsd:boolean" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "iot:observable" + } + }, + { + "@id": "_:ub77bL5C1", + "sh:property": { + "@id": "_:ub77bL5C15" + } + }, + { + "@id": "_:ub77bL47C1", + "sh:property": { + "@id": "_:ub77bL47C14" + } + }, + { + "@id": "_:ub77bL24C16", + "sh:datatype": { + "@id": "xsd:integer" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:minValue" + } + }, + { + "@id": "_:ub77bL10C1", + "sh:property": { + "@id": "_:ub77bL10C15" + } + }, + { + "@id": "iotsh:RampTimeDataShape", + "@type": "sh:NodeShape", + "sh:and": { + "@list": [ + { + "@id": "_:ub77bL19C1" + }, + { + "@id": "_:ub77bL24C1" + }, + { + "@id": "_:ub77bL29C1" + } + ] + }, + "sh:targetClass": { + "@id": "iot:RampTimeData" + } + }, + { + "@id": "iotsh:RampUpShape", + "@type": "sh:NodeShape", + "sh:and": { + "@list": [ + { + "@id": "_:ub77bL38C1" + }, + { + "@id": "_:ub77bL42C1" + }, + { + "@id": "_:ub77bL47C1" + }, + { + "@id": "_:ub77bL52C1" + }, + { + "@id": "_:ub77bL57C1" + }, + { + "@id": "_:ub77bL62C1" + } + ] + }, + "sh:targetClass": { + "@id": "iot:RampUp" + } + }, + { + "@id": "_:ub77bL42C1", + "sh:property": { + "@id": "_:ub77bL42C15" + } + }, + { + "@id": "_:ub77bL62C1", + "sh:property": { + "@id": "_:ub77bL62C14" + } + }, + { + "@id": "_:ub77bL52C1", + "sh:property": { + "@id": "_:ub77bL52C14" + } + }, + { + "@id": "_:ub77bL5C15", + "sh:datatype": { + "@id": "xsd:integer" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:propertyType" + } + }, + { + "@id": "_:ub77bL57C14", + "sh:hasValue": { + "@id": "xsd:boolean" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "iot:writable" + } + }, + { + "@id": "_:ub77bL47C14", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:RampData" + }, + "sh:path": { + "@id": "iot:acceptsInputData" + } + }, + { + "@id": "iotsh:RampDataShape", + "@type": "sh:NodeShape", + "sh:and": { + "@list": [ + { + "@id": "_:ub77bL5C1" + }, + { + "@id": "_:ub77bL10C1" + } + ] + }, + "sh:targetClass": { + "@id": "iot:RampData" + } + }, + { + "@id": "_:ub77bL29C16", + "sh:datatype": { + "@id": "xsd:integer" + }, + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:path": { + "@id": "schema:maxValue" + } + }, + { + "@id": "_:ub77bL52C14", + "sh:maxCount": 1, + "sh:minCount": 1, + "sh:node": { + "@id": "iot:RampTimeData" + }, + "sh:path": { + "@id": "iot:acceptsInputData" + } + }, + { + "@id": "_:ub77bL19C1", + "sh:property": { + "@id": "_:ub77bL19C15" + } + }, + { + "@id": "_:ub77bL29C1", + "sh:property": { + "@id": "_:ub77bL29C16" + } + }, + { + "@id": "_:ub77bL38C15", + "sh:minCount": 1, + "sh:node": { + "@list": [] + }, + "sh:path": { + "@id": "iot:capability" + } + }, + { + "@id": "_:ub77bL57C1", + "sh:property": { + "@id": "_:ub77bL57C14" + } + } + ] +} \ No newline at end of file