JESS: [EXTERNAL] Linking rule actions to the execution of other rules

2013-04-23 Thread Tom De Costere
Hello,

I’m currenly trying to link the actions of rules to the possible execution of 
other rules.
Now I was wondering if anybody has any ideas how this can be done?

I’ve already succeeded in reading out the actions and the conditions, but when 
looking at the current results I can only see the following thing:  (piece of 
output of the loaded miss manners benchmark)

- Rule: MAIN::continue
- Number of conditions [1]:
-- MAIN::Context
- Number of actions [1]:
modify ?f1 state assign_seats

- Rule: MAIN::find_Seating
- Number of conditions [7]:
-- MAIN::Context
-- MAIN::Seating
-- MAIN::Guest
-- MAIN::Guest
-- MAIN::Count
-- not
-- not
- Number of actions [5]:
assert Fact--1
assert Fact--1
assert Fact--1
modify ?f5 c (+ ?c 1)
modify ?f1 state make_path

The problem I’m encountering is the part of the “assert Fact—1”.

Does anybody know how to extract the exact fact it’s going to produce + how I 
could possible find out what rules can be executed after the actions of a rule 
have been executed?

Thanks in advance

Tom DC

RE: JESS: [EXTERNAL] Linking rule actions to the execution of other rules

2013-04-23 Thread Friedman-Hill, Ernest
Hi Tom,

What you’re asking is basically an example of the famous Halting Problem in 
computer science, which I can paraphrase as “determining what a program is 
going to do without running the program.” You can’t tell what rules a fact 
could activate without doing all the pattern matching that Jess does, and 
unless you write something as complex as Jess, you will do it more slowly than 
Jess would.

That said, the best way to determine what rules can fire as a result of a fact 
assertion would be to use Jess itself to find out. Add a JessEventListener that 
listens for ACTIVATION events, and then whenever you assert a fact, watch and 
see what events you get back. Each combination of rule/fact-tuple that could be 
fired as a result of the assertion will generate one event, so you may get many.

Here is some documentation on JessEvents: 
http://www.jessrules.com/jess/docs/71/library.html#events

Here’s a relevant page from the Javadocs: 
http://www.jessrules.com/jess/docs/71/api/jess/JessEvent.html


From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On 
Behalf Of Tom De Costere
Sent: Tuesday, April 23, 2013 5:08 PM
To: jess-users
Subject: JESS: [EXTERNAL] Linking rule actions to the execution of other rules

Hello,

I’m currenly trying to link the actions of rules to the possible execution of 
other rules.
Now I was wondering if anybody has any ideas how this can be done?

I’ve already succeeded in reading out the actions and the conditions, but when 
looking at the current results I can only see the following thing:  (piece of 
output of the loaded miss manners benchmark)

- Rule: MAIN::continue
- Number of conditions [1]:
-- MAIN::Context
- Number of actions [1]:
modify ?f1 state assign_seats

- Rule: MAIN::find_Seating
- Number of conditions [7]:
-- MAIN::Context
-- MAIN::Seating
-- MAIN::Guest
-- MAIN::Guest
-- MAIN::Count
-- not
-- not
- Number of actions [5]:
assert Fact--1
assert Fact--1
assert Fact--1
modify ?f5 c (+ ?c 1)
modify ?f1 state make_path

The problem I’m encountering is the part of the “assert Fact—1”.

Does anybody know how to extract the exact fact it’s going to produce + how I 
could possible find out what rules can be executed after the actions of a rule 
have been executed?

Thanks in advance

Tom DC