JESS: exists issue

View: New views
2 Messages — Rating Filter:   Alert me  

JESS: exists issue

by Lucia Masola :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I found some trouble trying to write a rule. I have the following templates:

  (Call (caller_id )(callee_id )) // defines a call between two methods
(  Method (id )(class_id )) // defines a method and the class where it belongs
(redirectMethod    (caller_method )(caller_class )(calleeMethod ?MetodoLlamado) (calleeClass ))

What i have to do is assert the redirectMethod only in case where I have a call between two methods(m1->m2) and no other method in the caller class calls the m2 method. i do not know how to check the second part, ( no other method in the class make the same call). if anyone can help me with this I will appreciate it. I tried to use exists but I could make it work.

Thanks a lot!

Re: JESS: exists issue

by Ernest Friedman-Hill :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Sep 30, 2009, at 9:16 PM, Lucia Masola wrote:

> Hi, I found some trouble trying to write a rule. I have the  
> following templates:
>
>   (Call (caller_id )(callee_id )) // defines a call between two  
> methods
> (  Method (id )(class_id )) // defines a method and the class where  
> it belongs
> (redirectMethod    (caller_method )(caller_class )(calleeMethod ?
> MetodoLlamado) (calleeClass ))
>
> What i have to do is assert the redirectMethod only in case where I  
> have a call between two methods(m1->m2) and no other method in the  
> caller class calls the m2 method. i do not know how to check the  
> second part, ( no other method in the class make the same call). if  
> anyone can help me with this I will appreciate it. I tried to use  
> exists but I could make it work.


// There is a call between two methods
(Call (caller_id ?m1) (callee_id ?m2))

// This is the caller method
(Method (id ?m1) (class_id ?c))

// It's not true that there's a method that's distinct from ?m1 in  
class ?c
// that calls ?m2
(not (and (Method (id ?id3&~?id1) (class_id ?c))
           (Call (caller_id ?id3) (callee_id ?m2))))

=> ...





>
> Thanks a lot!

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, 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@....
--------------------------------------------------------------------