You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Luis Enrique Ramos García <lu...@googlemail.com.INVALID> on 2020/01/21 09:56:02 UTC

substractDate built in

Dear friends,

I a trying to perform some operations with dates using rules in jena. One
of those is calculating ages. I found the built in subtractDates(x1, x2,
x3), and at first I wonder if this is a valid jena built in?, at second, I
implemented it with the rule 1 however it does not trigger as expected,
thus I wonder if the built in is properly implemented?. The date format I
am using is yyyy-MM-dd.

@prefix ex: <http://www.example.com#>.

[*rule1:* (?a  ex:birthday ?d1) (?b  ex:currentdate ?d2) subtractDates(?d1,
?d2 ,?age)   -> (?a ex:currentage ?age )]

Where, d1 and d2 are xsd date time values, and age is decimal.

I also implemented the greater than with integer numbers, and I got the
expected result, but I would like to know if there is a built in for date,
where I could evaluate to true when a date is more recent than another?.


Best regards


Luis Ramos

Re: substractDate built in

Posted by Luis Enrique Ramos García <lu...@googlemail.com.INVALID>.
Hi Lorenz,

I will follow it then, and try to get it working.

by the way, in the documentation refereed to lessThan, and greaterThan says
the following:

Test if x is <, >, <= or >= y. Only passes if both x and y are numbers or
time instants (can be integer or floating point or *XSDDateTime*).

Thus, for me it is clear than these builtins must evaluate  to true or
false in case of dates, as you say. I will implement this first, and
comment the results.


Best regards


Luis Ramos

El mié., 22 ene. 2020 a las 9:03, Lorenz Buehmann (<
buehmann@informatik.uni-leipzig.de>) escribió:

> Well, this blog post is about creating a custom rule primitive, and this
> is also what you'd have to do if you need some custom function that is
> not already among the Jena built-ins. So if you really need such  a
> subtractDates function, why not following the blog and create and
> register your own rule primitive?
>
> On 22.01.20 08:25, Luis Enrique Ramos García wrote:
> > Dear friends,
> > barry, here is the reference:
> >
> >
> https://henrietteharmse.com/2018/04/21/creating-custom-rule-primitives-for-jena/
> >
> > But, after searching more carefully, I found it is another tool using
> jena,
> > but not jena at all.
> >
> > So, I wanted to confirm that such builtin was available.
> >
> > By the way, you say if I use dates with lessThan and greaterThan they
> > should resolve to true or false?, an specific date format for that?
> >
> >
> > Luis Ramos
> >
> > El mar., 21 ene. 2020 a las 15:14, Nouwt, B. (Barry)
> > (<ba...@tno.nl.invalid>) escribió:
> >
> >> Hi Luis Ramos, where can we find this substractDates builtin? I cannot
> >> find it in the source code:
> >>
> >>
> >>
> https://github.com/apache/jena/tree/master/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/builtins
> >>
> >> or the documentation:
> >>
> >> https://jena.apache.org/documentation/inference/#builtin-primitives
> >>
> >> There are lessThan, greaterThan builtins that evaluate to true if one
> data
> >> is more recent than another.
> >>
> >> Regards, Barry
> >>
> >> -----Original Message-----
> >> From: Luis Enrique Ramos García
> >> <lu...@googlemail.com.INVALID>
> >> Sent: dinsdag 21 januari 2020 10:56
> >> To: users@jena.apache.org
> >> Subject: substractDate built in
> >>
> >> Dear friends,
> >>
> >> I a trying to perform some operations with dates using rules in jena.
> One
> >> of those is calculating ages. I found the built in subtractDates(x1, x2,
> >> x3), and at first I wonder if this is a valid jena built in?, at
> second, I
> >> implemented it with the rule 1 however it does not trigger as expected,
> >> thus I wonder if the built in is properly implemented?. The date format
> I
> >> am using is yyyy-MM-dd.
> >>
> >> @prefix ex: <http://www.example.com#>.
> >>
> >> [*rule1:* (?a  ex:birthday ?d1) (?b  ex:currentdate ?d2)
> subtractDates(?d1,
> >> ?d2 ,?age)   -> (?a ex:currentage ?age )]
> >>
> >> Where, d1 and d2 are xsd date time values, and age is decimal.
> >>
> >> I also implemented the greater than with integer numbers, and I got the
> >> expected result, but I would like to know if there is a built in for
> date,
> >> where I could evaluate to true when a date is more recent than another?.
> >>
> >>
> >> Best regards
> >>
> >>
> >> Luis Ramos
> >> 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.
> >>
>

Re: substractDate built in

Posted by Lorenz Buehmann <bu...@informatik.uni-leipzig.de>.
Well, this blog post is about creating a custom rule primitive, and this
is also what you'd have to do if you need some custom function that is
not already among the Jena built-ins. So if you really need such  a
subtractDates function, why not following the blog and create and
register your own rule primitive?

On 22.01.20 08:25, Luis Enrique Ramos García wrote:
> Dear friends,
> barry, here is the reference:
>
> https://henrietteharmse.com/2018/04/21/creating-custom-rule-primitives-for-jena/
>
> But, after searching more carefully, I found it is another tool using jena,
> but not jena at all.
>
> So, I wanted to confirm that such builtin was available.
>
> By the way, you say if I use dates with lessThan and greaterThan they
> should resolve to true or false?, an specific date format for that?
>
>
> Luis Ramos
>
> El mar., 21 ene. 2020 a las 15:14, Nouwt, B. (Barry)
> (<ba...@tno.nl.invalid>) escribió:
>
>> Hi Luis Ramos, where can we find this substractDates builtin? I cannot
>> find it in the source code:
>>
>>
>> https://github.com/apache/jena/tree/master/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/builtins
>>
>> or the documentation:
>>
>> https://jena.apache.org/documentation/inference/#builtin-primitives
>>
>> There are lessThan, greaterThan builtins that evaluate to true if one data
>> is more recent than another.
>>
>> Regards, Barry
>>
>> -----Original Message-----
>> From: Luis Enrique Ramos García
>> <lu...@googlemail.com.INVALID>
>> Sent: dinsdag 21 januari 2020 10:56
>> To: users@jena.apache.org
>> Subject: substractDate built in
>>
>> Dear friends,
>>
>> I a trying to perform some operations with dates using rules in jena. One
>> of those is calculating ages. I found the built in subtractDates(x1, x2,
>> x3), and at first I wonder if this is a valid jena built in?, at second, I
>> implemented it with the rule 1 however it does not trigger as expected,
>> thus I wonder if the built in is properly implemented?. The date format I
>> am using is yyyy-MM-dd.
>>
>> @prefix ex: <http://www.example.com#>.
>>
>> [*rule1:* (?a  ex:birthday ?d1) (?b  ex:currentdate ?d2) subtractDates(?d1,
>> ?d2 ,?age)   -> (?a ex:currentage ?age )]
>>
>> Where, d1 and d2 are xsd date time values, and age is decimal.
>>
>> I also implemented the greater than with integer numbers, and I got the
>> expected result, but I would like to know if there is a built in for date,
>> where I could evaluate to true when a date is more recent than another?.
>>
>>
>> Best regards
>>
>>
>> Luis Ramos
>> 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.
>>

Re: substractDate built in

Posted by Luis Enrique Ramos García <lu...@googlemail.com.INVALID>.
Dear friends,
barry, here is the reference:

https://henrietteharmse.com/2018/04/21/creating-custom-rule-primitives-for-jena/

But, after searching more carefully, I found it is another tool using jena,
but not jena at all.

So, I wanted to confirm that such builtin was available.

By the way, you say if I use dates with lessThan and greaterThan they
should resolve to true or false?, an specific date format for that?


Luis Ramos

El mar., 21 ene. 2020 a las 15:14, Nouwt, B. (Barry)
(<ba...@tno.nl.invalid>) escribió:

> Hi Luis Ramos, where can we find this substractDates builtin? I cannot
> find it in the source code:
>
>
> https://github.com/apache/jena/tree/master/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/builtins
>
> or the documentation:
>
> https://jena.apache.org/documentation/inference/#builtin-primitives
>
> There are lessThan, greaterThan builtins that evaluate to true if one data
> is more recent than another.
>
> Regards, Barry
>
> -----Original Message-----
> From: Luis Enrique Ramos García
> <lu...@googlemail.com.INVALID>
> Sent: dinsdag 21 januari 2020 10:56
> To: users@jena.apache.org
> Subject: substractDate built in
>
> Dear friends,
>
> I a trying to perform some operations with dates using rules in jena. One
> of those is calculating ages. I found the built in subtractDates(x1, x2,
> x3), and at first I wonder if this is a valid jena built in?, at second, I
> implemented it with the rule 1 however it does not trigger as expected,
> thus I wonder if the built in is properly implemented?. The date format I
> am using is yyyy-MM-dd.
>
> @prefix ex: <http://www.example.com#>.
>
> [*rule1:* (?a  ex:birthday ?d1) (?b  ex:currentdate ?d2) subtractDates(?d1,
> ?d2 ,?age)   -> (?a ex:currentage ?age )]
>
> Where, d1 and d2 are xsd date time values, and age is decimal.
>
> I also implemented the greater than with integer numbers, and I got the
> expected result, but I would like to know if there is a built in for date,
> where I could evaluate to true when a date is more recent than another?.
>
>
> Best regards
>
>
> Luis Ramos
> 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.
>

RE: substractDate built in

Posted by "Nouwt, B. (Barry)" <ba...@tno.nl.INVALID>.
Hi Luis Ramos, where can we find this substractDates builtin? I cannot find it in the source code:

https://github.com/apache/jena/tree/master/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/builtins

or the documentation:

https://jena.apache.org/documentation/inference/#builtin-primitives

There are lessThan, greaterThan builtins that evaluate to true if one data is more recent than another.

Regards, Barry

-----Original Message-----
From: Luis Enrique Ramos García <lu...@googlemail.com.INVALID> 
Sent: dinsdag 21 januari 2020 10:56
To: users@jena.apache.org
Subject: substractDate built in

Dear friends,

I a trying to perform some operations with dates using rules in jena. One of those is calculating ages. I found the built in subtractDates(x1, x2, x3), and at first I wonder if this is a valid jena built in?, at second, I implemented it with the rule 1 however it does not trigger as expected, thus I wonder if the built in is properly implemented?. The date format I am using is yyyy-MM-dd.

@prefix ex: <http://www.example.com#>.

[*rule1:* (?a  ex:birthday ?d1) (?b  ex:currentdate ?d2) subtractDates(?d1,
?d2 ,?age)   -> (?a ex:currentage ?age )]

Where, d1 and d2 are xsd date time values, and age is decimal.

I also implemented the greater than with integer numbers, and I got the expected result, but I would like to know if there is a built in for date, where I could evaluate to true when a date is more recent than another?.


Best regards


Luis Ramos
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.