SPARQL-Stream: Ontology-based Access to Data Streams

In our approach, queries are specified in terms of the classes and properties of an ontology using SPARQLStream, an extension of SPARQL that supports operators over RDF streams. We define an RDF stream as a sequence of pairs (T; Tau) where T is an RDF triple <s; p; o> and Tau is a timestamp which comes from a monotonically non-decreasing sequence. An RDF stream is identified by an IRI, which provides the location of the data source.

Window definitions are of the form `FROM Start TO End [STEP] [Literal ]', where the Start and End are of the form ‘NOW’ or ‘NOW  - Literal’, and Literal represents some number of time unit (DAYS, HOURS, MINUTES, or SECONDS).

The optional STEP indicates the gap between each successive window evaluation.

Note, if the size of the step is smaller than the range of the window, then the windows will overlap, if it coincides with the size of the window then every triple will appear in one and only one window, and if the step is larger than the range then the windows sample the stream. Also note that the definition of a window can be completely in the past. This is useful for correlating current values on a stream with values that have previously occurred.

The result of applying a window over a stream is a timestamped bag of triples over which conjunctions between triple patterns, and other “classical" operators can be evaluated. Windows can be converted back into a stream of triples by applying one of the window-to-stream operators in the SELECT clause: ISTREAM for returning all newly inserted answers since the last window, DSTREAM for returning all deleted answers since the last window, and RSTREAM for returning all answers in the window.

Example: "provide me with the wind speed observations over the last minute in the Solent Region"

sparqlstream

sparqlstream PREFIX cd: <http://www.semsorgrid4env.eu/ontologies/CoastalDefences.owl#>
PREFIX sb: <http://www.w3.org/2009/SSN-XG/Ontologies/SensorBasis.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT  ?waveheight ?wavets  ?lat ?lon
FROM STREAM <http://www.semsorgrid4env.eu/ccometeo.srdf>
[ NOW – 1 MINUTE TO NOW – 0 MINUTES ]  
WHERE
{
?WaveObs a cd:Observation;
    cd:observationResult ?waveheight;
    cd:observationResultTime ?wavets;
    cd:observationResultLatitude ?lat;
    cd:observationResultLongitude ?lon;
    cd:observedProperty ?waveProperty;
    cd:featureOfInterest ?waveFeature.   
?waveFeature a cd:Feature;
    cd:locatedInRegion cd:SouthEastEnglandCCO.
?waveProperty a cd:WaveHeight.
}
 
SemSorGrid4Env - Semantic Sensor Grids for Rapid Application Development for Environmental Management
SemSorGrid4Env is a joint project of seven European partners co-funded by the European Commission's Seventh Framework Programme
under DG INFSO H.4 "ICT for Sustainable Growth", starting in September 2008 with a duration of three years.