The question is what the function should do??

if you look here: https://www.w3.org/TR/sparql11-query/#FunctionMapping

it is "N"ot allowed to cast from int to dateTime

On Tue, 2023-04-18 at 10:19 +0000, Enrico.Daga wrote:
> Hi,
> 
> I need help using XSD date/time functions, I tried versions 4.2.0 and
> 4.7.0 and both don't seem to work.
> 
> Considering this Java code:
> 
> 
> Dataset kb = DatasetFactory.createGeneral();
> Query q = QueryFactory.create(q);
> result = QueryExecutionFactory.create(q, kb).execSelect();
> 
> The following throws an NPE (no results)
> 
> 
> String q = "\n" +
>         "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>" +
>         "SELECT ?date WHERE { BIND(xsd:dateTime (1649185973) AS ?date
> ) }";
> 
> ...
> System.err.println(result.next().get("date").toString());
> 
> While the cast to int works fine:
> 
> 
> String q = "\n" +
>         "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>" +
>         "SELECT ?date WHERE { BIND(xsd:int (1649185973) AS ?date )
> }";
> System.err.println(executeARQ(q).next().get("date").toString());
> 
> 1649185973^^http://www.w3.org/2001/XMLSchema#int
> 
> Am I missing anything?
> 
> Best,
> 
> Enrico
> 
> --
> Enrico Daga, PhD
> 
> www.enridaga.net<http://www.enridaga.net> | @enridaga
> 
> SPARQL Anything http://sparql-anything.cc
> Polifonia http://polifonia-project.eu
> SPICE http://spice-h2020.eu
> Open Knowledge Graph http://data.open.ac.uk<http://data.open.ac.uk/>
> 
> Senior Research Fellow, Knowledge Media Institute, STEM Faculty
> The Open University
> Level 4 Berrill Building, Walton Hall, Milton Keynes, MK7 6AA
> Direct: +44 (0) 1908 654887
> -- The Open University is incorporated by Royal Charter (RC 000391),
> an exempt charity in England & Wales and a charity registered in
> Scotland (SC 038302). The Open University is authorised and regulated
> by the Financial Conduct Authority in relation to its secondary
> activity of credit broking.

Reply via email to