« Return to Thread: JESS: rule problems

Re: JESS: rule problems

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View in Thread

On Apr 2, 2008, at 7:58 AM, Joao Antunes Mourao wrote:

> I discovered the problem. Somehow, jess doesn't like the comparisson
> like { name == "Area_1"}, but instead if I use (name /Area_1/) it  
> works.
> This sounds very weird because for only one line comparison it works,
> but to subsequent lines doesn't.


In Jess 7.0,  the "{name == "area1"}" syntax creates a variable named  
"?name" and binds it to the slot's value; that variable is then  
available on the rule's RHS. There's a big problem with that, though:  
what if you want to use that syntax for that slot for two different  
patterns? What happens is that the same variable ?name is used for  
both patterns, unifying them. So you're effectively matching facts  
with a pattern like name&"area1"&"area2" -- and that will never match.

That's why the semantics have changed in Jess 7.1. The variable is no  
longer created. Multiple "java syntax" patterns are completely  
independent.


---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 ejfried@...
Livermore, CA 94550                 http://www.jessrules.com




--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users you@...'
in the BODY of a message to majordomo@..., NOT to the list
(use your own address!) List problems? Notify owner-jess-users@....
--------------------------------------------------------------------

 « Return to Thread: JESS: rule problems

LightInTheBox - Buy quality products at wholesale price