Or, if both the area and the object are facts in the database, the rule might also be written as
(defrule object-inside-are (area {name == "restricted area"}(OBJECT ?area)) (object (OBJECT ?object &: (?area isInside ?object))) => ;; RHS ) This should detect all objects that are inside some area. -W Jim Yates wrote:
Joao, try this: (defrule object-inside-are (area {name == "restricted area"} (OBJECT ?a1 )) (test {?a1 isInside ?a1 )) => //do something here This assumes that there is a fact area with name equal "restricted area" that you are passing it's self too. If the object you need to pass is a field inside the area class then it might look something like: (defrule object-inside-are (area {name == "restricted area"} (objectField ?of) (OBJECT ?a1 )) (test {?a1 isInside ?of )) => //do something here On Mar 11, 2008, at 7:51 AM, Joao Antunes Mourao wrote: Hello, I'm very new in the Jess and probably this question is too dummy. Anyway... I have a function in java code that tell me if some "object" is inside some "area" (both these, object and area, are classes defined by myself in java). The function look like this: class area{ boolean isInside(object _obj) { if (inside) return true: else return false; } } Now, what i would like to do using jess is, everytime a object is inside a specific area then the rule fires. And I was trying to write something like this: (defrule object-inside-are (area {name == "restricted area"}) (area {isInside (object)} == true ) => //do something here The problem is that I cannot access the function like this. Can you explain me what i have to do here to put this working? Thanks, Joao Mourao ----------------------------------------------- Unclassified email <joao.mourao.vcf> -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
-------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------