Dear all,
I figured out some interesting behavior of Jess when I was querying it. I try 
to use Jess in forward chaining mode as a query machine. I query Jess from Java 
(I use runQueryStar function).
For example: I have a file with 10540 facts and Jess script with only 7 
deftemplates. The script does not contain any rule or other elements.
When I load facts (using load-facts function) and then I query the Jess (query 
contains 20 patterns with about 25 tests, so it is the big query I think :)) 
the querying time is 31719 ms.
But I think I found out better way to query the engine. I load facts and then I 
add the same query as a rule to the engine (for example (defrule name query 
=>)). Then I get activations (listActivations() function) and all the tokens in 
activations are the answer for the query. The querying time is 20969 ms.
But then I found out much better way: First, I add the query as a rule and then 
I load all facts. Then I get activations and tokens are the answer. The time is 
12390ms.
In every case the number of results is the same (14892). 
So I have a question – is that normal behavior or am I doing something wrong? 
What is the reason of querying Jess even 3 times faster?
Is there any way to calculate the computational complexity of querying the Jess 
engine in forward chaining mode?

-- 
Best regards!
 Jarek Bak

Reply via email to