You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Francesco Panico <fp...@imolinfo.it> on 2012/04/27 13:24:57 UTC

Arithmetic Operators on Durations, Dates and Times with jena

Hi,
I'm working with jena and Joseki.
I found here SPARQL standard functions and I wonder jena (and ARQ)
implements these function or does exist any library to perform these
function.

Thank you in advance

Best regards

Re: Arithmetic Operators on Durations, Dates and Times with jena

Posted by Paolo Castagna <ca...@googlemail.com>.
Ciao Francesco,
not exactly an answer to your question, but I just want to point you at:

 - Add support to ARQ/SPARQL for more XSD datatypes and related operations.
   https://issues.apache.org/jira/browse/JENA-235

You can vote/watch that issue, add your comments/suggestions there if you have
any or even help with that. Patches are very, very, welcome.

You can find info on how to get involved in Apache Jena here:
http://incubator.apache.org/jena/getting_involved/

Paolo

Francesco Panico wrote:
> Hi,
> I'm working with jena and Joseki.
> I found here SPARQL standard functions and I wonder jena (and ARQ)
> implements these function or does exist any library to perform these
> function.
> 
> Thank you in advance
> 
> Best regards
> 


Re: Arithmetic Operators on Durations, Dates and Times with jena

Posted by Diogo Patrão <dj...@gmail.com>.
Hello 

My answer is based on my experience with Virtuoso and D2R. The first has its own functions to do this, in the bif: namespace. The latter, in version 0.7, is based upon arq2.8.1 and I needed to write my own java function to do this.

Jena and Arq allows to use custom java functions, and that's what i've done. 

Xsd: defines some "functions" to perform date and time operations, but i'm not aware whether they are implemented on jena or other library.

--
Diogo F.C. Patrão


Em 27/04/2012, às 12:52, Francesco Panico <fp...@imolinfo.it> escreveu:

> Hi,
> 
> thank you for your answers, they were usefull.
> 
> I had already planned to to replace  Joseki  with  Fuseki  in my
> applications.
> 
> Now I have an other problem
> How can I add a value to a  date in SPARQL query?
> 
> 
> For example,
> if I want all person who have the birthdayDate property older than one
> year.
> -I can use afn:now() to get current date, but I do not know how to increase
> or decrease this date.
> 
> Have you ever face this problem or do you know someone who has the same
> problem?
> Can you give me some input to solve my problem?
> 
> Thank you in advance
> best regards
> Francesco
> 
> 
> 2012/4/27 Andy Seaborne <an...@apache.org>
> 
>> On 27/04/12 12:24, Francesco Panico wrote:
>> 
>>> Hi,
>>> I'm working with jena and Joseki.
>>> 
>> 
>> Fuseki replaces Joseki.
>> 
>> 
>> I found here SPARQL standard functions and I wonder jena (and ARQ)
>>> implements these function or does exist any library to perform these
>>> function.
>>> 
>>> Thank you in advance
>>> 
>>> Best regards
>>> 
>>> 
>> ARQ supports all the standard SPARQL 1.1 functions and datatypes and more.
>> 
>> Only xsd:dateTime is required of a SPARQL 1.1 implementation.
>> 
>> xsd:date support should be complete.
>> 
>> There's no value space built in to ARQ for xsd:time or xsd:duration.
>> 
>> There is some support for g*.
>> 
>> JENA-235 is about more XSD datatypes.
>> 
>>       Andy
>> 
>> 
>> 

Re: Arithmetic Operators on Durations, Dates and Times with jena

Posted by Francesco Panico <fp...@imolinfo.it>.
Hi,

thank you for your answers, they were usefull.

I had already planned to to replace  Joseki  with  Fuseki  in my
applications.

Now I have an other problem
How can I add a value to a  date in SPARQL query?


For example,
if I want all person who have the birthdayDate property older than one
year.
-I can use afn:now() to get current date, but I do not know how to increase
or decrease this date.

Have you ever face this problem or do you know someone who has the same
problem?
Can you give me some input to solve my problem?

Thank you in advance
best regards
Francesco


2012/4/27 Andy Seaborne <an...@apache.org>

> On 27/04/12 12:24, Francesco Panico wrote:
>
>> Hi,
>> I'm working with jena and Joseki.
>>
>
> Fuseki replaces Joseki.
>
>
>  I found here SPARQL standard functions and I wonder jena (and ARQ)
>> implements these function or does exist any library to perform these
>> function.
>>
>> Thank you in advance
>>
>> Best regards
>>
>>
> ARQ supports all the standard SPARQL 1.1 functions and datatypes and more.
>
> Only xsd:dateTime is required of a SPARQL 1.1 implementation.
>
> xsd:date support should be complete.
>
> There's no value space built in to ARQ for xsd:time or xsd:duration.
>
> There is some support for g*.
>
> JENA-235 is about more XSD datatypes.
>
>        Andy
>
>
>

Re: Arithmetic Operators on Durations, Dates and Times with jena

Posted by Francesco Panico <fp...@imolinfo.it>.
Thank you for your replay.

I'll test it.

Regards
Francesco

2012/5/10 Andy Seaborne <an...@apache.org>

> The development version of ARQ now includes support for operations
> involving durations for operators "+" and "-", following the operations in
> "XQuery/Xpath functions and operations" (F&O).
>
> Some of this uses the Java runtime support for XML datatypes, which is
> slightly more permissive than the F&O specification (e.g. you can add a any
> xsd:duration to xsd:time, not just xsd:dayTimeDuration - Java forgets about
> the meaningless parts).
>
> Supported:
> datetime, date, time   +   duration
>    (also duration + datetime, date or time)
> datetime, date, time   -   duration
> dayTimeDuration * number - > dayTimeDuration
>
>        Andy
>

Arithmetic Operators on Durations, Dates and Times with jena

Posted by Andy Seaborne <an...@apache.org>.
The development version of ARQ now includes support for operations 
involving durations for operators "+" and "-", following the operations 
in "XQuery/Xpath functions and operations" (F&O).

Some of this uses the Java runtime support for XML datatypes, which is 
slightly more permissive than the F&O specification (e.g. you can add a 
any xsd:duration to xsd:time, not just xsd:dayTimeDuration - Java 
forgets about the meaningless parts).

Supported:
datetime, date, time   +   duration
     (also duration + datetime, date or time)
datetime, date, time   -   duration
dayTimeDuration * number - > dayTimeDuration

	Andy

Re: Arithmetic Operators on Durations, Dates and Times with jena

Posted by Andy Seaborne <an...@apache.org>.
On 27/04/12 12:24, Francesco Panico wrote:
> Hi,
> I'm working with jena and Joseki.

Fuseki replaces Joseki.

> I found here SPARQL standard functions and I wonder jena (and ARQ)
> implements these function or does exist any library to perform these
> function.
>
> Thank you in advance
>
> Best regards
>

ARQ supports all the standard SPARQL 1.1 functions and datatypes and more.

Only xsd:dateTime is required of a SPARQL 1.1 implementation.

xsd:date support should be complete.

There's no value space built in to ARQ for xsd:time or xsd:duration.

There is some support for g*.

JENA-235 is about more XSD datatypes.

	Andy