Search code examples
databasesparqlrdfprotege

SPARQL date filter query for RDF


I am querying using SPARQL, which works fine. But when I add a data filter it doesn't throw an error but also it doesn't do the filter. The final part is that I should be able to query between two dates:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX hotel: <http://users.jyu.fi/~mimomuki/everything/hotel#>

SELECT *
    WHERE { ?room  hotel:hasCity ?sender; hotel:hasFirstDay ?Firstday
        FILTER ( ?Firstday >= "2016-09-01"^^xsd:date )      
        }

Solution

  • This Filter worked for me:

    FILTER (?FirstDay>= "2016-09-01T00:00:00Z"^^xsd:dateTime)