Difference between revisions of "SRBench"

From W3C Wiki
Jump to: navigation, search
(Benchmark Queries)
m (added ref)
 
Line 6: Line 6:
 
SRBench is a Streaming RDF/SPARQL Benchmark that aims at assessing the abilities of streaming RDF/SPARQL engines in dealing with important features from both DSMSs and Semantic Web research areas combined in one read-world application scenario.
 
SRBench is a Streaming RDF/SPARQL Benchmark that aims at assessing the abilities of streaming RDF/SPARQL engines in dealing with important features from both DSMSs and Semantic Web research areas combined in one read-world application scenario.
 
That is, how well can a system cope with a broad range of different query types in which Semantic Web technologies, including querying, interlinking, sharing and reasoning, are applied on highly dynamic streaming RDF data.
 
That is, how well can a system cope with a broad range of different query types in which Semantic Web technologies, including querying, interlinking, sharing and reasoning, are applied on highly dynamic streaming RDF data.
The benchmark can help both researchers and users to compare streaming RDF/SPARQL engines in a pervasive application scenario that in our daily life, i.e., querying and deriving information from weather stations.
+
The benchmark can help both researchers and users to compare streaming RDF/SPARQL engines in a pervasive application scenario that in our daily life, i.e., querying and deriving information from weather stations. [1]
 
+
  
 
==Benchmark Queries==
 
==Benchmark Queries==
Line 1,344: Line 1,343:
 
}
 
}
 
</pre>
 
</pre>
 +
 +
[1] SRBench: A Streaming RDF/SPARQL Benchmark. Y. Zhang, M.-D. Pham, O. Corcho and J.-P. Calbimonte. In Proc. of the 11th International Semantic Web Conference ISWC 2012. Boston, USA, Nov 2012.

Latest revision as of 17:51, 29 March 2013

Streaming RDF/SPARQL Benchmark (SRBench) - Version 0.9

Introduction

SRBench is a Streaming RDF/SPARQL Benchmark that aims at assessing the abilities of streaming RDF/SPARQL engines in dealing with important features from both DSMSs and Semantic Web research areas combined in one read-world application scenario. That is, how well can a system cope with a broad range of different query types in which Semantic Web technologies, including querying, interlinking, sharing and reasoning, are applied on highly dynamic streaming RDF data. The benchmark can help both researchers and users to compare streaming RDF/SPARQL engines in a pervasive application scenario that in our daily life, i.e., querying and deriving information from weather stations. [1]

Benchmark Queries

SRBench currently defines 17 queries. By lacking of a standard SPARQL language for streaming data, we define the queries in a descriptive way. To give a more precise definition of the queries, and to first conduct a functional evaluation, we have implemented the benchmark queries in three flavours of SPARQL extensions for streaming (RDF) data. The queries below are implemented according to the syntax specified by the systems. Some of the queries do not run, due to features that are not implemented in the query processing engine.

Q1. Get the rainfall observed once in an hour.

Query description

This is a basic but important query. It tests an engines ability to handle the most basic feature of RDF/SPARQL to gain knowledge about the mostly spoken topic when talking about the weather.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>

SELECT DISTINCT ?sensor ?value ?uom
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 1 HOURS]
WHERE {
  ?observation om-owl:procedure ?sensor ;
               a weather:RainfallObservation ;
               om-owl:result ?result .
  ?result om-owl:floatValue ?value ;
          om-owl:uom ?uom .
}

CQELS Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>

SELECT DISTINCT ?sensor ?value ?uom
WHERE {
  STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 3600s]
            
  {?observation om-owl:procedure ?sensor ;
               a weather:RainfallObservation ;
               om-owl:result ?result}
  {?result om-owl:floatValue ?value ;
          om-owl:uom ?uom }
}

C-SPARQL Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>

SELECT DISTINCT ?sensor ?value ?uom
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1h TUMBLING]
WHERE {
  {?observation om-owl:procedure ?sensor ;
               a weather:RainfallObservation ;
               om-owl:result ?result}
  {?result om-owl:floatValue ?value ;
          om-owl:uom ?uom }
}

Q2. Get all precipitation observed once in an hour.

Query description

Although similar to Q1, this query is much more complex, because it requires re- turning all types of precipitation. Since the triple patterns for different kinds of precipitations maybe different, OPTIONAL patterns are needed to capture the possible differences. Additionally, this query requires reasoning over all instances of the class PrecipitationObservation and its subclasses.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>

SELECT DISTINCT ?sensor ?value ?uom
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 1 HOURS]
WHERE {
  ?observation om-owl:procedure ?sensor ;
               rdf:type/rdfs:subClassOf* weather:PrecipitationObservation ;
               om-owl:result ?result .
  ?result ?p1 ?value .
  OPTIONAL {
    ?result ?p2 ?uom .
  }
}

CQELS Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>

SELECT DISTINCT ?sensor ?value ?uom
WHERE {
  STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 3600s]
  {?observation om-owl:procedure ?sensor ;
               rdf:type/rdfs:subClassOf* weather:PrecipitationObservation ;
               om-owl:result ?result .
  ?result ?p1 ?value .}
  FILTER( REGEX(STR(?p1), "value", "i") )
  OPTIONAL {
    ?result ?p2 ?uom .
    FILTER( REGEX(STR(?p2), "uom", "i") )
  }
}

C-SPARQL Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>

SELECT DISTINCT ?sensor ?value ?uom
FROM STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1h TUMBLING]
WHERE {
  ?observation om-owl:procedure ?sensor ;
               rdf:type/rdfs:subClassOf* weather:PrecipitationObservation ;
               om-owl:result ?result .
  ?result ?p1 ?value .
  FILTER( REGEX(STR(?p1), "value", "i") )
  OPTIONAL {
    ?result ?p2 ?uom .
    FILTER( REGEX(STR(?p2), "uom", "i") )
  }
}

Q3. Detect if a hurricane has been observed.

Query description

A hurricane has a sustained wind (for more than 3 hours) of at least 33 metres per second or 74 miles per hour (119 km/h). One might want to know if there are any extreme weather conditions among the observations. This query tests the engines ability to filter out the minimal amount of the streaming data to quickly compute the answer.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

ASK
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
            [NOW - 3 HOURS SLIDE 10 MINUTES]
WHERE {
  ?observation om-owl:procedure ?sensor ;
               om-owl:observedProperty weather:WindSpeed ;
               om-owl:result [ om-owl:floatValue ?value ] .
}
GROUP BY ?sensor
HAVING ( AVG(?value) >= "74"^^xsd:float ) #milesPerHour

CQELS Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

ASK
WHERE {
STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 10800s SLIDE 600s]
  {?observation om-owl:procedure ?sensor ;
               om-owl:observedProperty weather:WindSpeed ;
               om-owl:result [ om-owl:floatValue ?value ] .}
}              
GROUP BY ?sensor
HAVING ( AVG(?value) >= "74"^^xsd:float ) #milesPerHour

C-SPARQL Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

ASK
FROM STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1h STEP 10m]
WHERE {
  ?observation om-owl:procedure ?sensor ;
               om-owl:observedProperty weather:WindSpeed ;
               om-owl:result [ om-owl:floatValue ?value ] .
}              
GROUP BY ?sensor
HAVING ( AVG(?value) >= "74"^^xsd:float ) 

Q4. Get the average wind speed at the stations where the air temperature is >32 degrees in the last hour, every 10 minutes.

Query description

Combine values observed for multiple weather properties. This query tests the engines ability to deal with history data that need to be (temporarily) stored.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?sensor (AVG(?windSpeed) AS ?averageWindSpeed)
               (AVG(?temperature) AS ?averageTemperature)
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
            [NOW - 1 HOURS SLIDE 10 MINUTES]
WHERE {
  ?temperatureObservation om-owl:procedure ?sensor ;
                          a weather:TemperatureObservation ;
                          om-owl:result ?temperatureResult .
  ?temperatureResult om-owl:floatValue ?temperature ;
                     om-owl:uom ?uom .
  FILTER(?temperature > "32"^^xsd:float)
  ?windSpeedObservation om-owl:procedure ?sensor ;
                        a weather:WindSpeedObservation ;
                        om-owl:result [ om-owl:floatValue ?windSpeed ]  .
}
GROUP BY ?sensor

CQELS Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?sensor (AVG(?windSpeed) AS ?averageWindSpeed)
               (AVG(?temperature) AS ?averageTemperature)
WHERE {
STREAM <http://www.cwi.nl/SRBench/observations>
            [RANGE 3600s SLIDE 600s]{
  ?temperatureObservation om-owl:procedure ?sensor ;
                          a weather:TemperatureObservation ;
                          om-owl:result ?temperatureResult .
  ?temperatureResult om-owl:floatValue ?temperature ;
                     om-owl:uom ?uom .
  ?windSpeedObservation om-owl:procedure ?sensor ;
                        a weather:WindSpeedObservation ;
                        om-owl:result [ om-owl:floatValue ?windSpeed ]  .}
FILTER(?temperature > "32"^^xsd:float && REGEX(STR(?uom), "fahrenheit", "i"))
}
GROUP BY ?sensor

C-SPARQL Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?sensor (AVG(?windSpeed) AS ?averageWindSpeed)
               (AVG(?temperature) AS ?averageTemperature)
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
            [RANGE 1h STEP 10m]
WHERE {     
  ?temperatureObservation om-owl:procedure ?sensor ;
                          a weather:TemperatureObservation ;
                          om-owl:result ?temperatureResult .
  ?temperatureResult om-owl:floatValue ?temperature ;
                     om-owl:uom ?uom .
  FILTER(?temperature > "32"^^xsd:float && REGEX(STR(?uom), "fahrenheit", "i"))
  ?windSpeedObservation om-owl:procedure ?sensor ;
                        a weather:WindSpeedObservation ;
                        om-owl:result [ om-owl:floatValue ?windSpeed ]  .
}
GROUP BY ?sensor

Q5. Detect if a station is observing a blizzard.

Query description

A blizzard is a severe snow storm characterised by low temperatures, strong winds and heavy snow lasting for at least three hours. Detect extreme weather conditions by combining multiple observed weather properties. This query tests the engines ability to produce new knowledge derived by combining existing data.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

CONSTRUCT { ?sensor om-owl:generatedObservation [a weather:Blizzard] }
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
           [NOW - 3 HOURS SLIDE 10 MINUTES]
WHERE {
  { SELECT ?sensor
    WHERE {
      ?sensor om-owl:generatedObservation [a weather:SnowfallObservation] ;
              om-owl:generatedObservation ?o1 ;
              om-owl:generatedObservation ?o2 .
      ?o1 a weather:TemperatureObservation ;
          om-owl:observedProperty weather:_AirTemperature ;
          om-owl:result [om-owl:floatValue ?temperature] .
      ?o2 a weather:WindObservation ;
          om-owl:observedProperty weather:_WindSpeed ;
          om-owl:result [om-owl:floatValue ?windSpeed] .
    }
    GROUP BY ?sensor
    HAVING ( AVG(?temperature) < "32"^^xsd:float  &&  # fahrenheit
             MIN(?windSpeed) > "40.0"^^xsd:float ) #milesPerHour
  }
}

CQELS Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

CONSTRUCT { ?sensor om-owl:generatedObservation [a weather:Blizzard] }
WHERE {
  STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 10800s SLIDE 600s]
  { SELECT ?sensor
    WHERE {
      ?sensor om-owl:generatedObservation [a weather:SnowfallObservation] ;
              om-owl:generatedObservation ?o1 ;
              om-owl:generatedObservation ?o2 .
      ?o1 a weather:TemperatureObservation ;
          om-owl:observedProperty weather:_AirTemperature ;
          om-owl:result [om-owl:floatValue ?temperature] .
      ?o2 a weather:WindObservation ;
          om-owl:observedProperty weather:_WindSpeed ;
          om-owl:result [om-owl:floatValue ?windSpeed] .
    }     
    GROUP BY ?sensor
    HAVING ( AVG(?temperature) < "32"^^xsd:float  &&  # fahrenheit
             MIN(?windSpeed) > "40.0"^^xsd:float ) #milesPerHour
  }          
}

C-SPARQL Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

CONSTRUCT { ?sensor om-owl:generatedObservation [a weather:Blizzard] }
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
           [RANGE 3h STEP 10m]
WHERE {
  { SELECT ?sensor
    WHERE {
      ?sensor om-owl:generatedObservation [a weather:SnowfallObservation] ;
              om-owl:generatedObservation ?o1 ;
              om-owl:generatedObservation ?o2 .
      ?o1 a weather:TemperatureObservation ;
          om-owl:observedProperty weather:_AirTemperature ;
          om-owl:result [om-owl:floatValue ?temperature] .
      ?o2 a weather:WindObservation ;
          om-owl:observedProperty weather:_WindSpeed ; 
          om-owl:result [om-owl:floatValue ?windSpeed] .
    }
    GROUP BY ?sensor
    HAVING ( AVG(?temperature) < "32"^^xsd:float  &&  # fahrenheit
             MIN(?windSpeed) > "40.0"^^xsd:float ) #milesPerHour
  }
}

Q6. Get the stations that have observed extremely low visibility in the last hour.

Query description

Next to direct measurements of low visibility (<10 centimetres), heavy snowfall and rainfall (> 30 centimetres) also cause low visibility. This is a more complex example of detecting extreme weather conditions, which requires not only gaining knowledge explicitly contained in the data, but also deriving implicit knowledge from data sources.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?sensor
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 1 HOURS]
WHERE {
  { ?observation om-owl:procedure ?sensor ;
                 a weather:VisibilityObservation ;
                 om-owl:result [om-owl:floatValue ?value ] .
    FILTER ( ?value < "10"^^xsd:float)  # centimeters
  }
  UNION
  { ?observation om-owl:procedure ?sensor ;
                 a weather:RainfallObservation ;
                 om-owl:result [om-owl:floatValue ?value ] .
    FILTER ( ?value > "30"^^xsd:float)  # centimeters
  }
  UNION
  { ?observation om-owl:procedure ?sensor ;
                 a weather:SnowfallObservation .
  }
}

CQELS Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?sensor
WHERE {
  STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 3600s]{
    { ?observation om-owl:procedure ?sensor ;
                   a weather:VisibilityObservation ;
                   om-owl:result [om-owl:floatValue ?value ] .
      FILTER ( ?value < "10"^^xsd:float)  # centimeters
    }
    UNION
    { ?observation om-owl:procedure ?sensor ;
                   a weather:RainfallObservation ;
                   om-owl:result [om-owl:floatValue ?value ] .
      FILTER ( ?value > "30"^^xsd:float)  # centimeters
    }
    UNION
    { ?observation om-owl:procedure ?sensor ;
                   a weather:SnowfallObservation .
    }
  }
}

C-SPARQL Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?sensor
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1h TUMBLING]
WHERE {
  { ?observation om-owl:procedure ?sensor ;
                 a weather:VisibilityObservation ;
                 om-owl:result [om-owl:floatValue ?value ] . 
    FILTER ( ?value < "10"^^xsd:float)  # centimeters
  }   
  UNION
  { ?observation om-owl:procedure ?sensor ;
                 a weather:RainfallObservation ;
                 om-owl:result [om-owl:floatValue ?value ] . 
    FILTER ( ?value > "30"^^xsd:float)  # centimeters
  }   
  UNION
  { ?observation om-owl:procedure ?sensor ;
                 a weather:SnowfallObservation .
  }   
}

Q7. Detect stations that are recently broken.

Query description

If a station suddenly stops producing (observation) data, it might be broken. Knowing the stability of the stations is an important issue, which can be deduced from absent data. This query tests the engines ability to cope with the dynamic properties that are specific for streaming data.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>

SELECT DSTREAM DISTINCT ?sensor
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 1 HOURS]
WHERE {
  ?sensor om-owl:generatedObservation ?observation .
}

CQELS Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX owl-time: <http://www.w3.org/2006/time#>

SELECT DISTINCT ?sensor
WHERE {
  STREAM <http://www.cwi.nl/SRBench/observations> [NOW TO NOW - 1 HOURS] {
      ?sensor om-owl:generatedObservation ?observation1
  }
  STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 1 HOURS TO NOW - 2 HOURS] {
      FILTER NOT EXISTS { ?sensor om-owl:generatedObservation ?observation2 }
  }
}

C-SPARQL Query

Not supported by the language

Q8. Get the daily minimal and maximal air temperature observed by the sensor at a given location.

Query description

Temperature is the most common weather condition queried. This query tests the engines ability to aggregates data that are grouped by their geo-spatial properties.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ( MIN(?temperature) AS ?minTemperature ) ( MAX(?temperature) AS ?maxTemperature )
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 24 HOURS]
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
  ?sensor om-owl:processLocation ?sensorLocation ;
          om-owl:generatedObservation ?observation .
  ?sensorLocation wgs84_pos:alt "%Altitude%"^^xsd:float ;
                  wgs84_pos:lat "%Latitude%"^^xsd:float ;
                  wgs84_pos:long "%Longitude%"^^xsd:float .
  ?observation om-owl:observedProperty weather:_AirTemperature ;
               om-owl:result [ om-owl:floatValue ?temperature ] .
}
GROUP BY ?sensor

CQELS Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ( MIN(?temperature) AS ?minTemperature ) ( MAX(?temperature) AS ?maxTemperature )
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 86400s]
 { ?sensor om-owl:processLocation ?sensorLocation ;
          om-owl:generatedObservation ?observation .}
  ?sensorLocation wgs84_pos:alt "%Altitude%"^^xsd:float ;
                  wgs84_pos:lat "%Latitude%"^^xsd:float ;
                  wgs84_pos:long "%Longitude%"^^xsd:float .
  ?observation om-owl:observedProperty weather:_AirTemperature ;
               om-owl:result [ om-owl:floatValue ?temperature ] .
}
GROUP BY ?sensor

C-SPARQL Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ( MIN(?temperature) AS ?minTemperature ) ( MAX(?temperature) AS ?maxTemperature )
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1d TUMBLING]
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
  ?sensor om-owl:processLocation ?sensorLocation ;
          om-owl:generatedObservation ?observation .
  ?sensorLocation wgs84_pos:alt "%Altitude%"^^xsd:float ;
                  wgs84_pos:lat "%Latitude%"^^xsd:float ;
                  wgs84_pos:long "%Longitude%"^^xsd:float .
  ?observation om-owl:observedProperty weather:_AirTemperature ;
               om-owl:result [ om-owl:floatValue ?temperature ] .
}
GROUP BY ?sensor

Q9. Get the daily average wind force and direction observed by the sensor at a given location.

Query description

Wind is the other most commonly queries weather condition. The Beaufort Wind Force Scale is an international standard way to express how strong the wind is. It attaches some semantics to the bare wind speed numbers. Since this query requires wind speeds to be converted into Beaufort scales, it tests the engines ability to post process the qualified triple patterns.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ( IF(AVG(?windSpeed) < 1,  0,
          IF(AVG(?windSpeed) < 4,  1,
           IF(AVG(?windSpeed) < 8,  2,
            IF(AVG(?windSpeed) < 13, 3,
             IF(AVG(?windSpeed) < 18, 4,
              IF(AVG(?windSpeed) < 25, 5,
               IF(AVG(?windSpeed) < 31, 6,
                IF(AVG(?windSpeed) < 39, 7,
                 IF(AVG(?windSpeed) < 47, 8,
                  IF(AVG(?windSpeed) < 55, 9,
                   IF(AVG(?windSpeed) < 64, 10,
                    IF(AVG(?windSpeed) < 73, 11, 12) )))))))))))
         AS ?windForce )
       ( AVG(?windDirection) AS ?avgWindDirection )
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 24 HOURS]
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
  ?sensor om-owl:processLocation ?sensorLocation ;
          om-owl:generatedObservation ?o1 ;
          om-owl:generatedObservation ?o2 .
  ?sensorLocation wgs84_pos:alt "%Altitude%"^^xsd:float ;
                  wgs84_pos:lat "%Latitude%"^^xsd:float ;
                  wgs84_pos:long "%Longitude%"^^xsd:float .
  ?o1 om-owl:observedProperty weather:_WindSpeed ;
      om-owl:result [ om-owl:floatValue ?windSpeed ] .
  ?o2 om-owl:observedProperty weather:_WindDirection ;
      om-owl:result [ om-owl:floatValue ?windDirection ] .
}
GROUP BY ?sensor

CQELS Query

Not supported by the language

C-SPARQL Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ( IF(AVG(?windSpeed) < 1,  0,
          IF(AVG(?windSpeed) < 4,  1,
           IF(AVG(?windSpeed) < 8,  2,
            IF(AVG(?windSpeed) < 13, 3,
             IF(AVG(?windSpeed) < 18, 4,
              IF(AVG(?windSpeed) < 25, 5,
               IF(AVG(?windSpeed) < 31, 6,
                IF(AVG(?windSpeed) < 39, 7,
                 IF(AVG(?windSpeed) < 47, 8,
                  IF(AVG(?windSpeed) < 55, 9,
                   IF(AVG(?windSpeed) < 64, 10,
                    IF(AVG(?windSpeed) < 73, 11, 12) )))))))))))
         AS ?windForce )
       ( AVG(?windDirection) AS ?avgWindDirection )
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1d TUMBLING]
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
  ?sensor om-owl:processLocation ?sensorLocation ;
          om-owl:generatedObservation ?o1 ;
          om-owl:generatedObservation ?o2 .
  ?sensorLocation wgs84_pos:alt "%Altitude%"^^xsd:float ;
                  wgs84_pos:lat "%Latitude%"^^xsd:float ;
                  wgs84_pos:long "%Longitude%"^^xsd:float .
  ?o1 om-owl:observedProperty weather:_WindSpeed ;
      om-owl:result [ om-owl:floatValue ?windSpeed ] .
  ?o2 om-owl:observedProperty weather:_WindDirection ;
      om-owl:result [ om-owl:floatValue ?windDirection ] .
}
GROUP BY ?sensor

Q10. Get the locations where a heavy snowfall has been observed in the last day.

Query description

One might want to find places that are suitable for a ski holiday. This query tests the engines ability to join the dynamic sensor streaming data with the static sensor metadata.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>

SELECT DISTINCT ?lat ?long ?alt
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 24 HOURS]
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
  ?sensor om-owl:generatedObservation [a weather:SnowfallObservation] .
  ?sensor om-owl:processLocation ?sensorLocation .
  ?sensorLocation wgs84_pos:alt ?alt ;
                  wgs84_pos:lat ?lat ;
                  wgs84_pos:long ?long .
}

CQELS Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>

SELECT DISTINCT ?lat ?long ?alt
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
  STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 86400s]
  {?sensor om-owl:generatedObservation [a weather:SnowfallObservation] .}
  ?sensor om-owl:processLocation ?sensorLocation .
  ?sensorLocation wgs84_pos:alt ?alt ;
                  wgs84_pos:lat ?lat ;
                  wgs84_pos:long ?long .
}

C-SPARQL Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>

SELECT DISTINCT ?lat ?long ?alt
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1d TUMBLING]
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
  ?sensor om-owl:generatedObservation [a weather:SnowfallObservation] .
  ?sensor om-owl:processLocation ?sensorLocation .
  ?sensorLocation wgs84_pos:alt ?alt ;
                  wgs84_pos:lat ?lat ;
                  wgs84_pos:long ?long .
}

Q11. Detecting if a station is producing significantly different observation values than its neighbouring stations.

Query description

Detecting malfunctioning sensors is an important issue in all sensor systems. If two sensor stations are located close (denoted by hasLocatedNearRel) to the same location, the sensors are neighbours of each other and they should observe similar weather conditions, otherwise, a sensor might be malfunctioning. This query tests the engines ability to compute complex subquery.

SPARQLStream Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?sensor
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 1 HOURS]
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
  ?sensor om-owl:generatedObservation ?observation ;
          om-owl:hasLocatedNearRel [om-owl:hasLocation ?nearbyLocation] .
  ?observation a ?observationType ;
               om-owl:observedProperty ?observationProperty ;
               om-owl:result [ om-owl:floatValue ?value ] .
  { SELECT (AVG(?value2) AS ?avgValue)
    WHERE {
      ?sensor2 om-owl:generatedObservation ?observation2 ;
               om-owl:hasLocatedNearRel [om-owl:hasLocation ?nearbyLcation2] .
      FILTER ( sameTerm(?nearbyLocation, ?nearbyLocation2) )
      ?observation2 a ?observationType ;
                    om-owl:observedProperty ?observationProperty ;
                    om-owl:result [ om-owl:floatValue ?value2 ] .
    }
  }
  FILTER ( ABS(?value - ?avgValue) / ?avgValue > "0.10"^^xsd:float)
}

CQELS Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?sensor
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
  STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 3600s]
  
  {?sensor om-owl:generatedObservation ?observation ;
          om-owl:hasLocatedNearRel [om-owl:hasLocation ?nearbyLocation] .}
  ?observation a ?observationType ;
               om-owl:observedProperty ?observationProperty ;
               om-owl:result [ om-owl:floatValue ?value ] .
  { SELECT (AVG(?value2) AS ?avgValue)
    WHERE {
      ?sensor2 om-owl:generatedObservation ?observation2 ;
               om-owl:hasLocatedNearRel [om-owl:hasLocation ?nearbyLcation2] .
      FILTER ( sameTerm(?nearbyLocation, ?nearbyLocation2) )
      ?observation2 a ?observationType ;
                    om-owl:observedProperty ?observationProperty ;
                    om-owl:result [ om-owl:floatValue ?value2 ] .
    }
  }
  FILTER ( (?value - ?avgValue) / ?avgValue < "-0.10"^^xsd:float ||
      (?value - ?avgValue) / ?avgValue > "0.10"^^xsd:float  )
}

C-SPARQL Query

PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?sensor
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1h TUMBLING]
FROM <http://www.cwi.nl/SRBench/sensors>
WHERE {
  ?sensor om-owl:generatedObservation ?observation ;
          om-owl:hasLocatedNearRel [om-owl:hasLocation ?nearbyLocation] .
  ?observation a ?observationType ;
               om-owl:observedProperty ?observationProperty ;
               om-owl:result [ om-owl:floatValue ?value ] . 
  { SELECT (AVG(?value2) AS ?avgValue)
    WHERE {
      ?sensor2 om-owl:generatedObservation ?observation2 ;
               om-owl:hasLocatedNearRel [om-owl:hasLocation ?nearbyLcation2] .
      FILTER ( sameTerm(?nearbyLocation, ?nearbyLocation2) )
      ?observation2 a ?observationType ; 
                    om-owl:observedProperty ?observationProperty ;
                    om-owl:result [ om-owl:floatValue ?value2 ] .
    }               
  } 
  FILTER ( (?value - ?avgValue) / ?avgValue < "-0.10"^^xsd:float ||
      (?value - ?avgValue) / ?avgValue > "0.10"^^xsd:float  )
}     

Q12. Get the hourly average air temperature and humidity of large cities.

Query description

To analyse air pollution in large cities, one might want to know if the temperature is higher during the rush hours in such cities. This query requires using the GeoNames dataset to find large cities, i.e., population > 15000, and use the hasLocatedNearRel property in the sensor ontology [34] to find sensors located in or near to these cities.

SPARQLStream Query

PREFIX gn: <http://www.geonames.org/ontology#>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>

SELECT ?name ( AVG(?temperature) AS ?avgTemperature ) ( AVG(?humidity) AS ?avgHumidity )
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
           [NOW - 1 HOURS SLIDE 1 HOURS]
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/geonames>
WHERE {
  ?sensor om-owl:generatedObservation ?temperatureObservation;
          om-owl:generatedObservation ?humidityObservation;
          om-owl:hasLocatedNearRel [ om-owl:hasLocation ?nearbyLocation ] .
  ?temperatureObservation om-owl:observedProperty weather:_AirTemperature ;
                          om-owl:result [ om-owl:floatValue ?temperature ] .
  ?humidityObservation om-owl:observedProperty weather:_RelativeHumidity ;
                       om-owl:result [ om-owl:floatValue ?humidity ] .
  { SELECT ?name
    WHERE {
      ?nearbyLocation gn:featureClass ?featureClass ;
                      gn:name | gn:officialName ?name ;
                      gn:population ?population .
      FILTER ( ?population > 15000 && REGEX(?featureClass, "P" , "i") )
    }
  }
  UNION
  { SELECT ?name
    WHERE {
      ?nearbyLocation gn:parentFeature+ ?parentFeature .
      ?parentFeature gn:featureClass ?parentClass ;
                     gn:name | gn:officialName ?name ;
                     gn:population ?parentPopulation .
      FILTER ( ?parentPopulation > 15000 && REGEX(?parentClass, "P" , "i") )
    }
  }
}
GROUP BY ?name

CQELS Query

Not supported by the language

C-SPARQL Query

PREFIX gn: <http://www.geonames.org/ontology#>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>

SELECT ?name ( AVG(?temperature) AS ?avgTemperature ) ( AVG(?humidity) AS ?avgHumidity )
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
           [RANGE 1h STEP 1h]
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/geonames>
WHERE {
  ?sensor om-owl:generatedObservation ?temperatureObservation;
          om-owl:generatedObservation ?humidityObservation;
          om-owl:hasLocatedNearRel [ om-owl:hasLocation ?nearbyLocation ] .
  ?temperatureObservation om-owl:observedProperty weather:_AirTemperature ;
                          om-owl:result [ om-owl:floatValue ?temperature ] .
  ?humidityObservation om-owl:observedProperty weather:_RelativeHumidity ;
                       om-owl:result [ om-owl:floatValue ?humidity ] .
  { SELECT ?name
    WHERE {
      ?nearbyLocation gn:featureClass ?featureClass ;
                          gn:name | gn:officialName ?name ;
                      gn:population ?population .
      FILTER ( ?population > 15000 && REGEX(?featureClass, "P" , "i") )
    }
  }
  UNION
  { SELECT ?name
    WHERE {
      ?nearbyLocation gn:parentFeature+ ?parentFeature .
      ?parentFeature gn:featureClass ?parentClass ;
                         gn:name | gn:officialName ?name ;
                     gn:population ?parentPopulation .
      FILTER ( ?parentPopulation > 15000 && REGEX(?parentClass, "P" , "i") )
    }
  }
}
GROUP BY ?name

Q13. Get the shores in Florida, US where a strong wind, i.e., the wind force is between 6 and 9, has been observed in the last hour.

Query description

One might want to find shores in Florida, US, where one can go windsurfing now. The query requires first reasoning over the parentADM{1,2,3,4} and parentFeature properties of the GeoNames ontology to find the shores in Florida, US; and then using the hasLocatedNearRel property in the sensor ontology to find sensors located near to these shores.

SPARQLStream Query

PREFIX gn: <http://www.geonames.org/ontology#>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>

SELECT ?shoreName ?lat ?long
       ( IF(AVG(?windSpeed) < 31, 6,
          IF(AVG(?windSpeed) < 39, 7, IF(AVG(?windSpeed) < 47, 8, 9)))
         AS ?windForce )
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 1 HOURS]
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/geonames>
WHERE {
  ?shore gn:featureClass ?shoreClass ;
         wgs84_pos:lat ?lat ;
         wgs84_pos:long ?long ;
         gn:name|gn:officialName ?shoreName ;
         gn:parentFeature+ ?florida .
  ?florida gn:name|gn:officialName ?floridaName .
  FILTER ( ( REGEX(?shoreClass, "L.CST" , "i") || # coast
             REGEX(?shoreClass, "T.BCH" , "i") || # beach
             REGEX(?shoreClass, "T.SHOR" , "i") ) && # shore
           REGEX(?floridaName, "Florida", "i") )
  ?sensor om-owl:generatedObservation ?observation;
          om-owl:hasLocatedNearRel [ om-owl:hasLocation ?shore ] .
  ?observation om-owl:observedProperty weather:_WindSpeed ;
               om-owl:result [ om-owl:floatValue ?windSpeed ] .
  FILTER ( 25 <= ?windSpeed || ?windSpeed <= 54 ) # milesPerHour
}
GROUP BY ?shoreName ?lat ?long

CQELS Query

Not supported by the language

C-SPARQL Query

PREFIX gn: <http://www.geonames.org/ontology#>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>

SELECT ?shoreName ?lat ?long
       ( IF(AVG(?windSpeed) < 31, 6,
          IF(AVG(?windSpeed) < 39, 7, IF(AVG(?windSpeed) < 47, 8, 9)))
             AS ?windForce )
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1h TUMBLING]
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/geonames>
WHERE {
  ?shore gn:featureClass ?shoreClass ;
         wgs84_pos:lat ?lat ;
         wgs84_pos:long ?long ;
         gn:name|gn:officialName ?shoreName ;
         gn:parentFeature+ ?florida .
  ?florida gn:name|gn:officialName ?floridaName .
  FILTER ( ( REGEX(?shoreClass, "L.CST" , "i") || # coast
             REGEX(?shoreClass, "T.BCH" , "i") || # beach
             REGEX(?shoreClass, "T.SHOR" , "i") ) && # shore
           REGEX(?floridaName, "Florida", "i") )
  ?sensor om-owl:generatedObservation ?observation;
          om-owl:hasLocatedNearRel [ om-owl:hasLocation ?shore ] .
  ?observation om-owl:observedProperty weather:_WindSpeed ;
               om-owl:result [ om-owl:floatValue ?windSpeed ] .
  FILTER ( 25 <= ?windSpeed || ?windSpeed <= 54 ) # milesPerHour
}
GROUP BY ?shoreName ?lat ?long

Q14. Get the airport(s) located in the same city as the sensor that has observed extremely low visibility in the last hour.

Query description

One might want to trigger an alarm if dangerous weather condition has been observed. This query requires using the GeoNames dataset and the hasLocatedNearRel property in the sensor ontology to find airport(s) and sensors located in the same city.

SPARQLStream Query

PREFIX gn: <http://www.geonames.org/ontology#>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?airportName ?lat ?long
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [NOW - 1 HOURS]
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/geonames>
WHERE {
  ?airport gn:featureClass ?airportClass ;
           wgs84_pos:lat ?lat ;
           wgs84_pos:long ?long ;
           gn:name|gn:officialName ?airportName ;
           gn:parentFeature+ ?city .
  ?city gn:featureClass ?cityClass .
  FILTER ( REGEX(?airportClass, "S.AIRP" , "i") &&
           REGEX(?cityClass, "P" , "i") )
  ?sensor om-owl:generatedObservation ?observation;
          om-owl:hasLocatedNearRel [ om-owl:hasLocation ?city ] .
  { ?observation om-owl:procedure ?sensor ;
                 a weather:VisibilityObservation ;
                 om-owl:result [om-owl:floatValue ?value ] .
    FILTER ( ?value < "10"^^xsd:float)  # centimeters
  }
  UNION
  { ?observation om-owl:procedure ?sensor ;
                 a weather:RainfallObservation ;
                 om-owl:result [om-owl:floatValue ?value ] .
    FILTER ( ?value > "30"^^xsd:float)  # centimeters
  }
  UNION
  { ?observation om-owl:procedure ?sensor ;
                 a weather:SnowfallObservation .
  }
}

CQELS Query

Not supported by the language

C-SPARQL Query

PREFIX gn: <http://www.geonames.org/ontology#>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?airportName ?lat ?long
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1h TUMBLING]
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/geonames>
WHERE {
  ?airport gn:featureClass ?airportClass ;
           wgs84_pos:lat ?lat ;
           wgs84_pos:long ?long ;
           gn:name|gn:officialName ?airportName ;
           gn:parentFeature+ ?city .
  ?city gn:featureClass ?cityClass .
  FILTER ( REGEX(?airportClass, "S.AIRP" , "i") &&
           REGEX(?cityClass, "P" , "i") )
  ?sensor om-owl:generatedObservation ?observation;
          om-owl:hasLocatedNearRel [ om-owl:hasLocation ?city ] .
  { ?observation om-owl:procedure ?sensor ;
                 a weather:VisibilityObservation ;
                 om-owl:result [om-owl:floatValue ?value ] .
    FILTER ( ?value < "10"^^xsd:float)  # centimeters
  }
  UNION
  { ?observation om-owl:procedure ?sensor ;
                 a weather:RainfallObservation ;
                 om-owl:result [om-owl:floatValue ?value ] .
    FILTER ( ?value > "30"^^xsd:float)  # centimeters
  }
  UNION
  { ?observation om-owl:procedure ?sensor ;
                 a weather:SnowfallObservation .
  }
}

Q15. Get the locations where the wind speed in the last hour is higher than a known hurricane.

Query description

By comparing an observed value with historical values, we can detect extreme weather conditions. This query requires reasoning over rdfs:subClassOf to find all known hurricanes in the system.

SPARQLStream Query

PREFIX dbpprop: <http://dbpedia.org/property/>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX yago: <http://dbpedia.org/class/yago/>

SELECT ?lat ?long ?alt ( AVG(?windSpeed) AS ?avgWindSpeed )
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
           [NOW - 1 HOURS SLIDE 1 HOURS]
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/dbpedia>

WHERE {
  ?observation a weather:WindspeedObservation ;
               om-owl:procedure ?sensor ;
               om-owl:result [ om-owl:floatValue ?windSpeed ] .
  ?sensor om-owl:processLocation ?sensorLocation .
  ?sensorLocation wgs84_pos:alt ?alt ;
                  wgs84_pos:lat ?lat ;
                  wgs84_pos:long ?long .
  ?hurricane rdf:type/rdfs:subClassOf* yago:Hurricane111467018 ;
             dbpprop:1MinWinds ?hurricaneWindSpeed.
  FILTER(?windSpeed > ?hurricaneWindSpeed)
}
GROUP BY ?lat ?long ?alt

CQELS Query

Not supported by the language

C-SPARQL Query

PREFIX dbpprop: <http://dbpedia.org/property/>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos>
PREFIX yago: <http://dbpedia.org/class/yago/>

SELECT ?lat ?long ?alt ( AVG(?windSpeed) AS ?avgWindSpeed )
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
           [RANGE 1h STEP 1h]
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/dbpedia>

WHERE {
  ?observation a weather:WindspeedObservation ;
               om-owl:procedure ?sensor ;
               om-owl:result [ om-owl:floatValue ?windSpeed ] .
  ?sensor om-owl:processLocation ?sensorLocation .
  ?sensorLocation wgs84_pos:alt ?alt ;
                  wgs84_pos:lat ?lat ;
                  wgs84_pos:long ?long .
  ?hurricane rdf:type/rdfs:subClassOf* yago:Hurricane111467018 ;
             dbpprop:1MinWinds ?hurricaneWindSpeed.
  FILTER(?windSpeed > ?hurricaneWindSpeed)
}
GROUP BY ?lat ?long ?alt

Q16. Get the heritage sites that are threatened by a hurricane.

Query description

One might want to trigger an alarm if dangerous weather condition has been observed. This query requires using a Property Path expression with an arbitrary length path to find all heritages sites in the DBpedia dataset; then reasoning using owl:sameAs to link a heritage to a geographical instance described by the GeoNames data; and finally using the GeoNames dataset and the hasLocatedNearRel property in the sensor ontology to find sensors located close to the monuments.

SPARQLStream Query

PREFIX category: <http://dbpedia.org/resource/Category:>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?heritage
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/dbpedia>

WHERE {
  ?observation a weather:WindspeedObservation ;
               om-owl:procedure ?sensor ;
               om-owl:result [ om-owl:floatValue ?windSpeed ] .
  FILTER ( ?windSpeed >= "74"^^xsd:float ) #milesPerHour
  ?sensor om-owl:hasLocatedNearRel [om-owl:hasLocation ?nearbyLocation] .
  ?heritage owl:sameAs ?nearbyLocation ;
            dcterms:subject ?category .
  ?category skos:broader* category:World_Heritage_Sites .
}

CQELS Query

Not supported by the language

C-SPARQL Query

PREFIX category: <http://dbpedia.org/resource/Category:>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?heritage
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations> [RANGE 1h TUMBLING]
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/dbpedia>

WHERE {
  ?observation a weather:WindspeedObservation ;
               om-owl:procedure ?sensor ;
               om-owl:result [ om-owl:floatValue ?windSpeed ] .
  FILTER ( ?windSpeed >= "74"^^xsd:float ) #milesPerHour
  ?sensor om-owl:hasLocatedNearRel [om-owl:hasLocation ?nearbyLocation] .
  ?heritage owl:sameAs ?nearbyLocation ;
            dcterms:subject ?category .
  ?category skos:broader* category:World_Heritage_Sites .
}

Q17. Estimate the damage where a hurricane has been observed.

Query description

The first thing we want to know after a natural disaster is the damage it brings. This can be estimated by consulting the damage brought by similar disasters that have happened before in the same/nearby area. This query requires using the DBpedia dataset to find the damages caused by earlier hurricanes in the same/nearby area as the sensor that has observed a hurricane.

SPARQLStream Query

PREFIX dbpprop: <http://dbpedia.org/property/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX gn: <http://www.geonames.org/ontology#>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX yago: <http://dbpedia.org/class/yago/>

SELECT ?damage
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/geonames>
FROM <http://www.cwi.nl/SRBench/dbpedia>

WHERE {
  ?observation a weather:WindspeedObservation ;
               om-owl:procedure ?sensor ;
               om-owl:result [ om-owl:floatValue ?windSpeed ] .
  FILTER ( ?windSpeed >= "74"^^xsd:float ) #milesPerHour
  ?sensor om-owl:hasLocatedNearRel [om-owl:hasLocation ?nearbyLocation] .
  ?hurricane dbpprop:areas [ foaf:name ?areaName ] ;
             rdf:type/rdfs:subClassOf* yago:Hurricane111467018 ;
             dbpprop:damages ?damage .
  ?nearbyLocation gn:parentFeature* ?area .
  ?area gn:name|gn:officialName ?areaName .
}

CQELS Query

Not supported by the language

C-SPARQL Query

PREFIX dbpprop: <http://dbpedia.org/property/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX gn: <http://www.geonames.org/ontology#>
PREFIX om-owl: <http://knoesis.wright.edu/ssw/ont/sensor-observation.owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX weather: <http://knoesis.wright.edu/ssw/ont/weather.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX yago: <http://dbpedia.org/class/yago/>

SELECT ?damage
FROM NAMED STREAM <http://www.cwi.nl/SRBench/observations>  [RANGE 1h TUMBLING]
FROM <http://www.cwi.nl/SRBench/sensors>
FROM <http://www.cwi.nl/SRBench/geonames>
FROM <http://www.cwi.nl/SRBench/dbpedia>

WHERE {
  ?observation a weather:WindspeedObservation ;
               om-owl:procedure ?sensor ;
               om-owl:result [ om-owl:floatValue ?windSpeed ] .
  FILTER ( ?windSpeed >= "74"^^xsd:float ) #milesPerHour
  ?sensor om-owl:hasLocatedNearRel [om-owl:hasLocation ?nearbyLocation] .
  ?hurricane dbpprop:areas [ foaf:name ?areaName ] ;
             rdf:type/rdfs:subClassOf* yago:Hurricane111467018 ;
             dbpprop:damages ?damage .
  ?nearbyLocation gn:parentFeature* ?area .
  ?area gn:name|gn:officialName ?areaName .
}

[1] SRBench: A Streaming RDF/SPARQL Benchmark. Y. Zhang, M.-D. Pham, O. Corcho and J.-P. Calbimonte. In Proc. of the 11th International Semantic Web Conference ISWC 2012. Boston, USA, Nov 2012.