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) > (<[email protected]>) 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 >> <[email protected]> >> Sent: dinsdag 21 januari 2020 10:56 >> To: [email protected] >> 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. >>
