0

How to update the RDF triple (not added new one) using jena rule. I am using generic rule reasoner and rules are in separate file as shown case 1:

@prefix fa: http://www.smarthome_haier.com#.

Rule1: (?a fa:setTimer “0”)(?a fa:windvolume “150”)->remove(0)(?a fa:setTimer “1”)

This work fine using remove() Builtin primitive to add new triple and delete the old triple "(?a fa:setTimer “0”)" using remove() builtin option.

But for example in this 2nd case below where we want same result as case one:

@prefix fa: http://www.smarthome_haier.com#.

Rule1: (?a fa:airPresure “40”)(?a fa:windvolume “150”)->(?a fa:setTimer “1”)

Using this adds new triple (?a fa:setTimer “1”) in graph but old triple also exist (?a fa:setTimer “0”) because we are not remove that one.

How can we update triple in 2nd case? Where (?a fa:setTimer “0”) is not present in rule head. I hope this explain this problem. Any help will appreciated. Thanks!

Click [Here] Jena inference support https://jena.apache.org/documentation/inference/index.html

Ehsanur
  • 21
  • 5
  • Short answer: without the special predicate `remove()` and `drop()` Jena rules are like any other deductive reasoning system monotonic, thus, just new facts are inferred, but nothing will be overwritten. – UninformedUser May 14 '19 at 08:41
  • And can be non-trivial, in your case you'd have to figure out which facts have to be removed. I'd start with getting the predicates in the head of the rules, get all inferred triples for those predicates and then remove old triples if a new triple has been inferred. Note, that way might be wrong, I never did it nor tested it, and I also don't know your rule set and there might be some corner cases depending on the complexity of the rules (for heads with a single atom it should be easy though). So far, I didn't think enough about it. – UninformedUser May 14 '19 at 08:50
  • that said, there is a reason for having also a field of non-monotonic reasoning, there are have been published some papers for the RDF world – UninformedUser May 14 '19 at 08:52

0 Answers0