Hi everyone,

for a project I have a set of sosa:Observation's and would like to use the 
elegant W3C Time ontology (https://www.w3.org/TR/owl-time/). I especially like 
the way they have a time:after and time:before object property and I would like 
to use those as a filter in my SPARQL query (note that I do know the SPARQL 
FILTER keyword exists that supports datetime comparisons, i.e. FILTER (?date > 
"2020-05-01T13:00:00Z"^^xsd:dateTime && ?date < 
"2020-05-03T11:00:00Z"^^xsd:dateTime) ).

When I try to realize this I run into a problem and I am wondering what other 
think about this. I would like to execute the following example query:

PREFIX test: <https://www.tno.nl/test/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX time: <http://www.w3.org/2006/time#>
PREFIX sosa: <http://www.w3.org/ns/sosa/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT * WHERE {
                ?mea rdf:type sosa:Observation .
                ?mea sosa:hasSimpleResult ?result .
                ?mea test:measureTime ?time1 .
                ?time1 rdf:type time:Instant .
                ?time1 time:inXSDDateTime ?timeValue .
                ?time1 time:after ?time2 .
                ?time1 time:before ?time3 .
                ?time2 rdf:type time:Instant .
                ?time2 time:inXSDDateTime "2020-05-01T13:00:00Z"^^xsd:dateTime .
                ?time3 rdf:type time:Instant .
                ?time3 time:inXSDDateTime "2020-05-03T11:00:00Z"^^xsd:dateTime .
}

Which I would like to return all observations within the two specified time 
instances (defined using variables ?time2 and ?time3), but I cannot get this to 
work. The problem is that, to make this work, my triple store would need to 
contain all possible ?time2 and ?time3 datetimes for every observation, which 
is impractical (and impossible).

Any ideas on how to solve this without using the SPARQL FILTER keyword? Was 
W3C's Time ontology not designed with this kind of usage in mind?

Kind regards and thanks in advance,

Barry

This message may contain information that is not intended for you. If you are 
not the addressee or if this message was sent to you by mistake, you are 
requested to inform the sender and delete the message. TNO accepts no liability 
for the content of this e-mail, for the manner in which you use it and for 
damage of any kind resulting from the risks inherent to the electronic 
transmission of messages.

Reply via email to