renataleb
renataleb

Reputation: 21

How can I translate SPARQL query into English

Could you please translate this query into English?

I am trying to write a naive implementation in code.

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 .
  }
}

Any help will be appreciated

Upvotes: 0

Views: 152

Answers (1)

Gilles-Antoine Nys
Gilles-Antoine Nys

Reputation: 1481

As I understand it:

SELECT DISTINCT ?sensor ?value ?uom

Give me all the distinct sensors name, their value and the uom (I am not familiar with sensors) that correspond to the following conditions :

?observation om-owl:procedure ?sensor ;

First, give me the observations related by a procedure to a sensor.

rdf:type/rdfs:subClassOf* weather:PrecipitationObservation ;

From these observations, take all those are subclasses of Precipitations.

om-owl:result ?result .

And extract me their result.

?result ?p1 ?value .

Take all their value.

OPTIONAL { ?result ?p2 ?uom . }

And if it exist, all their uom (?).

So in the end, it seems to get all the value of rainfall aggregated by hour for each sensor.

Upvotes: 1

Related Questions