0

I'm trying to implement a rule that substract 1 years to a datetime and asign it to a data property using only SWRL

I've got an entity Product which got a data property creationDate equal to 2019-07-15T00:00:00.

My SWRL rule is the following :

Product(?p) ^ creationDate(?p, ?cd) ^ swrlb:yearMonthDuration(?dur, 1, 0) 
^ swrlb:subtractYearMonthDurationFromDateTime(?result, ?cd, ?dur) 
-> Product(?p) ^ yearBeforeCreation(?p, ?result)

I expect to get yearBeforeCreation equal to 2018-07-15T00:00:00

Right now I've tried the SWRL with Pellet and Drools

Thanks for your help !

Dauflo
  • 31
  • 1
  • 7
  • why do you have `Product(?p)` in the head of the rule? That's redundant because it's part of the rule body, i.e. one of the requirements that the rule "fires" – UninformedUser Jul 15 '19 at 13:16
  • that's a mistake, wasn't paying attention, will correct that in my rule, thx – Dauflo Jul 15 '19 at 13:21

1 Answers1

0

I manage to make my SWRL work, look like it was something with protege. I've close/open, rewrite my rule and it work.

Dauflo
  • 31
  • 1
  • 7