Search code examples
javardfsparqljenaarq

Does ARQ support SPARQL 1.1 Date and Time Functions?


I have been trying to do some formatting of date/time values to make them display as string literals in the result. I am using Jena ARQ from apache-jena-2.11.0 .

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?activity  ?agent ?time ?time (YEAR(?time) as ?year )   WHERE {
     ?activity prov:endedAtTime ?time ;
            prov:wasAssociatedWith ?agent .

}

ARQ reports the date time as

"2015-02-20T13:07:53+00:00:00"^^<xsd:dateTime>  to me.

This is how the property looks in RDF as a TTL :

<http://www.w3.org/ns/prov#endedAtTime>
    "2014-08-04T15:35:09+01:00:00"^^<xsd:dateTime> ;

This was created with the following use of the Jena API:

resource.addProperty(PROVO.endedAtTime,
                model.createTypedLiteral(date, "xsd:dateTime"));

Maybe I am using the API wrong?


Solution

  • Yes, Jena supports all the SPARQL 1.1 functions.

    You have having problems because

    "2015-01-07T15:22:53+00:00:00"^^<xsd:dateTime> 
    

    is not a datetime.

    "2015-01-07T15:22:53+00:00:00"^^http://www.w3.org/2001/XMLSchema#dateTime> 
    

    or

    "2015-01-07T15:22:53+00:00:00"^^xsd:dateTime 
    

    <xsd:dateTime> is a completely different URI, URI scheme name "xsd".