The examples given assume that you are calling an isInside method in
the area class.

On Mar 12, 2008, at 3:00 AM, Joao Antunes Mourao wrote:

Thank you for the explanantions.

Actually I would like to ask you other thing. In the examples above, the
"isInside" function, i suppose, should be an userFunction, load into
Jess using the load-function command (at least this was the way i did
it). Now, its possible to call a function ("method") defined in some
class that don't implements the userFunction, or everytime you want to
acess some function you have to defined it  as userFunction?

Regards,

Joao Mourao

Wolfgang Laun wrote:

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]
--------------------------------------------------------------------

<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]
--------------------------------------------------------------------

Reply via email to