Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consumer grade sensor example. #196

Open
wants to merge 35 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
be61f9a
Part One of examples.
Feb 22, 2024
25d3264
Moved informative examples to informativeExamples/
Feb 23, 2024
8f524da
Moved files to new informativeExamples directory and make URI's a bit…
Feb 23, 2024
9834cdb
Changed 'thisSensor' URL pattern to '12345/Sensor' to better communic…
Feb 29, 2024
bcf910a
Fixed stale reference to thisHumiditySensor andthisTemperatureSensor.…
Feb 29, 2024
09e5172
This is a game called 'I cannot type properly.'
Feb 29, 2024
3417776
Sensor as a deployment example.
Feb 29, 2024
8ec21e6
Start of documentation eye-candy.
Feb 29, 2024
643bd84
Missing date on CoolerMonitoringProcess
Feb 29, 2024
d7d333d
Resolves swapping of featureOfInterest and Property. Thanks @ldesousa
Feb 29, 2024
29c1ff3
Resolves 12345/BatteryHealth vs 2024/02/batteryPack . Thanks @ldesousa
Feb 29, 2024
09520de
Resolves URL name and geometry confusion. Thanks @ldesousa
Feb 29, 2024
4be4102
Changed example to record direct properties and features of the produ…
Mar 7, 2024
2383fec
English spelling, not French.
Mar 13, 2024
bf491fa
Ensure six pack uri makes sense.
Mar 13, 2024
7a8b64d
Fix error with airTemperature being where airRelativeHumidity should be
Mar 13, 2024
ef5ce61
Fix properties as instances as per @ldesousa's comments.
Mar 13, 2024
8f8cc10
Fix error with Truch being Location instead of used.
Mar 14, 2024
7aaaa3b
Hook for informative example section.
Mar 14, 2024
63ea11d
More changes in narrative for discussion.
Mar 14, 2024
f60e99e
Further work on narrative.
Mar 14, 2024
625951a
Commit before merge
Mar 18, 2024
e7a4eec
Pre merge
Mar 18, 2024
a63508c
More additions to the text and fixes to examplar,
Mar 18, 2024
31c9946
Fix identifiers and temperature samples. Thanks @hylkevds
Mar 20, 2024
b01aed5
Add section on deployment and collections.
Mar 20, 2024
a6f36fa
Major cleanup; first full draft.
Mar 20, 2024
01ec23d
Change all ssn: namespaces to sosa: namespaces.
Mar 21, 2024
266f7af
Fix instance URLs.
Mar 23, 2024
fe8fcaa
Ready for another round of review.
Mar 25, 2024
626f986
Reference common modeling section.
Mar 26, 2024
088961c
Change ssn-system:qualityOfObservation to sosa:resultQuality
Mar 27, 2024
45bb884
Changes according to comments from @ldesousa.
May 15, 2024
a613a63
Merge branch 'gh-pages' into sensor-owner
dr-shorthair May 29, 2024
a4808b7
Merge branch 'dht22-ex9-changes' into sensor-owner
dr-shorthair May 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions ssn/integrated/informativeExamples/InkBird-IBS-TH2-deployment.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@prefix unit: <http://qudt.org/vocab/unit/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix schema: <http://schema.org/> .
@prefix gs1: <https://gs1.org/voc/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rel: <http://id.loc.gov/vocabulary/relators/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix equipment: <https://rdf.ag/o/equipment/> .
@prefix geosparql: <http://www.opengis.net/ont/geosparql#> .
@prefix org: <http://www.w3.org/ns/org#> .
@prefix beer: <https://rdf.ag/o/beer#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix sosa: <http://www.w3.org/ns/sosa/> .
@prefix ssn: <http://www.w3.org/ns/ssn/> .
@prefix ssn-system: <http://www.w3.org/ns/ssn/systems/> .
@prefix ex: <http://example.org/> .

@base <http://example.org/data/> .

# This example represents the same data using deployments on platforms, which can make
# the modeling a bit more intuitive.


# Alice packaged the sensor in the box.

<acmePorterSixPackDeployment> a prov:Activity, ssn:Deployment;
oldskeptic marked this conversation as resolved.
Show resolved Hide resolved
prov:startedAtTime "2024-02-20T01:35:00Z"^^xsd:dateTime;
prov:wasAssociatedWith <alice> ;
ssn:deployedOnPlatform <00001/acmePorterSixPack> ;
ssn:deployedSystem <12345/someTH2> ;
ssn:forProperty <12345/BatteryHealth>, <BeerTemperature>, <airRelativeHumidityInProductPackaging>;
prov:generated <observation1a>, <observation1b>, <observation1c> ;
prov:generated <observation67a>, <observation67b>, <observation67c> ;
prov:generated <observation98a>, <observation98b>, <observation98c> .

# Beer in the cooler.

<acmeCoolerDeployment> a prov:Activity, ssn:Deployment;
prov:startedAtTime "2024-02-20T01:35:00Z"^^xsd:dateTime;
prov:endedAtTime "2024-02-20T01:40:00Z"^^xsd:dateTime;
ssn:deployedOnPlatform <acmeBrewerCooler> ;
ssn:deployedSystem <12345/someTH2> ;
ssn:forProperty <12345/BatteryHealth>, <BeerTemperature>, <airRelativeHumidityInProductPackaging>;
prov:generated <observation1a>, <observation1b>, <observation1c> .

# Beer in the delivery truck.

<acmeTruckDeployment> a prov:Activity, ssn:Deployment;
prov:startedAtTime "2024-02-22T04:15:05Z"^^xsd:dateTime ;
prov:endedAtTime "2024-02-22T05:55:38Z"^^xsd:dateTime ;
ssn:deployedOnPlatform <acmeTruck> ;
ssn:deployedSystem <12345/someTH2> ;
ssn:forProperty <12345/BatteryHealth>, <BeerTemperature>, <airRelativeHumidityInProductPackaging>;
prov:generated <observation67a>, <observation67b>, <observation67c> .

# Beer in the supermarket cooler.

<acmeSupermarketCoolerDeployment> a prov:Activity, ssn:Deployment;
rdfs:comment "Smart cooler monitoring system" ;
prov:startedAtTime "2024-02-22T06:00:13Z"^^xsd:dateTime ;
ssn:deployedOnPlatform <acmeSupermarketCooler> ;
ssn:deployedSystem <12345/someTH2> ;
ssn:forProperty <12345/BatteryHealth>, <BeerTemperature>, <airRelativeHumidityInProductPackaging>;
prov:generated <observation98a>, <observation98b>, <observation98c> .


250 changes: 250 additions & 0 deletions ssn/integrated/informativeExamples/InkBird-IBS-TH2-instance.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@prefix unit: <http://qudt.org/vocab/unit/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix schema: <http://schema.org/> .
@prefix gs1: <https://gs1.org/voc/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix rel: <http://id.loc.gov/vocabulary/relators/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix equipment: <https://rdf.ag/o/equipment/> .
@prefix geosparql: <http://www.opengis.net/ont/geosparql#> .
@prefix org: <http://www.w3.org/ns/org#> .
@prefix beer: <https://rdf.ag/o/beer#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix sosa: <http://www.w3.org/ns/sosa/> .
@prefix ssn: <http://www.w3.org/ns/ssn/> .
@prefix ssn-system: <http://www.w3.org/ns/ssn/systems/> .
@prefix ex: <http://example.org/> .

@base <http://example.org/data/> .

# This example represents a specific InkBird IBS-TH2 sensor that is performing
# measurements in multiple locations where the results are owned by different
# entities.
#
#
# In the scenario used here a local brewery makes use of the sensor to track the
# temperature of their beer as it is packaged, stored, shipped and displayed for sale.


<acmeBreweryCo> a org:Organization, beer:Brewery ;
foaf:name "Acme Brewery Co." .

<acmeBrewerCooler> a equipment:Cooler .

<alice> a foaf:Person, prov:Agent ;
foaf:name "Alice" .

<acmeDelivery> a org:Organization ;
foaf:name "Acme Delivery Co." .

<acmeTruck> a ex:RefrigeratedTruck .

<acmeSupermarket> a <org:Organization> ;
foaf:name "Acme Supermarket Co." .

<acmeSupermarketCooler> a <equipment:Cooler> .
# A specific (instance) six pack of Acme Porter Beers
<PO202402/acmePorterSixPack> a beer:Porter, gs1:Product ;
gs1:hasBatchLotNumber "PO202402" .

# A sample of air within the six pack
<PO202402/acmePorterSixPackAirSample> a sosa:Sample ;
rdfs:label "Air within the six pack"@en ;
sosa:isSampleOf <PO202402/acmePorterSixPack> .

# Alice packages the Beer.

<12345/someTH2> a equipment:InkBird-IBS-TH2 ;
rel:own <acmeBreweryCo> ; # Sensor may be returned.
rdfs:label "InkBird Sensor that Alice bought to track beer storage."@en ;
sosa:hosts <12345/BatterySensor>, <12345/HumiditySensor>, <12345/TemperatureSensor> ;
gs1:hasSerialNumber "12345" ;
equipment:deviceAddress "12:34:56:12:34:56" .

<00001/packingSixPack> a prov:Activity ;
rdfs:comment "When Alice packaged Porter bottles into the box, she added a InkBird logger to check that the beer wasn't getting too warm in transit and storage." ;
prov:wasAssociatedWith <alice> ;
prov:used <12345/someTH2> ;
prov:startedAtTime "2024-02-20T01:35:00Z"^^xsd:dateTime;
prov:endedAtTime "2024-02-20T01:40:00Z"^^xsd:dateTime;
prov:atLocation <acmeBreweryCo> ;
prov:generated <PO202402/acmePorterSixPack> .

# These definitions look redundant; but they represent the specific, physical instantiation of the sensors.


# Batteries are a consumable component of the platform and must be replaced from time to time. Since the
# battery health sensor is observing a new battery pack each time it is replaced, we create a new digital
# twin to be related to the observation. This means that device power consumption and the performance of
# different battery brands can also be analyzed.

<2024/02/batteryPack> a equipment:IBSTH2Battery;
rdfs:label "IBSTH2 Battery. 2 AAA Batteries. 3.0V Nominal."@en ;
skos:editorialNote "Alice doesn't quite believe the battery lifetime claims, so she's tracking every set of batteries she uses and a new battery instances is generated each time." ;
gs1:brand <AcmeBatteryBrand> ;
gs1:hasBatchLotNumber "OO23" ; # It was written on the side of the package.
dcterms:created "2024-02-20T01:35:45Z"^^xsd:dateTime .

<AcmeBatteryBrand> a gs1:Brand ;
rdfs:label "Acme Branded Battery"@en ;
gs1:brandName "Acme"@en .

<12345/BatterySensor> a equipment:IBSTH2BatteryVoltageSensor;
oldskeptic marked this conversation as resolved.
Show resolved Hide resolved
rdf:comment "This is the instance of the physical sensor instance."@en ;
sosa:observes <12345/BatteryHealth> .

<12345/BatteryHealth> a equipment:IBSTH2BatteryHealth ;
ssn:isPropertyOf <2024/02/batteryPack> .

<12345/HumiditySensor> a equipment:IBSTH2HumiditySensor ;
rdf:comment "This is the instance of the humidity sensor instance."@en .

<12345/TemperatureSensor> a equipment:IBSTH2TemperatureSensor ;
rdf:comment "This is the instance of the temperature sensor instance."@en .

<PO202402/airRelativeHumidityInProductPackaging> a equipment:airRelativeHumidity, sosa:ObservableProperty;;
schema:unitCode unit:PERCENT ;
ssn:isPropertyOf <PO202402/acmePorterSixPack> ;
rdfs:label "Humidité relative de l'emballage du produit"@fr, "Relative Humidity of Product Packaging"@en, "Relative Luftfeuchtigkeit der Produktverpackung"@de ;
skos:definition "The amount of water vapor present in air around the product packaging"@en .

<PO202402/BeerTemperature> a sosa:ObservableProperty;
schema:unitCode unit:DEG_C ;
ssn:isPropertyOf <PO202402/acmePorterSixPack> ;
rdfs:label "Biertemperatur"@de, "Beer Temperature"@en, "Température de la bière"@fr ;
skos:definition "Temperature of the Beer in carton."@en .

#
# Sensor activates and records temperature while in the brewery cooler.

<observation1a> a sosa:Observation ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good. However, I would rather have each of the subjects declared above as instances of SOSA classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ldesousa Please review?

Copy link
Collaborator

@dr-shorthair dr-shorthair May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also prefer the a-box data to be implemented as individuals rather than as classes.

But I guess we are in part-number vs serial-number territory here, datasheet vs deployed sensor, etc.
Not sure there is a single answer.

rel:own <acmeBreweryCo> ;
sosa:observedProperty equipment:airTemperature ;
sosa:hasUltimateFeatureOfInterest <PO202402/BeerTemperature> ;
sosa:madeBySensor <12345/TemperatureSensor> ;
sosa:hasFeatureOfInterest <PO202402/acmePorterSixPackAirSample> ;
sosa:resultTime "2024-02-20T01:35:45Z"^^xsd:dateTime ;
sosa:hasSimpleResult "12"^^unit:DEG_C .

<observation1b> rdf:type sosa:Observation ;
rel:own <acmeBreweryCo> ;
sosa:observedProperty equipment:airRelativeHumidity ;
sosa:hasUltimateFeatureOfInterest <PO202402/airRelativeHumidityInProductPackaging> ;
sosa:madeBySensor <12345/HumiditySensor> ;
sosa:hasFeatureOfInterest <PO202402/acmePorterSixPackAirSample> ;
sosa:resultTime "2024-02-20T01:35:45Z"^^xsd:dateTime ;
sosa:hasSimpleResult "60"^^unit:PERCENT .

# The battery is a special case because it's property is linked to the battery, not to the environment.

<observation1c> rdf:type sosa:Observation ;
rel:own <acmeBreweryCo> ;
sosa:observedProperty <12345/BatteryHealth> ;
sosa:madeBySensor <12345/BatterySensor> ;
sosa:hasFeatureOfInterest <2024/02/batteryPack> ;
sosa:resultTime "2024-02-20T01:35:45Z"^^xsd:dateTime ;
sosa:hasSimpleResult "99"^^unit:PERCENT .

<breweryObserver> a prov:Activity ;
rdfs:comment "Brewery operating system logging process." ;
prov:atLocation <acmeBreweryCo> ;
prov:generated <observation1a> ;
prov:generated <observation1b> ;
prov:generated <observation1c> ;
prov:wasStartedBy <alice> . # She turned it on last time.

#
# Product is loaded on the truck
#


<observation67a> a sosa:Observation, prov:Entity ;
rel:own <acmeBreweryCo> ;
rel:own <acmeDelivery> ;
sosa:observedProperty equipment:airTemperature ;
sosa:hasUltimateFeatureOfInterest <PO202402/BeerTemperature> ;
sosa:madeBySensor <12345/TemperatureSensor> ;
sosa:hasFeatureOfInterest <PO202402/acmePorterSixPackAirSample> ;
sosa:resultTime "2024-02-22T04:15:05Z"^^xsd:dateTime ;
sosa:hasSimpleResult "19"^^unit:DEG_C .

<observation67b> rdf:type sosa:Observation,prov:Entity ;
rel:own <acmeBreweryCo> ;
rel:own <acmeDelivery> ;
sosa:observedProperty equipment:airRelativeHumidity ;
sosa:hasUltimateFeatureOfInterest <PO202402/airRelativeHumidityInProductPackaging> ;
sosa:madeBySensor <12345/HumiditySensor> ;
sosa:hasFeatureOfInterest <PO202402/acmePorterSixPackAirSample> ;
sosa:resultTime "2024-02-22T04:15:05Z"^^xsd:dateTime ;
sosa:hasSimpleResult "74"^^unit:PERCENT .

<observation67c> rdf:type sosa:Observation,prov:Entity ;
rel:own <acmeBreweryCo> ;
rel:own <acmeDelivery> ;
sosa:observedProperty <12345/BatteryHealth>;
sosa:madeBySensor <12345/BatterySensor> ;
sosa:hasFeatureOfInterest <2024/02/batteryPack> ;
sosa:resultTime "2024-02-22T04:15:05Z"^^xsd:dateTime ;
sosa:hasSimpleResult "99"^^unit:PERCENT .

<TruckObserver> a prov:Activity ;
rdfs:comment "Truck onboard monitoring system" ;
prov:atLocation <acmeTruck> ;
prov:generated <observation67a> ;
prov:generated <observation67b> ;
prov:generated <observation67c> ;
prov:startedAtTime "2024-02-22T04:15:05Z"^^xsd:dateTime ;
prov:endedAtTime "2024-02-22T05:55:38Z"^^xsd:dateTime ;
prov:wasStartedBy <driver> ;
prov:atLocation <gpsLocation> .

# This is the output from the truck's GPS receiver. We only get coordinates
# from it.

<gpsLocation> a prov:Location, geosparql:Geometry;
geosparql:asWKT "POINT(-79.35553 43.66372)"^^geosparql:wktLiteral .

#
# Product is now in display cooler at supermarket. Ownership of product has
# changed and observation data is now only being recorded / owned by supermarket.
#

<observation98a> rdf:type sosa:Observation,prov:Entity ;
rel:own <acmeSupermarket> ;
sosa:observedProperty equipment:airTemperature ;
sosa:hasUltimateFeatureOfInterest <PO202402/BeerTemperature> ;
sosa:madeBySensor <12345/TemperatureSensor> ;
sosa:hasFeatureOfInterest <PO202402/acmePorterSixPackAirSample> ;
sosa:resultTime "2024-02-22T06:00:13Z"^^xsd:dateTime ;
sosa:hasSimpleResult "12"^^unit:DEG_C .

<observation98b> rdf:type sosa:Observation,prov:Entity ;
rel:own <acmeSupermarket> ;
sosa:observedProperty equipment:airRelativeHumidity ;
sosa:hasUltimateFeatureOfInterest <PO202402/airRelativeHumidityInProductPackaging> ;
sosa:madeBySensor <12345/HumiditySensor> ;
sosa:hasFeatureOfInterest <PO202402/acmePorterSixPackAirSample> ;
sosa:resultTime "2024-02-22T06:00:13Z"^^xsd:dateTime ;
sosa:hasSimpleResult "55"^^unit:PERCENT .

<observation98c> rdf:type sosa:Observation,prov:Entity ;
rel:own <acmeSupermarket> ;
sosa:observedProperty <12345/BatteryHealth>;
sosa:madeBySensor <12345/BatterySensor> ;
sosa:hasFeatureOfInterest <2024/02/batteryPack> ;
sosa:resultTime "2024-02-22T06:00:13Z"^^xsd:dateTime ;
sosa:hasSimpleResult "99"^^unit:PERCENT .

<CoolerMonitoringProcess> a prov:Activity ;
rdfs:comment "Smart cooler monitoring system" ;
prov:startedAtTime "2024-02-22T06:00:13Z"^^xsd:dateTime ;
prov:atLocation <acmeSupermarketCooler> ;
prov:generated <observation98a> ;
prov:generated <observation98b> ;
prov:generated <observation98c> ;
prov:wasStartedBy <acmeSupermarket> .
Loading