diff --git a/mappings/EDSCP/Enershare-Eumed/constructEnershareToEumed.rqg b/mappings/EDSCP/Enershare-Eumed/constructEnershareToEumed.rqg new file mode 100644 index 0000000000000000000000000000000000000000..6202af32728386f848254b19bd4461835af262da --- /dev/null +++ b/mappings/EDSCP/Enershare-Eumed/constructEnershareToEumed.rqg @@ -0,0 +1,152 @@ +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX plt: <https://w3id.org/platoon/> +PREFIX saref4bldg: <https://saref.etsi.org/saref4bldg/> +PREFIX cdt: <http://w3id.org/lindt/custom_datatypes#> +PREFIX sample: <https://w3id.org/omega-x/Sample/> +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> +PREFIX owl: <http://www.w3.org/2002/07/owl#> +PREFIX eme: <https://w3id.org/omega-x/ontology/EUMEDMetering#> +PREFIX seas: <https://w3id.org/seas/> +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> +PREFIX ic-data: <http://ontology.tno.nl/interconnect/datapoint#> +PREFIX qudt: <http://qudt.org/schema/qudt/> +PREFIX quantityKind: <http://qudt.org/vocab/quantitykind/> +PREFIX qudt-unit: <http://qudt.org/vocab/unit/> +PREFIX ener-prop:<https://w3id.org/enershare/property/> +PREFIX time: <http://www.w3.org/2006/time#> +PREFIX sch:<https:schema.org/> +PREFIX ex: <http://www.example.com> +PREFIX dcterms: <http://purl.org/dc/terms/> + +CONSTRUCT { + + ?MeterReadingSet rdf:type owl:NamedIndividual, eme:MeterReadingSet . + ?MeterReading rdf:type owl:NamedIndividual, eme:MeterReading ; + eme:isRelatedToUsagePoint ?UsagePointURI ; + eme:hasValuesInterval ?DateTimeInterval_1; + eme:isMeterReadingAsPartOfMeterReadingSet ?MeterReadingSet. + + ?DateTimeInterval_1 rdf:type owl:NamedIndividual, time:DateTimeInterval; + time:hasBeginning ?minDateTime; + time:hasEnd ?maxDateTime. + + + ?intervalReadingURI rdf:type owl:NamedIndividual, eme:IntervalReading ; + eme:isPartOfIntervalBlock ?intervalBlockURI ; + eme:value ?newvalue ; + eme:timeStamp ?dateTime. + + + ?intervalBlockURI a owl:NamedIndividual, eme:IntervalBlock; + eme:hasReadingType ?PropertyReadingType ; + eme:isPartOfMeterReading ?MeterReading . + + + ?UsagePointURI rdf:type owl:NamedIndividual, eme:UsagePoint ; + eme:hasNameAsUsagePoint ?usagePointName_1. + + ?usagePointName_1 rdf:type owl:NamedIndividual, eme:Name ; + eme:name ?HouseHoldLabel ; + eme:hasNameType sample:NameType_1. #-- EUMED UsagePoint + + sample:NameType_1 rdf:type owl:NamedIndividual, eme:NameType ; + eme:name "EUMED UsagePoint"^^xsd:string . + + ?PropertyReadingType rdf:type owl:NamedIndividual, eme:ReadingType ; + eme:hasNameAsReadingType ?ReadingTypeName_2 ; + eme:isReadingTypeAsPartOfMeterReadingSet ?MeterReadingSet; + eme:hasMeasuringPeriod ?durationyTarget ; + eme:hasFlowDirection ?flowDirection ; + eme:hasMeasurementKind ?measureKind ; + eme:hasUnit ?newUnit ; + eme:multiplier ?newUnitMultiplier. + + ?ReadingTypeName_2 rdf:type owl:NamedIndividual, eme:Name ; + eme:name ?ElectricEnergyConsumptionPropertyLabel ; + eme:hasNameType sample:NameType_2. + + sample:NameType_2 rdf:type owl:NamedIndividual, eme:NameType ; + eme:name "EUMED ReadingType"^^xsd:string . + + + } WHERE{ + + + ?houseHoldURI a seas:ResidentalBuilding; + rdfs:label ?houseID; + plt:hasElectricEnergyConsumption ?electricEnergyConsumptionPropertyURI. + + ?MeterURI a seas:ElectrcityMeter; + seas:measuresProperty ?electricEnergyConsumptionPropertyURI; + seas:measures ?houseHoldURI; + saref4bldg:isContainedIn ?houseHoldURI. + + ?electricEnergyConsumptionPropertyURI a plt:ElectricEnergyConsumptionProperty; + rdfs:label ?ElectricEnergyConsumptionPropertyLabel; + seas:evaluation ?ElectricEnergyConsumptionEvaluation; + ener-prop:hasHistoricalData ?timeSeriesURI. + + ?ElectricEnergyConsumptionEvaluation + a ?type; + rdfs:label ?label; + ic-data:belongsToTimeSeries ?timeSeriesURI ; + qudt:hasQuantityKind ?quantityKind ; + qudt:hasUnit ?unit ; + seas:evaluatedValue ?value ; + seas:evaluationOf ?electricEnergyConsumptionPropertyURI ; + seas:hasTemporalContext ?temporalEntityURI . + + ?temporalEntityURI a time:Instant; + time:inXSDDateTimeStamp ?dateTime. + + { + SELECT (MIN(?dateTime) AS ?minDateTime) (MAX(?dateTime) AS ?maxDateTime) + WHERE { + ?temporalEntityURI a time:Instant; + time:inXSDDateTimeStamp ?dateTime. + } + } + ?timeSeriesURI rdf:type ic-data:TimeSeries, owl:NamedIndividual ; + ic-data:hasDataPoint ?ElectricEnergyConsumptionEvaluation; + ic-data:hasTemporalResolution ?duration ; + ic-data:hasUpdateRate ?durationn ; + ic-data:hasUsage ?usage; + qudt:hasQuantityKind ?quantityKind; + qudt:hasUnit ?unit. + + ?meterURI a seas:ElectrcityMeter; + seas:measuresProperty ?electricEnergyConsumptionPropertyURI; + seas:measures ?houseHoldURI; + saref4bldg:isContainedIn ?houseHoldURI. + + ?houseHoldURI a seas:ResidentalBuilding ; + rdfs:label ?HouseHoldLabel . + + + BIND(URI(CONCAT("https://w3id.org/omega-x/Sample/", STRAFTER(STR(?ElectricEnergyConsumptionEvaluation +), "http://www.engie.fr/resource/"))) AS ?intervalReadingURI) + BIND(URI(CONCAT("https://w3id.org/omega-x/Sample/", STRAFTER(STR(?timeSeriesURI), "http://www.engie.fr/resource/"))) AS ?intervalBlockURI) BIND (URI(CONCAT(str("https://w3id.org/omega-x/Sample/"), "MeterReadingSet_1")) as ?MeterReadingSet) + BIND (URI(CONCAT(str("https://w3id.org/omega-x/Sample/"), "MeterReading_1")) as ?MeterReading) + BIND (URI(CONCAT(str("https://w3id.org/omega-x/Sample/"), "usagePoint_1")) as ?UsagePointURI) + BIND (URI(CONCAT(str("https://w3id.org/omega-x/Sample/"), "usagePoint_1", "/name")) as ?usagePointName_1) + + + BIND(URI(CONCAT("https://w3id.org/omega-x/Sample/", STRAFTER(STR(?electricEnergyConsumptionPropertyURI), "http://www.engie.fr/resource/"))) AS ?PropertyReadingType) + + BIND(URI(CONCAT("https://w3id.org/omega-x/Sample/", STRAFTER(STR(?electricEnergyConsumptionPropertyURI), "http://www.engie.fr/resource/"), '/name')) AS ?ReadingTypeName_2) + + + BIND (URI(CONCAT(str("https://w3id.org/omega-x/Sample/"), "datetimeinterval_1")) as ?DateTimeInterval_1) + #BIND (URI(CONCAT(str("https://w3id.org/omega-x/Sample/"), ENCODE_FOR_URI(?minDateTime),ENCODE_FOR_URI(?maxDateTime))) as ?DateTimeInterval_1) + + BIND(IF( ?quantityKind = <http://qudt.org/vocab/quantitykind/Energy> , eme:energy , ?empty) AS ?measureKind) + BIND(IF( ?unit = qudt-unit:KiloW-HR, eme:Wh, ?empty) AS ?newUnit) + BIND(IF( ?unit = qudt-unit:KiloW-HR, eme:k, ?empty) AS ?newUnitMultiplier) + + BIND(IF( ?usage = ic-data:consumption, eme:forward, ?empty) AS ?flowDirection) + + #BIND(IF( ?aggregation = eme:average, seas:AggregationEvaluation, ?empty) AS ?aggregationEvaluation) + + BIND(IF( ?duration ="PT15M"^^xsd:duration ,eme:fifteenMinute , ?empty) AS ?durationyTarget) + BIND(STRBEFORE(str(?value), " ") AS ?newvalue) +} \ No newline at end of file