Algernon Rules

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Algernon Rules

phil smart

Dear All,

Would it be possible for someone to give me an example that uses a backward rule
interleaved in a forward rule, the closest I have got so far is:

((:add-rule Person ((:instance Person ?a) (:instance Person ?b) (loves ?a
?b)->(:Print "Loves" ?a ?b) )))

((:add-rule Region ( (loves ?a ?b) <- (closeTo ?a ?b) )))

So a simple rule that uses closeTo as a sort of alias to loves (but this will be
further extended).

When I ask or tell this rule it succeds but nothing happens, how to do I get the
results...indeed is this correct at all...

Phil



-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

Re: Algernon Rules

Micheal Hewett

I don't know if anyone answered your question
(and my apologies for the long wait if nobody
did).

Your example is very close to being right.
However, I believe there is no way to trigger
a rule that starts with an :INSTANCE clause.
You could rearrange the order as follows:

   ((:add-rule Person
       ((loves ?a ?b)
        (:instance Person ?b)
          ; checking (:INSTANCE Person ?a)
          ; is redundant because the rule
          ; is attached to the Person class
        ->
         (:Print "Loves" ?a ?b))))

   Along with the second rule as you stated it
   except instead of attaching it to the Region
   class, attach it to the Person class.

  ((:add-rule Person ( (loves ?a ?b) <- (closeTo ?a ?b) )))

Then:

   (ask ((:instance Person ?x) (loves ?x ?y)))

will check every person to see whether they love
someone else, which will depend on them being
closeTo someone else.

Mike Hewett

p.s.  Maybe the actual problem was that the second
       rule was on the Region class instead of the
       Person class.


Begin forwarded message:

> From: Philip Smart <[hidden email]>
> Date: May 31, 2006 3:08:02 AM PDT
> To: [hidden email]
> Subject: [protege-discussion]  Algernon Rules
> Reply-To: [hidden email]
>
>
> Dear All,
>
> Would it be possible for someone to give me an example that uses a  
> backward rule
> interleaved in a forward rule, the closest I have got so far is:
>
> ((:add-rule Person ((:instance Person ?a) (:instance Person ?b)  
> (loves ?a
> ?b)->(:Print "Loves" ?a ?b) )))
>
> ((:add-rule Region ( (loves ?a ?b) <- (closeTo ?a ?b) )))
>
> So a simple rule that uses closeTo as a sort of alias to loves (but  
> this will be
> further extended).
>
> When I ask or tell this rule it succeds but nothing happens, how to  
> do I get the
> results...indeed is this correct at all...
>
> Phil
>
>
>
> ----------------------------------------------------------------------
> ---
> To unsubscribe go to http://protege.stanford.edu/community/ 
> subscribe.html
>
-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html