Hi David,
On 06/10/16 02:34, David Martin wrote:
Regarding this particular question from my initial message:
Any thoughts from anyone about what would be involved in modifying the
Jena code base to support this?
It looks like what I'm asking for would be reasonably easy. It looks
like the high-level steps would be:
* Modify the rule representation to store a numeric priority
* Define a rule syntax modification for how to state a numeric priority
* Modify the rule parser to parse out the numeric priority and put it
into the rule representation
* In RETEConflictSet, write a new method to choose a rule to fire
based on these priorities. The place to call that method (hopefully
the only place needed) would be in RETEConflictSet.fireOne.
So I guess I'll add the following question: Does that sound right to
those to know the code well?
It sounds plausible but I would have concerns whether it would reveal
any limitations of the conflict set implementation.
Historical context:
JenaRules, the forward engine, was not designed to be a full production
rule system. It was just there as machinery to implement forward
deductive closure using monotonic rules for the purposes or RDFS/OWL
etc. So the assumption was that all rules would fire, they could only
add facts, there was no means by which one rule could block another
firing, and no side effects.
Which means we used elements of RETE to gain the efficient incremental
firing on new facts/deductions but didn't implement negation of any sort
and no conflict resolution at all, let alone prioritization.
Then for various reasons we were tempted down the dark path towards more
production system capabilities with the dreaded noValue predicates and
actions like drop. At that point we hacked on a minimal notion of
conflict resolution just in order to make those predicates/actions make
sense.
These many years later I tend to think we should either have stuck to
the original purpose or rebuilt the system completely as a full RETE
implementation.
So your approach is plausible but I couldn't guarantee that you won't
hit a "hold on, this doesn't seem to be a proper conflict resolution
implementation, we can't build on this" moment. Though I don't have any
specific blocking problems in mind so it might just work.
Dave