David, You wrote: *Rules ease-of-authoring is a big requirement for us.*
*Procedural *rules systems have been around since the 1990s at least, and their drawbacks are indeed well known. It's now feasible to interpret rules in a strongly *declarative *way, such that the consequences you can draw from a set of rules are the same, independent of the order in which they are written down. There is no longer any need to 'game' the execution order to get the right results. Here are a couple of examples. www.executable-english.com/demo_agents/ProcessSpecificationLanguage1.agent www.executable-english.com/demo_agents/GrowthAndDebt1.agent These and other examples are online at the site below, where you can view, run, and change them using a browser. You are most welcome to write and run your own examples too. HTH, -- Adrian Adrian Walker Reengineering LLC San Jose, CA, USA 860 830 2085 www.executable-english.com On Wed, Oct 5, 2016 at 6:34 PM, David Martin <[email protected]> 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? > > Cheers, > David > > > > On 10/5/2016 6:15 PM, David Martin wrote: > >> Hi Niels, >> >> Thanks for the excellent observations/suggestions. Yes, I think you are >> right that we could adopt these techniques that leverage what's provided in >> the basic RETE algorithm, which are already implemented in Jena. However, >> we strongly prefer a more streamlined approach. For one thing, the >> "bookkeeping" clauses and assertions in the rules can get to be really >> cumbersome and can seriously impact the readability of the rules, and can >> be hard for the rules author to wrap his head around once you get beyond a >> few rules. Rules ease-of-authoring is a big requirement for us. >> >> So we've concluded that we want an approach that's very easy for the >> rules writer to read and think about, and more tightly integrated with >> rule-firing choices that happen under the hood. >> >> We've thought a little bit about using the techniques you've mentioned to >> support a preprocessing approach. That is, the rules author would simply >> write the numeric priorities, but some kind of preprocessor would generate >> the bookkeeping clauses and assertions just before (or just after) the >> rules are loaded. That might work out pretty well, but I'd still like to >> find out if the Jena gurus think this could be done in a more elegant >> fashion by modifying the existing Java rule-firing code. (And if anyone >> has already worked on this.) >> >> Best regards, >> David >> >> >> On 10/5/2016 3:57 PM, Niels Andersen wrote: >> >>> David, >>> >>> Could you put the priority into the rule and then let the rule >>> completion trigger the next set of rules? >>> >>> Another option is to create the rule so that each rule tests to see if >>> there are any overlapping rules that have a higher priority. >>> >>> Niels >>> >>> -----Original Message----- >>> From: David Martin [mailto:[email protected]] >>> Sent: Wednesday, October 5, 2016 15:28 >>> To: [email protected] >>> Subject: Adding priorities to Jena rules? >>> >>> Hi all, >>> >>> We are working on a system that employs Jena rules, and we're finding it >>> would be extremely valuable to have a capability for specifying rule >>> priorities. We are using the forwardRETE reasoning mode. >>> >>> What we're thinking of would be the ability of the rules author to >>> assign a numeric priority to each rule. When the system chooses a rule to >>> fire, if there are multiple possibilities, one of the rules with the >>> highest numeric priority is chosen. >>> >>> Priorities have been added in various ways to many different rules >>> reasoning systems. Indeed, Wikipedia's article on RETE mentions rule >>> priorities as one of the typical considerations used in conflict resolution. >>> >>> My questions: >>> >>> Is there anything like this already in Jena, which I am not yet aware of? >>> >>> Has anyone ever designed or implemented an approach to support >>> priorities in Jena rules? >>> >>> Is this something that might be on the roadmap for future evolution of >>> Jena rules? >>> >>> Any thoughts from anyone about what would be involved in modifying the >>> Jena code base to support this? >>> >>> Finally, in the current implementation, is the ordering of rules (order >>> in which the rules have been loaded) decisive in conflict resolution? >>> >>> Thanks! >>> David >>> >>> >> >
