Data Acquisition Module API - landrs-toolkit/landrs-drone-TOAST GitHub Wiki
Concept
The TOAST testbed provides an integrated Data Acquisition Module to generate data for development purposes. Drone developers who want to use TOAST could leverage their existing Data Acquisition Backend if there existed a suitable API specification. This would leave the user to solve the problem of converting the data in their internal storage to RDF triples. An example of using TARQL to produce RDF triples from a CSV produced from a drone flight can be found at https://github.com/charlesvardeman/SOSA_K30sensor.
Approach
To test the idea of external Data Acquisition Modules the TOAST framework was modified to call its integrated Data Acquisition Module via an API thus potentially allowing one instance of TOAST to emulate a Data Acquisition Module (DAM) for a second instance of TOAST. A branch data_aquire_separate was created for this purpose.
API
The API provides an additional endpoint to access the DAM
/api/v1/data_acquisition
The endpoint consumes JSON packages for multiple functions.
Initialize DAM
Use the set_oc_sensor action to initialize the system. This should include the Observation Collection URI, the list of sensors to be read and metadata for the sensor. We also include the URI for the dataset or storage graph.
{
'action': 'set_oc_sensor',
'observation_collection': 'http://127.0.0.1:5001/id/EgMMy6zHRUS7kqPk3Y3P6w',
'sensors': [{
'sensor': 'http://127.0.0.1:5001/id/CfJDfMLMTu2ZcfMcGADlYg'
}],
'dataset': 'http://127.0.0.1:5001/id/XQJKHWwFTcWM76PTCXuKOw',
'instance_data': {
'sensor': {
'units': 'http://qudt.org/1.1/vocab/unit#PPM',
'id': 'CO2-1431'
}
}
}
Select Mavlink comms port
{'action': 'setport', 'comms_ports': '/dev/ttyACM0'}
Start acquiring data
{'action': 'start'}
Stop acquiring data
{'action': 'stop'}
Accessing Data
URIs
The data can be accessed via its URI, for TOAST the API endpoint is
/id
So, for example, accessing a dataset with UUID Fa1lQbpvTPmou1p6BTQjzw as turtle,
http://192.168.0.120:5000/id/Fa1lQbpvTPmou1p6BTQjzw
yields,
@base <http://127.0.0.1:5000/> .
@prefix geosparql: <http://www.opengis.net/ont/geosparql#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix qudt-1-11: <http://qudt.org/1.1/schema/qudt#> .
@prefix sosa: <http://www.w3.org/ns/sosa/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<id/g_60ru4NTa2FjftCq9SgCQ> a sosa:ObservationCollection ;
prov:endedAtTime "2021-02-24T15:31:20.783815"^^xsd:dateTime ;
prov:startedAtTime "2021-02-24T15:31:00.746486"^^xsd:dateTime ;
sosa:hasMember <id/AW2fm7W9SaehP3stSOCdTg>,
<id/eOFRZhxLQnCc5FWabwvEmQ>,
<id/uxqTFxk-SdSPaOmYI67hag> ;
sosa:madeBySensor <http://127.0.0.1:5001/id/CfJDfMLMTu2ZcfMcGADlYg> .
<id/AW2fm7W9SaehP3stSOCdTg> a sosa:Observation ;
sosa:hasResult [ a qudt-1-11:QuantityValue ;
qudt-1-11:numericValue 3.717e+02 ;
qudt-1-11:unit "http://qudt.org/1.1/vocab/unit#PPM"^^qudt-1-11:unit ;
geosparql:hasGeometry [ a geosparql:Geometry ;
geosparql:asWKT "POINT(41.689377 -86.175294 407.85)"^^geosparql:wktLiteral ] ] ;
sosa:madeBySensor <http://127.0.0.1:5001/id/CfJDfMLMTu2ZcfMcGADlYg> ;
sosa:resultTime [ a xsd:dateTime ;
xsd:dateTimeStamp "2021-02-24T15:31:10.749641"^^xsd:dateTime ] .
<id/eOFRZhxLQnCc5FWabwvEmQ> a sosa:Observation ;
sosa:hasResult [ a qudt-1-11:QuantityValue ;
qudt-1-11:numericValue 4.173e+02 ;
qudt-1-11:unit "http://qudt.org/1.1/vocab/unit#PPM"^^qudt-1-11:unit ;
geosparql:hasGeometry [ a geosparql:Geometry ;
geosparql:asWKT "POINT(41.6893779 -86.1753054 407.6)"^^geosparql:wktLiteral ] ] ;
sosa:madeBySensor <http://127.0.0.1:5001/id/CfJDfMLMTu2ZcfMcGADlYg> ;
sosa:resultTime [ a xsd:dateTime ;
xsd:dateTimeStamp "2021-02-24T15:31:00.746486"^^xsd:dateTime ] .
<id/uxqTFxk-SdSPaOmYI67hag> a sosa:Observation ;
sosa:hasResult [ a qudt-1-11:QuantityValue ;
qudt-1-11:numericValue 4.373e+02 ;
qudt-1-11:unit "http://qudt.org/1.1/vocab/unit#PPM"^^qudt-1-11:unit ;
geosparql:hasGeometry [ a geosparql:Geometry ;
geosparql:asWKT "POINT(41.6893745 -86.17527899999999 407.94)"^^geosparql:wktLiteral ] ] ;
sosa:madeBySensor <http://127.0.0.1:5001/id/CfJDfMLMTu2ZcfMcGADlYg> ;
sosa:resultTime [ a xsd:dateTime ;
xsd:dateTimeStamp "2021-02-24T15:31:20.783815"^^xsd:dateTime ] .
SPARQL
SPARQL queries can also be used via the API endpoint,
/api/v1/sparql
Alternatively a Yasgui interface is hosted via TOAST at,
/sparql