Hans Chalupsky | 3 Oct 2008 23:41
Picon
Favicon

Re: Assertion followed by retraction leads to error state...

Srini,

comments in-line:

>>>>> Srini Ram <srini_ramaswamy_i <at> yahoo.com> writes:

> Hi Hans
> What you say below may work in a limited way (unassert followed by assert) but can still fail as the
following shows

> (defconcept person)
> (defconcept rich (?x person))
> (defconcept poor (?x person))
> (assert (disjoint rich poor))             ;; person can be rich or poor but not both

> (assert (rich jim))

> (retrieve all (rich ?x))
> #1: ?X=JIM                      ;; ok
> (retrieve all (poor ?x))
> No solutions.                   ;; ok
> (retrieve all (not (poor ?x)))
> No solutions.             ;; why dont i get jim, system can infer that jim is not poor
>                                 ;; since jim is rich, and rich/poor are disjoint.
>                                 ;; still, not important at this point

The reason is that disjointness reasoning hasn't been all the way
completed yet.  Most of the infrastructure is there, but it hasn't
been hooked into the inference engine yet.  I'll see what it takes to
get that working, I don't think all that much.  The main reason I
(Continue reading)

Srini Ram | 4 Oct 2008 02:48
Picon
Favicon

Re: Assertion followed by retraction leads to error state...

Hi Hans

I agree it would be sufficient to get the contradiction warning in the disjoint case as well, similar to what we get for a simple statement
contradiction like (assert (poor jim)) followed by (assert (not (poor jim)).

I was just pointing out that the unassert only solves the problem in the latter case, but does nothing for the former. The contradiction warning,
followed by the user correcting as required, would cover both cases....

Thanks
Srini

----- Original Message ----
From: Hans Chalupsky <hans <at> ISI.EDU>
To: Srini Ram <srini_ramaswamy_i <at> yahoo.com>
Cc: powerloom-forum <at> ISI.EDU
Sent: Friday, October 3, 2008 2:41:14 PM
Subject: Re: [PowerLoom Forum] Assertion followed by retraction leads to error state...

Srini,

comments in-line:

>>>>> Srini Ram <srini_ramaswamy_i <at> yahoo.com> writes:

> Hi Hans
> What you say below may work in a limited way (unassert followed by assert) but can still fail as the following shows

> (defconcept person)
> (defconcept rich (?x person))
> (defconcept poor (?x person))
> (assert (disjoint rich poor))            ;; person can be rich or poor but not both


> (assert (rich jim))

> (retrieve all (rich ?x))
> #1: ?X=JIM                      ;; ok
> (retrieve all (poor ?x))
> No solutions.                  ;; ok
> (retrieve all (not (poor ?x)))
> No solutions.            ;; why dont i get jim, system can infer that jim is not poor
>                                ;; since jim is rich, and rich/poor are disjoint.
>                                ;; still, not important at this point

The reason is that disjointness reasoning hasn't been all the way
completed yet.  Most of the infrastructure is there, but it hasn't
been hooked into the inference engine yet.  I'll see what it takes to
get that working, I don't think all that much.  The main reason I
think why we've still been hedging on this were some performance
implications.

> (unassert (poor jim)) ;; whether it was asserted or not
> (assert (poor jim))    ;; jim is now poor..Note because of disjunction it should not be necessary               
>                                ;; to state jim is no longer rich.

Well, no.  Even if our disjointness module were complete, this is not
the behavior you would get.  We distinguish between two kinds of
truths, if you will (or epistemological status): assertions, where the
user told us that something holds, and inferences, which follow from
assertions and rules of logical inference.  The fact that poor <=> not
rich is an inference we (should) get from the disjointness assertion
which then contradicts the explicit assertion that he is rich.  But at
that point PowerLoom doesn't know what to do, you've told it two
(actually three) things that lead to a contradiction, which one is the
correct one?  It's not always the last one, since that could have
simply been a mistake on your part.

If you unassert poor, PowerLoom will not go out and try to infer all
things that logically contradict it and unassert those also.  Even if
it tried that, there are in fact two things required to support that
contradiction, the rich assertion and the disjointness assertion,
retracting either one would solve the conflict.  So which one should
we choose?  A standard dilemma in belief revision.  Of course, one
could special case this, but that would go a bit far, I think.

What you should get (sometime during backward or forward inference),
is a contradiction and an indicator what the reason is for the
contradiction, so that you can then make up your mind what you really
mean, i.e., whether Jim is really rich or poor or whether the two are
maybe not disjoint, and you can then perform the appropriate
maintenance.

Hans

> STELLA(28): (retrieve all (rich ?x))
> There is 1 solution:
>  #1: ?X=JIM                                              ;; error, doesnt seem to have gone away
> STELLA(29): (retrieve all (poor ?x))
> There is 1 solution:
>  #1: ?X=JIM
> STELLA(30): (retrieve all (not (poor ?x)))
> No solutions.
> STELLA(31): (retrieve all (not (rich ?x)))
> No solutions.

> Maybe I need to add more rules to make this work, but then what is the point of having the disjoint statement?

> Thanks
> Srini



> ----- Original Message ----
> From: Hans Chalupsky <hans <at> ISI.EDU>
> To: srini_ramaswamy_i <at> yahoo.com
> Cc: powerloom-forum <at> ISI.EDU
> Sent: Friday, September 26, 2008 6:10:21 PM
> Subject: Re:  Assertion followed by retraction leads to error state...

> Srini,

> a proposition has at most one truth value per module or context.  So,
> when you asserted `(not (person jim))', it replaced the previously
> asserted default truth value with FALSE (had the previous assertion
> been a strict truth, it would have complained about a contradiction).
> PowerLoom doesn't keep a history of prior truth values, so there is no
> way to get back to the previous truth value with a retraction.

> You might be able to get half of what you want by using `unassert'
> instead of retract.  With `unassert' you don't have to remember
> whether you asserted a truth or falsity.  So, you can simply call
> `unassert' before each new assertion that might override a previous
> truth value.  Conceivably, we could invent a command that combines the
> two into one.  For example,

> STELLA(3): (defconcept person)
> |c|PERSON
> STELLA(4): (unassert (person joe)) ;; ok, even if nothing was asserted yet
> |P?|(PERSON JOE)
> STELLA(5): (assert (not (person joe)))
> |P|(NOT (PERSON JOE))
> STELLA(6): (unassert (person joe))
> |P?|(PERSON JOE)
> STELLA(7): (assert (person joe))
> |P|(PERSON JOE)
> STELLA(8):

> Hans

>>>>> Srini Ram <srini_ramaswamy_i <at> yahoo.com> writes:

>> I am experimenting with default truths and retraction...
STELLA> (presume (person jim))   ; assume that jim is a person

>> |p|(PERSON JIM)

STELLA> (ask (person jim))

>> TRUE

STELLA> (assert (not (person jim)))  ;; we are told
>> specifically that jim is not a
>> person            Â

>> |P|(NOT (PERSON JIM))

STELLA> (ask (person jim))          ; ok
>> FALSE

STELLA> (retract (not (person jim)))  ;; retract
>> |P?|(PERSON JIM)

STELLA> (ask (person jim))

>> UNKNOWNÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
>> ;; wrong, we still have the presume
>> ;; so by adding and retracting a fact we wound up

>> ;; at a different state from where we started

>> What I would like to happen is that new facts should be able to
>> override old facts for cases where something can either be true or
>> false...Since jim is either a person or not a person, I should not have
>> to remember that I asserted that jim was not a person, and have to
>> retract it before asserting the new knowledge that jim is in fact a
>> person..From a maintenance perspective, this simplifies life a lot if
>> we can assert new knowledge and have it simply replace prior (default)
>> knowledge.



>      <html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;">Hi Hans<br><br>What you say below may work in a limited way (unassert followed by assert) but can still fail as the following shows<br><br>(defconcept person)<br>(defconcept rich (?x person))<br>(defconcept poor (?x person))<br>(assert (disjoint rich poor))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;; person can be rich or poor but not both<br><br><br>(assert (rich jim))<br><br>(retrieve all (rich ?x))<br>#1: ?X=JIM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;; ok<br>(retrieve all (poor ?x))<br>No solutions.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;
>  ok<br><span style="color: rgb(127, 0, 63);">(retrieve all (not (poor ?x)))</span><br style="color: rgb(127, 0, 63);"><span style="color: rgb(127, 0, 63);">No solutions.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;; why dont i get jim, system can infer that jim is not poor</span><br style="color: rgb(127, 0, 63);"><span style="color: rgb(127, 0, 63);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;; since jim is rich, and rich/poor are disjoint.</span><br style="color: rgb(127, 0, 63);"><span style="color: rgb(127, 0, 63);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;; still, not important at this point</span><br><br>(unassert (poor jim)) ;;
>  whether it was asserted or not<br>(assert (poor jim))&nbsp;&nbsp;&nbsp;&nbsp; ;; jim is now poor..Note because of disjunction it should not be necessary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;; to state jim is no longer rich.<br><br>STELLA(28): (retrieve all (rich ?x))<br>There is 1 solution:<br>&nbsp; #1: ?X=JIM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 0, 0);">;; error, doesnt seem to have gone away</span><br>STELLA(29): (retrieve all (poor ?x))<br>There
>  is 1 solution:<br>&nbsp; #1: ?X=JIM<br>STELLA(30): (retrieve all (not (poor ?x)))<br>No solutions.<br>STELLA(31): (retrieve all (not (rich ?x)))<br>No solutions.<br><br>Maybe I need to add more rules to make this work, but then what is the point of having the disjoint statement?<br><br>Thanks<br>Srini<br><br><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;">----- Original Message ----<br>From: Hans Chalupsky &lt;hans <at> ISI.EDU&gt;<br>To: srini_ramaswamy_i <at> yahoo.com<br>Cc: powerloom-forum <at> ISI.EDU<br>Sent: Friday, September 26, 2008 6:10:21 PM<br>Subject: Re:  Assertion followed by retraction leads to error state...<br><br>
> Srini,<br><br>a proposition has at most one truth value per module or context.&nbsp; So,<br>when you asserted `(not (person jim))', it replaced the previously<br>asserted default truth value with FALSE (had the previous assertion<br>been a strict truth, it would have complained about a contradiction).<br>PowerLoom doesn't keep a history of prior truth values, so there is no<br>way to get back to the previous truth value with a retraction.<br><br>You might be able to get half of what you want by using `unassert'<br>instead of retract.&nbsp; With `unassert' you don't have to remember<br>whether you asserted a truth or falsity.&nbsp; So, you can simply call<br>`unassert' before each new assertion that might override a previous<br>truth value.&nbsp; Conceivably, we could invent a command that combines the<br>two into one.&nbsp; For example,<br><br>STELLA(3): (defconcept person)<br>|c|PERSON<br>STELLA(4): (unassert (person joe)) ;; ok, even if nothing was
>  asserted yet<br>|P?|(PERSON JOE)<br>STELLA(5): (assert (not (person joe)))<br>|P|(NOT (PERSON JOE))<br>STELLA(6): (unassert (person joe))<br>|P?|(PERSON JOE)<br>STELLA(7): (assert (person joe))<br>|P|(PERSON JOE)<br>STELLA(8): <br><br>Hans<br><br>&gt;&gt;&gt;&gt;&gt; Srini Ram &lt;<a ymailto="mailto:srini_ramaswamy_i <at> yahoo.com" href="mailto:srini_ramaswamy_i <at> yahoo.com">srini_ramaswamy_i <at> yahoo.com</a>&gt; writes:<br><br>&gt; I am experimenting with default truths and retraction...<br>STELLA&gt; (presume (person jim))Â&nbsp;Â&nbsp; ; assume that jim is a person<br><br>&gt; |p|(PERSON JIM)<br><br>STELLA&gt; (ask (person jim))<br><br>&gt; TRUE<br><br>STELLA&gt; (assert (not (person jim)))Â&nbsp; ;; we are told<br>&gt; specifically that jim is not a<br>&gt; personÂ&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;<br><br>&gt; |P|(NOT (PERSON JIM))<br><br>STELLA&gt; (ask (person
>  jim))Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp; ; ok<br>&gt; FALSE<br><br>STELLA&gt; (retract (not (person jim)))Â&nbsp; ;; retract<br>&gt; |P?|(PERSON JIM)<br><br>STELLA&gt; (ask (person jim))<br><br>&gt; UNKNOWNÂ&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;Â&nbsp;<br>&gt; ;; wrong, we still have the presume<br>&gt; ;; so by adding and retracting a fact we wound up<br><br>&gt; ;; at a different state from where we started<br><br>&gt; What I would like to happen is that new facts should be able to<br>&gt; override old facts for cases where something can either be true or<br>&gt; false...Since jim is either a person or not a person, I should not have<br>&gt; to remember that I asserted that
>  jim was not a person, and have to<br>&gt; retract it before asserting the new knowledge that jim is in fact a<br>&gt; person..From a maintenance perspective, this simplifies life a lot if<br>&gt; we can assert new knowledge and have it simply replace prior (default)<br>&gt; knowledge.<br></div></div></div><br>

>      </body></html>_______________________________________________
> powerloom-forum mailing list
> powerloom-forum <at> isi.edu
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum

_______________________________________________
powerloom-forum mailing list
powerloom-forum <at> isi.edu
http://mailman.isi.edu/mailman/listinfo/powerloom-forum
Srini Ram | 29 Oct 2008 18:49
Picon
Favicon

Question about representing frame information and unification in PL

I found the following example in the documentation for the Knowledge Machine from UOfTexas...

;;; "Every big car has a large engine."
KM> (every Big-Car has
           (parts ((a Engine with
                      (size (*Large))))))

;;; "Every powerful car has a powerful engine."
KM> (every Powerful-Car has    
           (parts ((a Engine with
                      (power (*Lots))))))

Question 1: How would we we represent above in Powerloom
  Here is my shot at it
(defconcept Car)
(defconcept Size (?x)
  :axioms ( andn>
                (Size large)
                (Size small)
                (Size medium)
                (closed Size)))
   
(defconcept Power (?x)
  :axioms ( and
                (Power lots)
                (Power little)
   &n bsp;            (Power medium)
                (closed Power)))
 


(defconcept Car-Part)
(defconcept Engine (?x Car-Part))
(deff unction car-engine ((?x Car)) :-> (?y Engine))
(deffunction part-size ((?x Car-Part)) :-> (?y Size))
(deffunction part-power ((?x Car-Part)) :-> (?y Power))
;; the above is not quite correct...some parts may have only a size or a power, but not both
;; every part must have one of the two properties..not sure how i say this in a meta-relation. I can then
;; use the meta-relation to say that engine has size as well as power relations, tire has size but not
;; power etc.

(defconcept Big-Car (?x Car)
   :=>  (= (part-size (car-engine ?x)) large))

(defconcept Powerful-Car (?x Car)
   :=>  (= (part-power (car-engine ?x)) lots))
 
It is more verbose than the KM version and less intuitive. Could I have used some PL features e.g definstance to make the code more readable?

;; The KM example continues as follows
;;; "Suburbans are both big and powerful cars."
KM> (Suburban has (superclasses (Big-Car Powerful-Car)))

I defined this in PL as :
(defconcept Suburban (?x Big-Car Powerful-Car))



;; KM then shows its unification powers
;;; "What are the parts of a Suburban?"
KM> (the parts of (a Suburban))
(COMMENT: (_Engine7 && _Engine8) unified to be _Engine7)
(_Engine7)

Question 2: Would the unification work the same way in PowerLoom or is the behavior slightly different
The output from PL code above is:

STELLA> (retrieve all (= ?x (Car-Engine t1)))
There is 1 solution:
  #1: ?X=|SK|(CAR-ENGINE T1)                                          ;; Seems to work ok...there is only one engine not two
STELLA> (retrieve all (= ?sz (part-size (Car-Engine t1))))
There is 1 solution:
  #1: ?SZ=LARGE                                                             ;; and that engine has the correct
STELLA> (retrieve all (= ?sz (part-quantity (Car-Engine t1))))
There is 1 solution:
  #1: ?SZ=LOTS                                                                ;; properties


KM has some other frame features that are useful to make the code clearer /concise
1. Embedded frames
;;; "Joe is a person, and owns a red car."
KM> (*Joe has
          (instance-of (Person))
          (owns ((a Car with
                    (color (*Red))))))

Not sure if this can be done in PL without creating a PL instance of car and using the owns relation to relate Joe to that car instance i.e we cannot have embedded powerloom instances... I may be missing the proper use of the frame syntax of PowerLoom that makes this possible.

Thanks
Srini

_______________________________________________
powerloom-forum mailing list
powerloom-forum <at> isi.edu
http://mailman.isi.edu/mailman/listinfo/powerloom-forum
Srini Ram | 29 Oct 2008 19:20
Picon
Favicon

Re: Question about representing frame information and unification in PL

Actually I made a mistake by defining car-engine as a function. Of course, it would always return one value.

Here is the new code

(defconcept Car)
(defconcept Size (?x)
  :axioms ( and
                (Size large)
                (Size small)
                (Size medium)
                (closed Size)))
& nbsp;  
(defconcept Power (?x)
  :axioms ( and
                (Power lots)
                (Power little)
                (Power medium)
                (closed Power)))
 
(defconcept Car-Part)
(defconcept Engine (?x Car-Part))
(defrelation car-engine ((?x Car) (?y Engine)))
(deffunction part-size ((?x Car-Part)) :-> (?y Size))
(deffunction part-power ((?x Car-Part)) :-> (?y Power))

(defconcept Big-Car (?x Car)
   :=>  (exists (?y) (and (car-engine ?x ?y) (= (part-size ?y) large))))

(defconcept Powerful-Car (?x Car)   :=>  (exists (?y) (and (car-engine ?x ?y) (= (part-power ?y) lots))))


;;; "Suburbans are both big and powerful cars."
;;; KM> (Suburban has (superclasses (Big-Car Powerful-Car)))

(defconcept Suburban (?x Big-Car Powerful-Car))

;; Create one car
(assert (Suburban t1))


;; Now ask about its engine
(retrieve all (Car-Engine t1 ?x))
There are 2 solutions:
  #1: ?X=sk18
  #2: ?X=sk20

Voila...the unification does not seem to have taken place. Should I add an axiom that every car has at most one engine? I guess this may not force unification -- what it would would cause some kind of warning/error..

Srini

From: Srini Ram <srini_ramaswamy_i <at> yahoo.com>
To: powerloom-forum <at> ISI.EDU
Sent: Wednesday, October 29, 2008 1:49:59 PM
Subject: Question about representing frame information and unification in PL

I found the following example in the documentation for the Knowledge Machine from UOfTexas...

;;; "Every big car has a large engine."
KM> (every Big-Car has
           (parts ((a Engine with
                      (size (*Large))))))

;;; "Every powerful car has a powerful engine."
KM> (every Powerful-Car has    
           (parts ((a Engine with
                      (power (*Lots))))))

Question 1: How would we we represent above in Powerloom
  Here is my shot at it
(defconcept Car)
(defconcept Size (?x)
  :axioms ( andn>
                (Size large)
                (Size small)
                (Size medium)
                (closed Size)))
   
(defconcept Power (?x)
  :axioms ( and
                (Power lots)
                (Power little)
   &n bsp;            (Power medium)
                (closed Power)))
 


(defconcept Car-Part)
(defconcept Engine (?x Car-Part))
(deff unction car-engine ((?x Car)) :-> (?y Engine))
(deffunction part-size ((?x Car-Part)) :-> (?y Size))
(deffunction part-power ((?x Car-Part)) :-> (?y Power))
;; the above is not quite correct...some parts may have only a size or a power, but not both
;; every part must have one of the two properties..not sure how i say this in a meta-relation. I can then
;; use the meta-relation to say that engine has size as well as power relations, tire has size but not
;; power etc.

(defconcept Big-Car (?x Car)
   :=>  (= (part-size (car-engine ?x)) large))

(defconcept Powerful-Car (?x Car)
   :=>  (= (part-power (car-engine ?x)) lots))
 
It is more verbose than the KM version and less intuitive. Could I have used some PL features e.g definstance to make the code more readable?

;; The KM example continues as follows
;;; "Suburbans are both big and powerful cars."
KM> (Suburban has (superclasses (Big-Car Powerful-Car)))

I defined this in PL as :
(defconcept Suburban (?x Big-Car Powerful-Car))



;; KM then shows its unification powers
;;; "What are the parts of a Suburban?"
KM> (the parts of (a Suburban))
(COMMENT: (_Engine7 && _Engine8) unified to be _Engine7)
(_Engine7)

Question 2: Would the unification work the same way in PowerLoom or is the behavior slightly different
The output from PL code above is:

STELLA> (retrieve all (= ?x (Car-Engine t1)))
There is 1 solution:
  #1: ?X=|SK|(CAR-ENGINE T1)                                          ;; Seems to work ok...there is only one engine not two
STELLA> (retrieve all (= ?sz (part-size (Car-Engine t1))))
There is 1 solution:
  #1: ?SZ=LARGE                                                             ;; and that engine has the correct
STELLA> (retrieve all (= ?sz (part-quantity (Car-Engine t1))))
There is 1 solution:
  #1: ?SZ=LOTS                                                                ;; properties


KM has some other frame features that are useful to make the code clearer /concise
1. Embedded frames
;;; "Joe is a person, and owns a red car."
KM> (*Joe has
          (instance-of (Person))
          (owns ((a Car with
                    (color (*Red))))))

Not sure if this can be done in PL without creating a PL instance of car and using the owns relation to relate Joe to that car instance i.e we cannot have embedded powerloom instances... I may be missing the proper use of the frame syntax of PowerLoom that makes this possible.

Thanks
Srini


_______________________________________________
powerloom-forum mailing list
powerloom-forum <at> isi.edu
http://mailman.isi.edu/mailman/listinfo/powerloom-forum
Thomas Russ | 29 Oct 2008 20:35
Picon
Favicon

Re: Question about representing frame information and unification in PL


On Oct 29, 2008, at 10:49 AM, Srini Ram wrote:

> I found the following example in the documentation for the Knowledge  
> Machine from UOfTexas...
>
> ;;; "Every big car has a large engine."
> KM> (every Big-Car has
>            (parts ((a Engine with
>                       (size (*Large))))))
>
> ;;; "Every powerful car has a powerful engine."
> KM> (every Powerful-Car has
>            (parts ((a Engine with
>                       (power (*Lots))))))
>
> Question 1: How would we we represent above in Powerloom
>   Here is my shot at it
> (defconcept Car)
> (defconcept Size (?x)
>   :axioms ( and
>                 (Size large)
>                 (Size small)
>                 (Size medium)
>                 (closed Size)))

;; I would write this concept as an explicit definition in terms of
;; the set of instances.  PowerLoom will then conclude that it must
;; be closed because there is an explicitly enumerated list.

   (defconcept Size (?x) :<=> (member-of ?x (setof large small medium)))

>
> (defconcept Power (?x)
>   :axioms ( and
>                 (Power lots)
>                 (Power little)
>                 (Power medium)
>                 (closed Power)))

;; Similarly

(defconcept Power (?x) :<=> (member-of ?x (setof lost little medium)))

> (defconcept Car-Part)
> (defconcept Engine (?x Car-Part))
> (deffunction car-engine ((?x Car)) :-> (?y Engine))
> (deffunction part-size ((?x Car-Part)) :-> (?y Size))
> (deffunction part-power ((?x Car-Part)) :-> (?y Power))
> ;; the above is not quite correct...some parts may have only a size  
> or a power, but not both
> ;; every part must have one of the two properties..not sure how i  
> say this in a meta-relation. I can then
> ;; use the meta-relation to say that engine has size as well as  
> power relations, tire has size but not
> ;; power etc.

;; You don't really need a meta-relation to say this in particular.
;; You could make this a requirement directly:

(=> (car-part ?part) (or (exists (?size) (part-size ?part ?size))
                          (exists (?power) (part-power ?part ?power))))

;; But there will be limited inference, since disjunctions are pretty
;; weak constraints.  For the case of Engine and Tire you would get

(defconcept Engine (Car-Part ?x)
    :=> (and (exists (?size) (part-size ?part ?size))
             (exists (?power) (part-power ?part ?power))))

(defconcept Tire (Car-Part ?x)
    :=> (and (exists (?size) (part-size ?part ?size))
             (not (exists (?power) (part-power ?part ?power)))))

;; But this is an area of PowerLoom where we haven't really put
;; a lot of effort into making sure you get inferences or clashes.

> (defconcept Big-Car (?x Car)
>    :=>  (= (part-size (car-engine ?x)) large))
>
> (defconcept Powerful-Car (?x Car)
>    :=>  (= (part-power (car-engine ?x)) lots))
>
> It is more verbose than the KM version and less intuitive. Could I  
> have used some PL features e.g definstance to make the code more  
> readable?
>
> ;; The KM example continues as follows
> ;;; "Suburbans are both big and powerful cars."
> KM> (Suburban has (superclasses (Big-Car Powerful-Car)))
>
> I defined this in PL as :
> (defconcept Suburban (?x Big-Car Powerful-Car))
>
>
>
> ;; KM then shows its unification powers
> ;;; "What are the parts of a Suburban?"
> KM> (the parts of (a Suburban))
> (COMMENT: (_Engine7 && _Engine8) unified to be _Engine7)
> (_Engine7)
>
> Question 2: Would the unification work the same way in PowerLoom or  
> is the behavior slightly different
> The output from PL code above is:
>
> STELLA> (retrieve all (= ?x (Car-Engine t1)))
> There is 1 solution:
>   #1: ?X=|SK|(CAR-ENGINE  
> T1)                                          ;; Seems to work  
> ok...there is only one engine not two
> STELLA> (retrieve all (= ?sz (part-size (Car-Engine t1))))
> There is 1 solution:
>   #1: ? 
> SZ 
> = 
> LARGE                                                             ;;  
> and that engine has the correct
> STELLA> (retrieve all (= ?sz (part-quantity (Car-Engine t1))))
> There is 1 solution:
>   #1: ? 
> SZ 
> = 
> LOTS 
>                                                                 ;;  
> properties

Well, the actual mechanisms might be a bit different.
PowerLoom would have a single skolem instance for the car-engine  
(created because it's a function), and then the attributes are just  
asserted about that skolem.  Unification would only really come into  
play if there were some equivalence assertion between two skolems or a  
skolem and an instance -- either explicitly or implicitly.

So if one were to

     (assert (car-engine t1 e326))

then the skolem and the instance e326 would be unified.
Similarly this could also be done with more than one skolem:

(deffunction favorite-object ((?x Person)) :-> ?x)

   (assert (= (favorite-object Joe) (car-engine t1)))

this would equate the skolems, without needing a concrete instance.

> KM has some other frame features that are useful to make the code  
> clearer /concise
> 1. Embedded frames
> ;;; "Joe is a person, and owns a red car."
> KM> (*Joe has
>           (instance-of (Person))
>           (owns ((a Car with
>                     (color (*Red))))))
>
> Not sure if this can be done in PL without creating a PL instance of  
> car and using the owns relation to relate Joe to that car instance  
> i.e we cannot have embedded powerloom instances... I may be missing  
> the proper use of the frame syntax of PowerLoom that makes this  
> possible.

What you can use is existential quantification.  That is essentially  
what the "a" operator in KM means:

(assert (and (Person Joe)
              (exists (?joes-car)
                  (and (Car ?joes-car)
                       (owns Joe ?joes-car)
                       (color ?joes-car Red)))))

This seems fairly comparable to what the KM form looks like.

PowerLoom does have some frame predicates

    (retrieve ?p (frame-predicate ?p))

but since we haven't really had applications that needed to reason  
with them, the reasoning is not as extensive as you would get in a  
description logic like Loom or OWL.  There is no inherent reason that  
couldn't be added, but it hasn't been a priority for us.

There is also the complication that the more expressive language of  
PowerLoom means there are other logically equivalent ways to state,  
for example, a minimum 1 cardinality.  But they aren't currently  
handled by the axioms and inference machinery.  Partly that is lack of  
effort and partly fear that we can't do it efficiently.  For example:

    (Car ?x) => (range-min-cardinality ?x has-engine 1)

    (Car ?x) => (exists ?e (has-engine ?x ?e))

are logically equivalent, but PowerLoom doesn't have the axioms to  
conclude this.
Hans Chalupsky | 30 Oct 2008 03:32
Picon
Favicon

Re: Question about representing frame information and unification in PL

Srini,

I would contend that the PL definition

(defconcept Big-Car (?x Car)
   :=>  (= (part-size (car-engine ?x)) large))

is not any more verbose than the KM statement

(every Big-Car has 
       (parts ((a Engine with (size (*Large))))))

albeit maybe somewhat less readable (depending on your particular
logic persuasion).

KM also uses definitions for classes and slots such as "Engine" and
"size" which you omitted.  If you had included those, the two KBs would
have been rather similar in size.  I'm not sure whether you can define
instances in KM without also defining the classes and slots that you
reference, in PowerLoom that's not an option.

However, the KM syntax is interesting in that it allows you to keep
some variables implicit (somewhat similar to description logics).
There is no way you can say this without variables in PowerLoom, but
it wouldn't be too hard to write a little front-end translator to
recognize expressions of this kind.

With respect to unification, defining `car-engine' as a function was
the right thing to do, since it automatically ensured that there was
only one engine per car and all the properties from the separate
classes were attached to it just like in KM.  

KM also has a feature called "heuristic unification" that
automatically equivalences skolems based on certain heuristics (that I
don't fully understand :-).  That addresses an interesting problem
with logic where you often have to introduce anonymous skolem objects
and later on you face the problem that they are not automatically
getting equivalenced with actual instances you know about, since that
would require additional identity statemtents.  Since KM uses a
heuristic procedure, it is not logically sound and can get things
wrong in some cases; nevertheless, it tries to address an interesting
issue.

With respect to nested instance definitions, that wouldn't be too hard
to do.  I've actually played around with that in the past somewhat
inspired by F-Logic (which has its own arcane syntax :-), but never
had an application where it mattered enough to force the issue.

However, you don't really need that machinery.  Tom already showed you
how to do it with an exists.  You can also use PowerLoom's automatic
instances.  For example:

(assert (and (Person Joe)
             (Car $car)
             (owns Joe $car)
             (color $car Red)))))

The $ sign acts like a Lisp gensym call and will create a new
identifier with the symbol name as a prefix that you then can
reference within the same expression.  For example:

STELLA(7): (assert (and (Person Joe)
             (Car $car)
             (owns Joe $car)
             (color $car Red)))
(|P|(PERSON JOE) |P|(CAR CAR-000) |P|(OWNS JOE CAR-000) |P|(COLOR CAR-000 RED))

STELLA(8): (assert (and (Person Sue)
             (Car $car)
             (owns Sue $car)
             (color $car Red)))
(|P|(PERSON SUE) |P|(CAR CAR-001) |P|(OWNS SUE CAR-001) |P|(COLOR CAR-001 RED))
STELLA(9): 

Note that the second time around we created a new instance different
from Joe's car.  This is useful so you don't have to think of new
instance names all the time.  Moreover, it creates real non-skolem
instances, therefore, PowerLoom would be able to infer from the above
that Joe's car and Sue's car are not the same (using the unique names
assumption).  With the exists formulation, that would not be possible
without explicitly asserting that they are not the same.

In general, it is a valid enterprise to come up with more concise and
intuitive languages for KR.  KM is one such attempt, and there are
others.  For us, however, that probably won't be a priority for a
while, since moving more towards a standard such as Common Logic and
better supporting some of the Semantic Web languages seems to be more
important at the moment.

Hans

>>>>> Srini Ram <srini_ramaswamy_i <at> yahoo.com> writes:

> I found the following example in the documentation for the Knowledge Machine from UOfTexas...
> ;;; "Every big car has a large engine."
KM> (every Big-Car has 
>            (parts ((a Engine with 
>                       (size (*Large))))))

> ;;; "Every powerful car has a powerful engine."
KM> (every Powerful-Car has     
>            (parts ((a Engine with 
>                       (power (*Lots))))))

> Question 1: How would we we represent above in Powerloom
>   Here is my shot at it

> (defconcept Car)
> (defconcept Size (?x)
>   :axioms ( and
>                 (Size large)
>                 (Size small)
>                 (Size medium)
>                 (closed Size)))

> (defconcept Power (?x)
>   :axioms ( and
>                 (Power lots)
>                 (Power little)
>                 (Power medium)
>                 (closed Power)))

> (defconcept Car-Part)
> (defconcept Engine (?x Car-Part))
> (deffunction car-engine ((?x Car)) :-> (?y Engine))
> (deffunction part-size ((?x Car-Part)) :-> (?y Size))
> (deffunction part-power ((?x Car-Part)) :-> (?y Power))
> ;; the above is not quite correct...some parts may have only a size or a power, but not both
> ;; every part must have one of the two properties..not sure how i say this in a meta-relation. I can then
> ;; use the meta-relation to say that engine has size as well as power relations, tire has size but not
> ;; power etc.

> (defconcept Big-Car (?x Car)
>    :=>  (= (part-size (car-engine ?x)) large))

> (defconcept Powerful-Car (?x Car)
>    :=>  (= (part-power (car-engine ?x)) lots))

> It is more verbose than the KM version and less intuitive. Could I have used some PL features e.g
definstance to make the code more readable?

> ;; The KM example continues as follows
> ;;; "Suburbans are both big and powerful cars."
KM> (Suburban has (superclasses (Big-Car Powerful-Car)))

> I defined this in PL as :

> (defconcept Suburban (?x Big-Car Powerful-Car))

> ;; KM then shows its unification powers
> ;;; "What are the parts of a Suburban?"
KM> (the parts of (a Suburban))
> (COMMENT: (_Engine7 && _Engine8) unified to be _Engine7)
> (_Engine7)

> Question 2: Would the unification work the same way in PowerLoom or is the behavior slightly different
> The output from PL code above is:

STELLA> (retrieve all (= ?x (Car-Engine t1)))
> There is 1 solution:
>   #1: ?X=|SK|(CAR-ENGINE T1)                                         ;; Seems to work ok...there is only one engine not two
STELLA> (retrieve all (= ?sz (part-size (Car-Engine t1))))
> There is 1 solution: 
>   #1: ?SZ=LARGE                                                            ;; and that engine has the correct
STELLA> (retrieve all (= ?sz (part-quantity (Car-Engine t1))))
> There is 1 solution:
>   #1: ?SZ=LOTS                                                                ;; properties

> KM has some other frame features that are useful to make the code clearer /concise
> 1. Embedded frames
> ;;; "Joe is a person, and owns a red car."
KM> (*Joe has 
>           (instance-of (Person))
>           (owns ((a Car with 
>                     (color (*Red))))))

> Not sure if this can be done in PL without creating a PL instance of car and using the owns relation to relate
Joe to that car instance i.e we cannot have embedded powerloom instances... I may be missing the proper use
of the frame syntax of PowerLoom that makes this possible.

> Thanks
> Srini

>       <html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div
style="font-family:arial,helvetica,sans-serif;font-size:10pt"><span style="color: rgb(0, 0,
127);">I found the following example in the documentation for the <span style="text-decoration:
underline;">Knowledge Machine from UOfTexas..</span>.</span><br><br><div style="margin-left:
40px;">;;; "Every big car has a large engine."<br>KM&gt; (every Big-Car has
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (parts ((a Engine with
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(size (*Large))))))<br><br>;;; "Every powerful car has a powerful engine."<br>KM&gt; (every
Powerful-Car has&nbsp;&nbsp;&nbsp;&nb
 sp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (parts ((a Engine with
> 
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(power (*Lots))))))<br></div><br><span style="color: rgb(0, 0, 127);"><span style="font-weight:
bold;">Question 1:</span> How would we we represent above in Powerloom</span><br style="color:
rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">&nbsp; Here is my shot at it</span><br><div
style="margin-left: 80px;">(<span style="font-weight: bold; color: rgb(128, 0, 0);">defconcept
Car)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold;
color: rgb(128, 0, 0);">(defconcept Size (?x)</span><br style="font-weight: bold; color: rgb(128,
0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp; :axioms ( and</s
 pan><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color:
rgb(128, 0,
> 
0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(Size large)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
style="font-weight: bold; color: rgb(128, 0,
0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(Size small)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
style="font-weight: bold; color: rgb(128, 0,
0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(Size medium)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
style="font-weight: bold; color: rgb(128, 0,
0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(closed Size)))</span><br style="font-we
 ight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0,
0);">&nbsp;&nbsp;&nbsp; </span><br style="font-weight: bold; color: rgb(128, 0,
>  0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Power (?x)</span><br
style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128,
0, 0);">&nbsp; :axioms ( and</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
style="font-weight: bold; color: rgb(128, 0,
0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(Power lots)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
style="font-weight: bold; color: rgb(128, 0,
0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(Power little)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Power
medium)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
>  style="font-weight: bold; color: rgb(128, 0,
0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(closed Power)))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp; </span><br style="font-weight: bold;
color: rgb(128, 0, 0);"><br style="font-weight: bold; color: rgb(128, 0, 0);"><br
style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128,
0, 0);">(defconcept Car-Part)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Engine (?x Car-Part))</span><br
style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128,
0, 0);">(de
 ffunction car-engine ((?x Car)) :-&gt; (?y Engine))</span><br style="font-weight: bold; color:
rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0,
>  0);">(deffunction part-size ((?x Car-Part)) :-&gt; (?y Size))</span><br style="font-weight: bold;
color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(deffunction
part-power ((?x Car-Part)) :-&gt; (?y Power))<br><span style="color: rgb(0, 0, 127);">;; the above is
not quite correct...some parts may have only a size or a power, but not both</span><br style="color:
rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">;; every part must have one of the two
properties..not sure how i say this in a meta-relation. I can then</span><br style="color: rgb(0, 0,
127);"><span style="color: rgb(0, 0, 127);">;; use the meta-relation to say that engine has size as well
as power relations, tire has size but not</span><br style="color: rgb(0, 0, 127);"><span
style="color: r
 gb(0, 0, 127);">;; power etc.</span><br style="font-weight: bold; color: rgb(128, 0, 0);"></span><br
style="font-weight: bold; color: rgb(128, 0, 0);"><span
>  style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Big-Car (?x Car)</span><br
style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128,
0, 0);">&nbsp;&nbsp; :=&gt;&nbsp; (= (part-size (car-engine ?x)) large))</span><br
style="font-weight: bold; color: rgb(128, 0, 0);"><br style="font-weight: bold; color: rgb(128, 0,
0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Powerful-Car (?x
Car)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold;
color: rgb(128, 0, 0);">&nbsp;&nbsp; :=&gt;&nbsp; (= (part-power (car-engine ?x))
lots))</span><br></div>&nbsp;<br><span style="color: rgb(0, 0, 127); font-weight: bold;">It is
more verbose than the KM version and less intuitive. Could I hav
 e used some PL features e.g definstance to make the code more readable?</span><br><br>;; The KM example
continues as follows<br>;;; "Suburbans are both big and powerful
>  cars."<br>KM&gt; (Suburban has (superclasses (Big-Car Powerful-Car)))<br><br><span
style="color: rgb(0, 0, 127);">I defined this in PL as :</span><br><div style="margin-left:
40px;"><div style="margin-left: 40px;"><span style="font-weight: bold; color: rgb(128, 0,
0);">(defconcept Suburban (?x Big-Car Powerful-Car))</span><br></div></div><br><br><br>;; KM
then shows its unification powers<br>;;; "What are the parts of a Suburban?"<br>KM&gt; (the parts of (a
Suburban))<br>(COMMENT: (_Engine7 &amp;&amp; _Engine8) unified to be
_Engine7)<br>(_Engine7)<br><br><span style="color: rgb(0, 0, 255);"><span style="font-weight:
bold;">Question 2</span>: Would the unification work the same way in PowerLoom or is the behavior
slightly different</span><br><span style="color: rgb(0, 0, 127);">The outp
 ut from PL code above is:</span><br><br style="color: rgb(128, 0, 0);"><div style="margin-left:
40px;"><span style="color: rgb(128, 0, 0);">STELLA&gt; (retrieve all (= ?x
>  (Car-Engine t1)))</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0,
0);">There is 1 solution:</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0,
0);">&nbsp; #1: ?X=|SK|(CAR-ENGINE
T1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color: rgb(0, 0, 127);"> </span></span><span style="font-weight: bold; color: rgb(0, 0,
127);">;; Seems to work ok...there is only one engine not two</span><br style="color: rgb(128, 0,
0);"><span style="color: rgb(128, 0, 0);">STELLA&gt; (retrieve all (= ?sz (part-size (Car-Engine
t1))))</span><br style="col
 or: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">There is 1 solution: </span><br
style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">&nbsp; #1:
>  ?SZ=</span><span style="font-weight: bold; color: rgb(128, 0,
0);">LARGE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
style="color: rgb(0, 0, 127);"> ;; and that engine has the correct</span></span><br style="color:
rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">STELLA&gt; (retrieve all (= ?sz (part-quantity
(Car-Engine t1))))</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0,
0);">There is 1 solution:</span><br style="color: rgb(128, 0, 0);"><
 span style="color: rgb(128, 0, 0);">&nbsp; #1: ?SZ=</span><span style="font-weight: bold; color:
rgb(128, 0,
> 
0);">LOTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="color: rgb(0, 0, 127);">;; properties<br><br></span></span></div><span
style="font-weight: bold; color: rgb(128, 0, 0);"><span style="color: rgb(0, 0,
127);"></span></span><br><span style="font-weight: bold; color: rgb(128, 0, 0);"><span
style="color: rgb(0, 0, 127);"></span></span><span style="font-weight: bold; color: rgb(128, 0,
0);"></span>KM has some other frame features that are useful t
 o make the code clearer /concise<br>1. Embedded frames<br>;;; "Joe is a person, and owns a red
car."<br>KM&gt; (*Joe has
>  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (instance-of
(Person))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (owns ((a Car with
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(color (*Red))))))<br><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">Not
sure if this can be done in PL without creating a PL instance of car and using the owns relation to relate Joe
to that car instance i.e we cannot have embedded powerloom instances... I may be missing the proper use of
the frame syntax of PowerLoom that makes this possible.</span><br><span style="font-weight: bold;
color: rgb(128, 0, 0);"><span style="color: rgb(0, 0, 127);"></span></span><br>Thanks<br>Srini<br></div><
 br>

>       </body></html>_______________________________________________
> powerloom-forum mailing list
> powerloom-forum <at> isi.edu
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum
Srini Ram | 30 Oct 2008 15:45
Picon
Favicon

Re: Question about representing frame information and unification in PL

Thanks Hans

The use of the PL automatic instances allows one to create  objects and sub-objects. This is useful
for some degree of colocating of facts relating to the same object.

Does the syntactic sugar provided by definstance allow one to say
    (definstance Joe :person true :owns (definstance $car :car true :color red))
instead of what you wrote below..
(assert (and (Person Joe)
    &n bsp;       (Car $car)
            (owns Joe $car)
            (color $car Red)))))


The idea behind the specification I wrote above is not just convenience, but also maintanability --- When I remove the fact that joe is a person from the KB, I expect (in this case) the facts about his car, house, body parts etc. to automatically be deleted instead of having to do this manually as would be the case for the example you gave -- if joe perishes in a car crash :-) we have to retract  (person joe), (car $car), (owns joe $car) explicitly.
Is there any way to tag a set of assertions, so that you can just re tract them as a group?

You wrote below:
With respect to unification, defining `car-engine' as a function was
the right thing to do, since it automatically ensured that there was
only one engine per car and all the properties from the separate
classes were attached to it just like in KM. 

However, that is true only for the example I used, since there is only one engine per car
and a function allows only one return value.

However, to take another example,
if you have the following classification
Person -- has two eyes
    Blue-eyed person
    Black-eyed person

Than any object which derives from both blue and black eyed persons should have two eyes (color tbd), not four.
I guess this is the unification I was wonder ing about.

I think my question really was, how does Powerloom deal with multiple inheritance
where the same attribute is defined in two superclasses
-- in the case of clashing attributes(as in the case above where  it is not clear where the child object should have two blue eyes, or two brown eyes, but because Person has two eyes, we know that the child will have two eyes - we should be able to unambiguously answer questions relating to the number of eyes, but not their color)
-- in the case of non-clashing attributes(as in the engine example).

Thanks
Srini




From: Hans Chalupsky <hans <at> ISI.EDU>
To: Srini Ram <srini_ ramaswamy_i <at> yahoo.com>
Cc: powerloom-forum <at> ISI.EDU
Sent: Wednesday, October 29, 2008 10:32:19 PM
Subject: Re: Question about representing frame information and unification in PL

Srini,

I would contend that the PL definition

(defconcept Big-Car (?x Car)
  :=>  (= (part-size (car-engine ?x)) large))

is not any more verbose than the KM statement

(every Big-Car has
      (parts ((a Engine with (size (*Large))))))

albeit maybe somewhat less readable (depending on your particular
logic persuasion).

KM also uses definitions for classes and slots such as "Engine" and
"size" which you omitted.  If you had included those, the two KBs would
have been rather similar in size.  I'm not sure whether you can define
instances in KM without also defining the classes and slots that you
reference, in PowerLoom that's not an option.

However, the KM syntax is interesting in th at it allows you to keep
some variables implicit (somewhat similar to description logics).
There is no way you can say this without variables in PowerLoom, but
it wouldn't be too hard to write a little front-end translator to
recognize expressions of this kind.

With respect to unification, defining `car-engine' as a function was
the right thing to do, since it automatically ensured that there was
only one engine per car and all the properties from the separate
classes were attached to it just like in KM. 

KM also has a feature called "heuristic unification" that
automatically equivalences skolems based on certain heuristics (that I
don't fully understand :-).  That addresses an interesting problem
with logic where you often have to introduce anonymous skolem objects
and later on you face the problem that they are not automatically
getting equivalenced with actual instances you know about , since that
would require additional identity statemtents.  Since KM uses a
heuristic procedure, it is not logically sound and can get things
wrong in some cases; nevertheless, it tries to address an interesting
issue.

With respect to nested instance definitions, that wouldn't be too hard
to do.  I've actually played around with that in the past somewhat
inspired by F-Logic (which has its own arcane syntax :-), but never
had an application where it mattered enough to force the issue.

However, you don't really need that machinery.  Tom already showed you
how to do it with an exists.  You can also use PowerLoom's automatic
instances.  For example:

(assert (and (Person Joe)
            (Car $car)
            (owns Joe $car)
            (color $car Red)))))

The $ sign acts li ke a Lisp gensym call and will create a new
identifier with the symbol name as a prefix that you then can
reference within the same expression.  For example:

STELLA(7): (assert (and (Person Joe)
            (Car $car)
            (owns Joe $car)
            (color $car Red)))
(|P|(PERSON JOE) |P|(CAR CAR-000) |P|(OWNS JOE CAR-000) |P|(COLOR CAR-000 RED))

STELLA(8): (assert (and (Person Sue)
            (Car $car)
            (owns Sue $car)
            (color $car Red)))
(|P|(PERSON SUE) |P|(CAR CAR-001) |P|(OWNS SUE CAR-001) |P|(COLOR CAR-001 RED))
STELLA(9):

Note that the second time around we created a new instance different
from Joe's car.  This is useful so you don't have to think of new
instance names all the time.  Moreover, it creates real non-skolem
instances, therefore, PowerLoom would be able to infer from the above
that Joe's car and Sue's car are not the same (using the unique names
assumption).  With the exists formulation, that would not be possible
without explicitly asserting that they are not the same.

In general, it is a valid enterprise to come up with more concise and
intuitive languages for KR.  KM is one such attempt, and there are
others.  For us, however, that probably won't be a priority for a
while, since moving more towards a standard such as Common Logic and
better supporting some of the Semantic Web languages seems to be more
important at the moment.

Hans

>>>>> Srini Ram <srini_ramaswamy_i <at> yahoo.com> writes:

> I found the following example in the documentation for the Knowledge Machine from UOfTexas...
> ;;; "Every big car has a large engine."
KM> (every Big-Car has
>            (parts ((a Engine with
>                      (size (*Large))))))

> ;;; "Every powerful car has a powerful engine."
KM> (every Powerful-Car has   
>            (parts ((a Engine with
>                      (power (*Lots))))))

> Question 1: How would we we represent above in Powerloom
>  Here is my shot at it

> (defconcept Car)
> (defconcept Size (?x)
>  :axioms ( and
>                (Size large)
>                (Size small)
>                (Size medium)
>                (closed Size)))
   
> (defconcept Power (?x)
>  :axioms ( and
>                (Power lots)
>                (Power little)
>                (Power medium)
>                (closed Power)))
 


> (defconcept Car-Part)
> (defconcept Engine (?x Car-Part))
> (deffunction car-engine ((?x Car)) :-> (?y Engine))
> (deffunction part-size ((?x Car-Part)) :-> (?y Size))
> (deffunction part-power ((?x Car-Part)) :-> (?y Power))
> ;; the above is not quite correct...some parts may have only a size or a power, but not both
> ;; every part must have one of the two properties..not sure how i say this in a meta-relation. I can then
> ;; use the meta-relation to say that engine has size as well as power relations, tire has size but not
> ;; power etc.

> (defconcept Big-Car (?x Car)
>    :=>  (= (part-size (car-engine ?x)) large))

> (defconcept Powerful-Car (?x Car)
>    :=>  (= (part-power (car-engine ?x)) lots))

> It is more verbose than the KM version and less intuitive. Could I have used some PL features e.g definstance to make the code more readable?

> ;; The KM example continues as follows
> ;;; "Suburbans are both big and powerful cars."
KM> (Suburban has (superclasses (Big-Car Powerful-Car)))

> I defined this in PL as :

> (defconcept Suburban (?x Big-Car Powerful-Car))



> ;; KM then shows its unification powers
> ;;; "W hat are the parts of a Suburban?"
KM> (the parts of (a Suburban))
> (COMMENT: (_Engine7 && _Engine8) unified to be _Engine7)
> (_Engine7)

> Question 2: Would the unification work the same way in PowerLoom or is the behavior slightly different
> The output from PL code above is:


STELLA> (retrieve all (= ?x (Car-Engine t1)))
> There is 1 solution:
>  #1: ?X=|SK|(CAR-ENGINE T1)                                        ;; Seems to work ok...there is only one engine not two
STELLA> (retrieve all (= ?sz (part-size (Car-Engine t1))))
> There is 1 solution:
>  #1: ?SZ=LARGE                                                            ;; and that engine has the correct
STELLA> (retrieve all (= ?sz (part-quantity (Car-Engine t1))))
> There is 1 solution:
>  #1: ?SZ=LOTS                                                                ;; properties


> KM has some other frame features that are useful to make the code clearer /concise
> 1. Embedded frames
> ;;; "Joe is a person, and owns a red car."
KM> (*Joe has
>          (instance-of (Person))
>          (owns ((a Car with
>                    (color (*Red))))))

> Not sure if this can be done in PL without creating a PL instance of car and using the o wns relation to relate Joe to that car instance i.e we cannot have embedded powerloom instances... I may be missing the proper use of the frame syntax of PowerLoom that makes this possible.

> Thanks
> Srini



>      <html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><span style="color: rgb(0, 0, 127);">I found the following example in the documentation for the <span style="text-decoration: underline;">Knowledge Machine from UOfTexas..</span>.</span><br><br><div style="margin-left: 40px;">;;; "Every big car has a large engine."<br>KM&gt; (every Big-Car has <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (parts ((a Engine with <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (size (*Large))))))<br><br>;;; "Every powerful car has a powerful engine."<br>KM&gt; (every Powerful-Car has&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (parts ((a Engine with
>  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (power (*Lots))))))<br></div& gt;<br><span style="color: rgb(0, 0, 127);"><span style="font-weight: bold;">Question 1:</span> How would we we represent above in Powerloom</span><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">&nbsp; Here is my shot at it</span><br><div style="margin-left: 80px;">(<span style="font-weight: bold; color: rgb(128, 0, 0);">defconcept Car)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Size (?x)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp; :axioms ( and</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0,
>  0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Size large)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Size small)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Size medium)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp; (closed Size)))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp; </span><br style="font-weight: bold; color: rgb(128, 0,
>  0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Power (?x)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp; :axioms ( and</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Power lots)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);"& gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Power little)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Power medium)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
>  style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (closed Power)))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp; </span><br style="fon t-weight: bold; color: rgb(128, 0, 0);"><br style="font-weight: bold; color: rgb(128, 0, 0);"><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Car-Part)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Engine (?x Car-Part))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(deffunction car-engine ((?x Car)) :-&gt; (?y Engine))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0,
>  0);">(deffunction part-size ((?x Car-Part)) :-&gt; (?y Size))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(de ffunction part-power ((?x Car-Part)) :-&gt; (?y Power))<br><span style="color: rgb(0, 0, 127);">;; the above is not quite correct...some parts may have only a size or a power, but not both</span><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">;; every part must have one of the two properties..not sure how i say this in a meta-relation. I can then</span><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">;; use the meta-relation to say that engine has size as well as power relations, tire has size but not</span><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">;; power etc.</span><br style="font-weight: bold; color: rgb(128, 0, 0);"></span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
>  style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Big-Car (?x Car)&l t;/span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp; :=&gt;&nbsp; (= (part-size (car-engine ?x)) large))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Powerful-Car (?x Car)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp; :=&gt;&nbsp; (= (part-power (car-engine ?x)) lots))</span><br></div>&nbsp;<br><span style="color: rgb(0, 0, 127); font-weight: bold;">It is more verbose than the KM version and less intuitive. Could I have used some PL features e.g definstance to make the code more readable?</span><br><br>;; The KM example continues as follows<br>;;; "Suburbans are both big and powerful
>  cars."<br>KM&gt; (Suburban has (superclasses (Big-Car Powerful-Car)))<br><br><span style="color: rgb(0, 0, 127);">I defined this in PL as :</span><br><div style="margin-left: 40px;"><div style="margin-left: 40px;"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Suburban (?x Big-Car Powerful-Car))</span><br></div></div><br><br><br>;; KM then shows its unification powers<br>;;; "What are the parts of a Suburban?"<br>KM&gt; (the parts of (a Suburban))<br>(COMMENT: (_Engine7 &amp;&amp; _Engine8) unified to be _Engine7)<br>(_Engine7)<br><br><span style="color: rgb(0, 0, 255);"><span style="font-weight: bold;">Question 2</span>: Would the unification work the same way in Pow erLoom or is the behavior slightly different</span><br><span style="color: rgb(0, 0, 127);">The output from PL code above is:</span><br><br style="color: rgb(128, 0, 0);"><div style="margin-left: 40px;"><span style="color: rgb(128, 0, 0);">STELLA&gt; (retrieve all (= ?x
>  (Car-Engine t1)))</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">There is 1 solution:</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">&nbsp; #1: ?X=|SK|(CAR-ENGINE T1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(0, 0, 127);"> </span></span><span style="font-weight: bold; color: rgb(0, 0, 127);">;; Seems to work ok...there is only one engine not two</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">STELLA&gt; (retrieve all (= ?sz (part-size (Car-Engine t1))))</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">There is 1 solution: </span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">&nbsp; #1:
>  ?SZ=</span><span style="font-weight: bold; color: rgb(128, 0, 0);">LARGE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(0, 0, 127);"> ;; and that engine has the correct</span></span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);"&g t;STELLA&gt; (retrieve all (= ?sz (part-quantity (Car-Engine t1))))</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">There is 1 solution:</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">&nbsp; #1: ?SZ=</span><span style="font-weight: bold; color: rgb(128, 0,
>  0);">LOTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 127);">;; properties<br><br></span></span></div><span style="font-weight: bold; color: rgb(128, 0, 0);"><span style="color: rgb(0, 0, 127);"></span></span><br><span style="font-weight: bold; color: rgb(128, 0, 0);"><span style="color: rgb(0, 0, 127);"></span></span><span style="font-weight: bold; color: rgb(128, 0, 0);"></span>KM has some other frame features that are useful to make the code clearer /concise<br>1. Embedded frames<br>;;; "Joe is a person, and owns a red car."<br>KM&gt; (*Joe has
>  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (instance-of (Person))<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (owns ((a Car with <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (color (*Red))))))<br><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">Not sure if this can be done in PL without creating a PL instance of car and using the owns relation to relate Joe to that car instance i.e we cannot have embedded powerloom instances... I may be missing the proper use of the frame syntax of PowerLoom that makes this possible.</span><br><span style="font-weight: bold; color: rgb(128, 0, 0);"><span style="color: rgb(0, 0, 127);"></span></span><br>Thanks<br>Srini<br></div>&l t;br>

>      </body></html>_______________________________________________
> powerloom-forum mailing list
> powerloom-forum <at> isi.edu
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum

_______________________________________________
powerloom-forum mailing list
powerloom-forum <at> isi.edu
http://mailman.isi.edu/mailman/listinfo/powerloom-forum
Srini Ram | 30 Oct 2008 17:41
Picon
Favicon

Re: Question about representing frame information and unification in PL

I wrote below
    Is there any way to tag a set of assertions, so that you can just retract them as a group?

After reading the documentation for assert and destroy, I see that assert returns an object and destroy deletes an object.
Is it possible to store the return value of a compound assert, and later pass it to a destroy which will retract all the propositions contained in that assert in one step? I couldnt find any examples of the use of destroy in the documentation or in the demos directory...

Thanks
Srini

From: Srini Ram <srini_ramaswamy_i <at> yahoo.com>
To: Hans Chalupsky <hans <at> ISI.EDU>
Cc: powerloom-forum <at> ISI.EDU
Sent: Thursday, October 30, 2008 10:45:05 AM
Subject: Re: [PowerLoom Forum] Question about representing frame information and unification in PL

Thanks Hans

The use of the PL automatic instances allows one to create  objects and sub- objects. This is useful
for some degree of colocating of facts relating to the same object.

Does the syntactic sugar provided by definstance allow one to say
    (definstance Joe :person true :owns (definstance $car :car true :color red))
instead of what you wrote below..
(assert (and (Person Joe)
            (Car $car)
            (owns Joe $car)
            (color $car Red)))))


The idea behind the specification I wrote above is not just convenience, but also maintanability --- When I remove the fact that joe is a person from the KB, I expect (in this case) the facts about his car, house, body parts etc. to automatically be deleted instead of having to do this manually as would be the case for the example you gave -- if joe perishes in a car crash :-) we have to retract  (person joe), (car $car), (owns joe $car) explicitly.
Is there any way to tag a set of assertions, so that you can just re tract them as a group?

You wrote below:
With respect to unification, defining `car-engine' as a function was
the right thing to do, since it automatically ensured that there was
only one engine per car and all the properties from the separate
classes were attached to it just like in KM. 

However, that is true only for the example I used, since there is only one engine per car
and a function allows only one return value.

However, to take another example,
if you have the following classification
Person -- has two eyes
    Blue-eyed person
    Black-eyed person

Than any object which derives from both blue and black eyed persons should have two eyes (color tbd), not four.
I guess this is the unification I was wonder ing about.

I think my question really was, how does Powerloom deal with multiple inheritance
where the same attribute is defined in two superclasses
-- in the case of clashing attributes(as in the case above where  it is not clear where the child object should have two blue eyes, or two brown eyes, but because Person has two eyes, we know that the child will have two eyes - we should be able to unambiguously answer questions relating to the number of eyes, but not their color)
-- in the case of non-clashing attributes(as in the engine example).

Thanks
Srini




From: Hans Chalupsky <hans <at> ISI.EDU>
To: Srini Ram <srini_ ramaswamy_i <at> yahoo.com>
Cc: powerloom-forum <at> ISI.EDU
Sent: Wednesday, October 29, 2008 10:32:19 PM
Subject: Re: Question about representing frame information and unification in PL

Srini,

I would contend that the PL definition

(defconcept Big-Car (?x Car)
  :=>  (= (part-size (car-engine ?x)) large))

is not any more verbose than the KM statement

(every Big-Car has
      (parts ((a Engine with (size (*Large))))))

albeit maybe somewhat less readable (depending on your particular
logic persuasion).

KM also uses definitions for classes and slots such as "Engine" and
"size" which you omitted.  If you had included those, the two KBs would
have been rather similar in size.  I'm not sure whether you can define
instances in KM without also defining the classes and slots that you
reference, in PowerLoom that's not an option.

However, the KM syntax is interesting in th at it allows you to keep
some variables implicit (somewhat similar to description logics).
There is no way you can say this without variables in PowerLoom, but
it wouldn't be too hard to write a little front-end translator to
recognize expressions of this kind.

With respect to unification, defining `car-engine' as a function was
the right thing to do, since it automatically ensured that there was
only one engine per car and all the properties from the separate
classes were attached to it just like in KM. 

KM also has a feature called "heuristic unification" that
automatically equivalences skolems based on certain heuristics (that I
don't fully understand :-).  That addresses an interesting problem
with logic where you often have to introduce anonymous skolem objects
and later on you face the problem that they are not automatically
getting equivalenced with actual instances you know about , since that
would require additional identity statemtents.  Since KM uses a
heuristic procedure, it is not logically sound and can get things
wrong in some cases; nevertheless, it tries to address an interesting
issue.

With respect to nested instance definitions, that wouldn't be too hard
to do.  I've actually played around with that in the past somewhat
inspired by F-Logic (which has its own arcane syntax :-), but never
had an application where it mattered enough to force the issue.

However, you don't really need that machinery.  Tom already showed you
how to do it with an exists.  You can also use PowerLoom's automatic
instances.  For example:

(assert (and (Person Joe)
            (Car $car)
            (owns Joe $car)
            (color $car Red)))))

The $ sign acts li ke a Lisp gensym call and will create a new
identifier with the symbol name as a prefix that you then can
reference within the same expression.  For example:

STELLA(7): (assert (and (Person Joe)
            (Car $car)
            (owns Joe $car)
            (color $car Red)))
(|P|(PERSON JOE) |P|(CAR CAR-000) |P|(OWNS JOE CAR-000) |P|(COLOR CAR-000 RED))

STELLA(8): (assert (and (Person Sue)
            (Car $car)
            (owns Sue $car)
            (color $car Red)))
(|P|(PERSON SUE) |P|(CAR CAR-001) |P|(OWNS SUE CAR-001) |P|(COLOR CAR-001 RED))
STELLA(9):

Note that the second time around we created a new instance different
from Joe's car.  This is useful so you don't have to think of new
instance names all the time.  Moreover, it creates real non-skolem
instances, therefore, PowerLoom would be able to infer from the above
that Joe's car and Sue's car are not the same (using the unique names
assumption).  With the exists formulation, that would not be possible
without explicitly asserting that they are not the same.

In general, it is a valid enterprise to come up with more concise and
intuitive languages for KR.  KM is one such attempt, and there are
others.  For us, however, that probably won't be a priority for a
while, since moving more towards a standard such as Common Logic and
better supporting some of the Semantic Web languages seems to be more
important at the moment.

Hans

>>>>> Srini Ram <srini_ramaswamy_i <at> yahoo.com> writes:

> I found the following example in the documentation for the Knowledge Machine from UOfTexas...
> ;;; "Every big car has a large engine."
KM> (every Big-Car has
>            (parts ((a Engine with
>                      (size (*Large))))))

> ;;; "Every powerful car has a powerful engine."
KM> (every Powerful-Car has   
>            (parts ((a Engine with
>                      (power (*Lots))))))

> Question 1: How would we we represent above in Powerloom
>  Here is my shot at it

> (defconcept Car)
> (defconcept Size (?x)
>  :axioms ( and
>                (Size large)
>                (Size small)
>                (Size medium)
>                (closed Size)))
   
> (defconcept Power (?x)
>  :axioms ( and
>                (Power lots)
>                (Power little)
>                (Power medium)
>                (closed Power)))
 


> (defconcept Car-Part)
> (defconcept Engine (?x Car-Part))
> (deffunction car-engine ((?x Car)) :-> (?y Engine))
> (deffunction part-size ((?x Car-Part)) :-> (?y Size))
> (deffunction part-power ((?x Car-Part)) :-> (?y Power))
> ;; the above is not quite correct...some parts may have only a size or a power, but not both
> ;; every part must have one of the two properties..not sure how i say this in a meta-relation. I can then
> ;; use the meta-relation to say that engine has size as well as power relations, tire has size but not
> ;; power etc.

> (defconcept Big-Car (?x Car)
>    :=>  (= (part-size (car-engine ?x)) large))

> (defconcept Powerful-Car (?x Car)
>    :=>  (= (part-power (car-engine ?x)) lots))

> It is more verbose than the KM version and less intuitive. Could I have used some PL features e.g definstance to make the code more readable?

> ;; The KM example continues as follows
> ;;; "Suburbans are both big and powerful cars."
KM> (Suburban has (superclasses (Big-Car Powerful-Car)))

> I defined this in PL as :

> (defconcept Suburban (?x Big-Car Powerful-Car))



> ;; KM then shows its unification powers
> ;;; "W hat are the parts of a Suburban?"
KM> (the parts of (a Suburban))
> (COMMENT: (_Engine7 && _Engine8) unified to be _Engine7)
> (_Engine7)

> Question 2: Would the unification work the same way in PowerLoom or is the behavior slightly different
> The output from PL code above is:


STELLA> (retrieve all (= ?x (Car-Engine t1)))
> There is 1 solution:
>  #1: ?X=|SK|(CAR-ENGINE T1)                                        ;; Seems to work ok...there is only one engine not two
STELLA> (retrieve all (= ?sz (part-size (Car-Engine t1))))
> There is 1 solution:
>  #1: ?SZ=LARGE                                                            ;; and that engine has the correct
STELLA> (retrieve all (= ?sz (part-quantity (Car-Engine t1))))
> There is 1 solution:
>  #1: ?SZ=LOTS                                                                ;; properties


> KM has some other frame features that are useful to make the code clearer /concise
> 1. Embedded frames
> ;;; "Joe is a person, and owns a red car."
KM> (*Joe has
>          (instance-of (Person))
>          (owns ((a Car with
>                    (color (*Red))))))

> Not sure if this can be done in PL without creating a PL instance of car and using the o wns relation to relate Joe to that car instance i.e we cannot have embedded powerloom instances... I may be missing the proper use of the frame syntax of PowerLoom that makes this possible.

> Thanks
> Srini



>      <html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><span style="color: rgb(0, 0, 127);">I found the following example in the documentation for the <span style="text-decoration: underline;">Knowledge Machine from UOfTexas..</span>.</span><br><br><div style="margin-left: 40px;">;;; "Every big car has a large engine."<br>KM&gt; (every Big-Car has <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (parts ((a Engine with <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (size (*Large))))))<br><br>;;; "Every powerful car has a powerful engine."<br>KM&gt; (every Powerful-Car has&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (parts ((a Engine with
>  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (power (*Lots))))))<br></div& gt;<br><span style="color: rgb(0, 0, 127);"><span style="font-weight: bold;">Question 1:</span> How would we we represent above in Powerloom</span><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">&nbsp; Here is my shot at it</span><br><div style="margin-left: 80px;">(<span style="font-weight: bold; color: rgb(128, 0, 0);">defconcept Car)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Size (?x)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp; :axioms ( and</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0,
>  0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Size large)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Size small)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Size medium)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp; (closed Size)))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp; </span><br style="font-weight: bold; color: rgb(128, 0,
>  0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Power (?x)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp; :axioms ( and</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Power lots)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);"& gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Power little)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Power medium)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
>  style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (closed Power)))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp; </span><br style="fon t-weight: bold; color: rgb(128, 0, 0);"><br style="font-weight: bold; color: rgb(128, 0, 0);"><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Car-Part)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Engine (?x Car-Part))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(deffunction car-engine ((?x Car)) :-&gt; (?y Engine))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0,
>  0);">(deffunction part-size ((?x Car-Part)) :-&gt; (?y Size))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(de ffunction part-power ((?x Car-Part)) :-&gt; (?y Power))<br><span style="color: rgb(0, 0, 127);">;; the above is not quite correct...some parts may have only a size or a power, but not both</span><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">;; every part must have one of the two properties..not sure how i say this in a meta-relation. I can then</span><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">;; use the meta-relation to say that engine has size as well as power relations, tire has size but not</span><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">;; power etc.</span><br style="font-weight: bold; color: rgb(128, 0, 0);"></span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
>  style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Big-Car (?x Car)&l t;/span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp; :=&gt;&nbsp; (= (part-size (car-engine ?x)) large))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Powerful-Car (?x Car)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">&nbsp;&nbsp; :=&gt;&nbsp; (= (part-power (car-engine ?x)) lots))</span><br></div>&nbsp;<br><span style="color: rgb(0, 0, 127); font-weight: bold;">It is more verbose than the KM version and less intuitive. Could I have used some PL features e.g definstance to make the code more readable?</span><br><br>;; The KM example continues as follows<br>;;; "Suburbans are both big and powerful
>  cars."<br>KM&gt; (Suburban has (superclasses (Big-Car Powerful-Car)))<br><br><span style="color: rgb(0, 0, 127);">I defined this in PL as :</span><br><div style="margin-left: 40px;"><div style="margin-left: 40px;"><span style="font-weight: bold; color: rgb(128, 0, 0);">(defconcept Suburban (?x Big-Car Powerful-Car))</span><br></div></div><br><br><br>;; KM then shows its unification powers<br>;;; "What are the parts of a Suburban?"<br>KM&gt; (the parts of (a Suburban))<br>(COMMENT: (_Engine7 &amp;&amp; _Engine8) unified to be _Engine7)<br>(_Engine7)<br><br><span style="color: rgb(0, 0, 255);"><span style="font-weight: bold;">Question 2</span>: Would the unification work the same way in Pow erLoom or is the behavior slightly different</span><br><span style="color: rgb(0, 0, 127);">The output from PL code above is:</span><br><br style="color: rgb(128, 0, 0);"><div style="margin-left: 40px;"><span style="color: rgb(128, 0, 0);">STELLA&gt; (retrieve all (= ?x
>  (Car-Engine t1)))</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">There is 1 solution:</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">&nbsp; #1: ?X=|SK|(CAR-ENGINE T1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(0, 0, 127);"> </span></span><span style="font-weight: bold; color: rgb(0, 0, 127);">;; Seems to work ok...there is only one engine not two</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">STELLA&gt; (retrieve all (= ?sz (part-size (Car-Engine t1))))</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">There is 1 solution: </span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">&nbsp; #1:
>  ?SZ=</span><span style="font-weight: bold; color: rgb(128, 0, 0);">LARGE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: rgb(0, 0, 127);"> ;; and that engine has the correct</span></span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);"&g t;STELLA&gt; (retrieve all (= ?sz (part-quantity (Car-Engine t1))))</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">There is 1 solution:</span><br style="color: rgb(128, 0, 0);"><span style="color: rgb(128, 0, 0);">&nbsp; #1: ?SZ=</span><span style="font-weight: bold; color: rgb(128, 0,
>  0);">LOTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&a mp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: rgb(0, 0, 127);">;; properties<br><br></span></span></div><span style="font-weight: bold; color: rgb(128, 0, 0);"><span style="color: rgb(0, 0, 127);"></span></span><br><span style="font-weight: bold; color: rgb(128, 0, 0);"><span style="color: rgb(0, 0, 127);"></span></span><span style="font-weight: bold; color: rgb(128, 0, 0);"></span>KM has some other frame features that are useful to make the code clearer /concise<br>1. Embedded frames<br>;;; "Joe is a person, and owns a red car."<br>KM&gt; (*Joe has
>  <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (instance-of (Person))<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp ;nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (owns ((a Car with <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (color (*Red))))))<br><br style="color: rgb(0, 0, 127);"><span style="color: rgb(0, 0, 127);">Not sure if this can be done in PL without creating a PL instance of car and using the owns relation to relate Joe to that car instance i.e we cannot have embedded powerloom instances... I may be missing the proper use of the frame syntax of PowerLoom that makes this possible.</span><br><span style="font-weight: bold; color: rgb(128, 0, 0);"><span style="color: rgb(0, 0, 127);"></span></span><br>Thanks<br>Srini<br></div>&l t;br>

>      </body></html>_______________________________________________
> powerloom-forum mailing list
> powerloom-forum <at> isi.edu
> http://mailman.isi.edu/mailman/listinfo/powerloom-forum


_______________________________________________
powerloom-forum mailing list
powerloom-forum <at> isi.edu
http://mailman.isi.edu/mailman/listinfo/powerloom-forum
Thomas Russ | 30 Oct 2008 19:40
Picon
Favicon

Re: Question about representing frame information and unification in PL


On Oct 30, 2008, at 9:41 AM, Srini Ram wrote:

> I wrote below
>     Is there any way to tag a set of assertions, so that you can  
> just retract them as a group?
>
> After reading the documentation for assert and destroy, I see that  
> assert returns an object and destroy deletes an object.
> Is it possible to store the return value of a compound assert, and  
> later pass it to a destroy which will retract all the propositions  
> contained in that assert in one step? I couldnt find any examples of  
> the use of destroy in the documentation or in the demos directory...

I don't think you want to use DESTROY.  But you could retract the  
resulting proposition.

The value returned by assert will be either a PROPOSITION object or a  
LIST of PROPOSITIONS.  You could iterate through that and call RETRACT- 
PROPOSITION on each item.

The easiest way to do this would be to use the PowerLoom interface  
functions to assert a sentence and then save the value for later  
retraction.  You would presumably use the S-ASSERT-PROPOSITION and  
RETRACT-PROPOSITION code.  From Java this would look like

     String myModuleName = "PL-USER";
     Module myModule = PLI.getModule(myModuleName, null);
     PlIterator props = PLI.sAssertProposition("(and (c i1) (c i2) (r  
i1 i2))", myModuleName, null);
     ...
     while (props.nextP()) {
       p = ((Proposition)(props.value));
       edu.isi.powerloom.PLI.retractProposition(p, myModule, null);
     }

Another option would be to use the context mechanism to spawn a new  
reasoning context as a child of your current module and then just  
destroy that context when you no longer need it.  This is a more  
global and less selective strategy, but it frees you from having to  
keep track of what it is you need to retract.

That can be handy if you are trying alternate scenarios.  It also has  
the advantage that you can keep multiple such scenarios around in  
parallel and move between them.  There is even some query-level  
support (the IST operator) that supports it.

-Tom.
Thomas Russ | 30 Oct 2008 19:48
Picon
Favicon

Re: Question about representing frame information and unification in PL


On Oct 30, 2008, at 7:45 AM, Srini Ram wrote:

> However, to take another example,
> if you have the following classification
> Person -- has two eyes
>     Blue-eyed person
>     Black-eyed person
>
> Than any object which derives from both blue and black eyed persons  
> should have two eyes (color tbd), not four.
> I guess this is the unification I was wondering about.
>
> I think my question really was, how does Powerloom deal with  
> multiple inheritance
> where the same attribute is defined in two superclasses
> -- in the case of clashing attributes(as in the case above where  it  
> is not clear where the child object should have two blue eyes, or  
> two brown eyes, but because Person has two eyes, we know that the  
> child will have two eyes - we should be able to unambiguously answer  
> questions relating to the number of eyes, but not their color)
> -- in the case of non-clashing attributes(as in the engine example).

The problem is that with multiple skolem values, there isn't any  
principled way to unify them.  So PowerLoom will pretty much just not  
do it.  There will be four skolems, but that doesn't mean there are  
four eyes.  Although in the case where you have a logically  
inconsistent definition.  If you were to try this in, say, OWL 2.0  
where you can have qualified number restrictions, you should get an  
inconsistent ontology.

As I noted before, we haven't put much effort into trying to do a lot  
with cardinality reasoning, so PowerLoom wouldn't really notice that.   
There is also the issue of it not really being that convenient to  
indicate to PowerLoom that two skolems should be distinct, although I  
suppose that something like

    (exists (?s1 ?s2) (and (not (= ?s1 ?s2))  ...))

should work for that.

PowerLoom has only the rudiments of a value cardinality reasoning  
system, and the qualified cardinality relations are just stubs with no  
semantics or reasoning attached.

Gmane