Re: Question about representing frame information and unification in PL
Hans Chalupsky <[email protected]> Fri, 31 Oct 2008 11:40:45 -0800
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
What I was hoping would already work for this was the use of
`defproposition' which allows you to give a name to a proposition and
then use the name in its place.
For example:
(defproposition stuff-about-joe
(and (Person Joe)
(Car $car)
(owns Joe $car)
(color $car Red)))
To retract all of that, you'd simply say
(retract stuff-about-joe)
Unfortunately, that doesn't work yet, I need to see what it takes to
generalize this. However, as usual, you can kludge around it for
now with the following idiom:
STELLA(10): (defproposition things-about-joe
(person joe)
:axioms (and (Car $car)
(owns Joe $car)
(color $car Red)))
|P|(PERSON JOE)
STELLA(11): (process-definitions)
()
STELLA(12): (all-facts-of joe)
(|P|(PERSON JOE) |P|(OWNS JOE CAR-001))
STELLA(13): (all-facts-of car-001)
(|P|(OWNS JOE CAR-001))
STELLA(14): (defproposition things-about-joe false)
[2008-OCT-31 11:36:32.000 PL] Redefining the proposition named THINGS-ABOUT-JOE
|P|FALSE
STELLA(16): (all-facts-of joe)
()
STELLA(17): (all-facts-of car-001)
()
STELLA(18):
The redefinition of `things-about-joe' retracts all its associated old
axioms as a side-effect. Not pretty, but usable until we fix this.
Hans
>>>>> Srini Ram <[email protected]> writes:
> 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 <[email protected]>
> To: Hans Chalupsky <[email protected]>
> Cc: [email protected]
> 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 retract 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 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).
> Thanks
> Srini
> ________________________________
> From: Hans Chalupsky <[email protected]>
> To: Srini Ram <[email protected]>
> Cc: [email protected]
> 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 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 <[email protected]> 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> (every Big-Car has <br> (parts ((a Engine with <br> (size (*Large))))))<br><br>;;; "Every powerful car has a powerful engine."<br>KM> (every Powerful-Car has <
br> (parts ((a Engine with
>> <br> (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);"> 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);"> :axioms ( and</s
pan><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0,
>> 0);"> (Size large)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);"> (Size small)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);"> (Size medium)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);"> (closed Size)))</span><br style="font-we
ight: bold; color: rgb(128, 0, 0);"><span 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 Power (?x)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);"> :axioms ( and</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);"> (Power lots)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);"> (Power little)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);">
(Power medium)</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span
>> style="font-weight: bold; color: rgb(128, 0, 0);"> (closed Power)))</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0, 0);"> </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)) :-> (?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)) :-> (?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)) :-> (?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);"> :=> (= (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);"> :=> (= (part-power (car-engine ?x)) lots))</span><br></div> <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> (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> (the parts of (a Suburban))<br>(COMMENT: (_Engine7 && _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> (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);"> #1: ?X=|SK|(CAR-ENGINE T1) <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> (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);"> #1:
>> ?SZ=</span><span style="font-weight: bold; color: rgb(128, 0, 0);">LARGE <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> (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);"> #1: ?SZ=</span><span style="font-weight: bold; color: rgb(128, 0,
>> 0);">LOTS <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> (*Joe has
>> <br> (instance-of (Person))<br> (owns ((a Car with <br> (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
>> [email protected]
>> http://mailman.isi.edu/mailman/listinfo/powerloom-forum
> <html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div>I wrote below<span style="text-decoration: underline;"><br></span> <span style="text-decoration: underline;">Is there any way to tag a set of assertions, so that you can just retract them as a group?<br><br></span>After reading the documentation for assert and destroy, I see that assert returns an object and destroy deletes an object.<br>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...<br><br>T
hanks<br>Srini<br><span style="text-decoration: underline;"></span></div><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br><div style="font-family:
> times new roman,new york,times,serif; font-size: 12pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Srini Ram <[email protected]><br><b><span style="font-weight: bold;">To:</span></b> Hans Chalupsky <[email protected]><br><b><span style="font-weight: bold;">Cc:</span></b> [email protected]<br><b><span style="font-weight: bold;">Sent:</span></b> Thursday, October 30, 2008 10:45:05 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [PowerLoom Forum] Question about representing frame information and unification in PL<br></font><br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><div>Thanks Hans<br><br>The use of the PL automatic instances allows one to create objects and su
b-objects. This is useful<br>for some degree of colocating of facts relating to the same object. <br><br>Does the syntactic sugar provided by definstance allow one to say
> <br><span style="color: rgb(127, 0, 63);"> (definstance Joe :person true :owns (definstance $car :car true :color red))</span><br>instead of what you wrote below..<br><div style="margin-left: 40px;">(<span style="color: rgb(127, 0, 63);">assert (and (Person Joe)</span><br style="color: rgb(127, 0, 63);"><span style="color: rgb(127, 0, 63);"> (Car $car)</span><br style="color: rgb(127, 0, 63);"><span style="color: rgb(127, 0, 63);"> (owns
> Joe $car)</span><br style="color: rgb(127, 0, 63);"><span style="color: rgb(127, 0, 63);"> (color $car Red)))))<br><br><br></span></div>The idea behind the specification I wrote above is not just convenience, but <span style="text-decoration: underline;">also maintanability </span>--- 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.<br><span style="text-decoration: underline;">Is there any way to tag a set of assertions, so that you can just
retract them as a group?</span><span style="color: rgb(127, 0, 63);"></span><br><span style="color: rgb(127, 0, 63);"></span><br>You wrote below:<br><div
> style="margin-left: 40px;">With respect to unification, defining `car-engine' as a function was<br>the right thing to do, since it automatically ensured that there was<br>only one engine per car and all the properties from the separate<br>classes were attached to it just like in KM. <br></div><br>However, that is true only for the example I used, since there is only one engine per car<br>and a function allows only one return value.<br><br>However, to take another example, <br>if you have the following classification<br>Person -- has two eyes<br> Blue-eyed person<br> Black-eyed person<br><br>Than any object which derives from both blue and black eyed persons should have two eyes (color tbd), not four.<br>I guess this is the unification I was wond
ering about. <br><br>I think my question really was, how does Powerloom deal with multiple inheritance<br>where the same attribute is defined in two superclasses<br>-- 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)<br>-- in the case of non-clashing attributes(as in the engine example).<br><br>Thanks<br>Srini<br><br><br><br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Hans Chalupsky <[email protected]><br><b><span style="font-weight: bold;">To:</span></b> Srini Ram <srin
[email protected]><br><b><span style="font-weight: bold;">Cc:</span></b> [email protected]<br><b><span style="font-weight: bold;">Sent:</span></b>
> Wednesday, October 29, 2008 10:32:19 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: Question about representing frame information and unification in PL<br></font><br>
> Srini,<br><br>I would contend that the PL definition<br><br>(defconcept Big-Car (?x Car)<br> :=> (= (part-size (car-engine ?x)) large))<br><br>is not any more verbose than the KM statement<br><br>(every Big-Car has <br> (parts ((a Engine with (size (*Large))))))<br><br>albeit maybe somewhat less readable (depending on your particular<br>logic persuasion).<br><br>KM also uses definitions for classes and slots such as "Engine" and<br>"size" which you omitted. If you had included those, the two KBs would<br>have been rather similar in size. I'm not sure whether you can define<br>instances in KM without also defining the classes and slots that you<br>reference, in PowerLoom that's not an option.<br><br>However, the KM syntax is interesting in
that it allows you to keep<br>some variables implicit (somewhat similar to description logics).<br>There is no way you can say this without variables in PowerLoom,
> but<br>it wouldn't be too hard to write a little front-end translator to<br>recognize expressions of this kind.<br><br>With respect to unification, defining `car-engine' as a function was<br>the right thing to do, since it automatically ensured that there was<br>only one engine per car and all the properties from the separate<br>classes were attached to it just like in KM. <br><br>KM also has a feature called "heuristic unification" that<br>automatically equivalences skolems based on certain heuristics (that I<br>don't fully understand :-). That addresses an interesting problem<br>with logic where you often have to introduce anonymous skolem objects<br>and later on you face the problem that they are not automatically<br>getting equivalenced with actual instances you know abo
ut, since that<br>would require additional identity statemtents. Since KM uses a<br>heuristic procedure, it is not logically sound and can get things<br>wrong in
> some cases; nevertheless, it tries to address an interesting<br>issue.<br><br>With respect to nested instance definitions, that wouldn't be too hard<br>to do. I've actually played around with that in the past somewhat<br>inspired by F-Logic (which has its own arcane syntax :-), but never<br>had an application where it mattered enough to force the issue.<br><br>However, you don't really need that machinery. Tom already showed you<br>how to do it with an exists. You can also use PowerLoom's automatic<br>instances. For example:<br><br>(assert (and (Person Joe)<br> (Car $car)<br> (owns Joe $car)<br> (color $car Red)))))<br><br>The $ sign acts
like a Lisp gensym call and will create a new<br>identifier with the symbol name as a prefix that you then can<br>reference within the same expression. For
> example:<br><br>STELLA(7): (assert (and (Person Joe)<br> (Car $car)<br> (owns Joe $car)<br> (color $car Red)))<br>(|P|(PERSON JOE) |P|(CAR CAR-000) |P|(OWNS JOE CAR-000) |P|(COLOR CAR-000 RED))<br><br>STELLA(8): (assert (and (Person Sue)<br> (Car $car)<br> (owns Sue $car)<br> (color $car Red)))<br>(|P|(PERSON SUE) |P|(CAR CAR-001) |P|(OWNS SUE CAR-001) |P|(COLOR CAR-001 RED))<br>STELLA(9): <br><br>Note that the second time around we created a new instance different<br>from Joe's car. This is useful so you don't have to think of new<b
r>instance names all the time. Moreover, it creates real non-skolem<br>instances, therefore, PowerLoom would be able to infer from the above<br>that Joe's car and
> Sue's car are not the same (using the unique names<br>assumption). With the exists formulation, that would not be possible<br>without explicitly asserting that they are not the same.<br><br>In general, it is a valid enterprise to come up with more concise and<br>intuitive languages for KR. KM is one such attempt, and there are<br>others. For us, however, that probably won't be a priority for a<br>while, since moving more towards a standard such as Common Logic and<br>better supporting some of the Semantic Web languages seems to be more<br>important at the moment.<br><br>Hans<br><br>>>>>> Srini Ram <<a rel="nofollow" ymailto="mailto:[email protected]" target="_blank" href="mailto:[email protected]">[email protected]</a>>
; writes:<br><br>> I found the following example in the documentation for the Knowledge Machine from UOfTexas...<br>> ;;; "Every big car has a large
> engine."<br>KM> (every Big-Car has
> <br>> (parts ((a Engine with <br>> (size (*Large))))))<br><br>> ;;; "Every powerful car has a powerful engine."<br>KM> (every Powerful-Car has <br>> (parts ((a Engine with <br>> (power (*Lots))))))<br><br>> Question 1: How would we we represent above in Powerloom<br>> Here is my shot at it<br><br>> (defconcept Car)<br>> (defconcept Size (?x)<br>> :axioms ( and<br>> (Size large)<br>> &nbs
p; (Size small)<br>> (Size medium)<br>> (closed
> Size)))<br> <br>> (defconcept Power (?x)<br>> :axioms ( and<br>> (Power lots)<br>> (Power little)<br>> (Power medium)<br>> (closed Power)))<br> <br><br><br>> (defconcept Car-Part)<br>> (defconcept Engine (?x Car-Part))<br>> (deffunction car-engine ((?x Car)) :-> (?y Engine))<br>> (deffunction part-size ((?x Car-Part)) :-> (?y Size))<br>> (deffunction part-power ((?x Car-Part)) :-> (?y Power))<br>> ;; the above is not quite correct...some parts may have only a size or a power, but not both<br>>
;; every part must have one of the two properties..not sure how i say this in a meta-relation. I can then<br>> ;; use the meta-relation to say that engine has size as
> well as power relations, tire has size but not<br>> ;; power etc.<br><br>> (defconcept Big-Car (?x Car)<br>> :=> (= (part-size (car-engine ?x)) large))<br><br>> (defconcept Powerful-Car (?x Car)<br>> :=> (= (part-power (car-engine ?x)) lots))<br> <br>> 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?<br><br>> ;; The KM example continues as follows<br>> ;;; "Suburbans are both big and powerful cars."<br>KM> (Suburban has (superclasses (Big-Car Powerful-Car)))<br><br>> I defined this in PL as :<br><br>> (defconcept Suburban (?x Big-Car Powerful-Car))<br><br><br><br>> ;; KM then shows its unification powers<br>> ;;;
"What are the parts of a Suburban?"<br>KM> (the parts of (a Suburban))<br>> (COMMENT: (_Engine7 && _Engine8) unified to be _Engine7)<br>>
> (_Engine7)<br><br>> Question 2: Would the unification work the same way in PowerLoom or is the behavior slightly different<br>> The output from PL code above is:<br><br><br>STELLA> (retrieve all (= ?x (Car-Engine t1)))<br>> There is 1 solution:<br>> #1: ?X=|SK|(CAR-ENGINE T1) ;; Seems to work ok...there is only one engine not two<br>STELLA> (retrieve all (= ?sz (part-size (Car-Engine t1))))<br>> There is 1 solution: <br>> #1: ?SZ=LARGE  
; ;; and that engine has the correct<br>STELLA> (retrieve all (= ?sz (part-quantity (Car-Engine t1))))<br>> There is 1
> solution:<br>> #1: ?SZ=LOTS ;; properties<br><br><br>> 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> (*Joe has <br>> (instance-of (Person))<br>> (owns ((a Car with <br>> (color (*Red))))))<br><br>> 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.<br><br>> Thanks<br>> Srini<br><br><br><br>> <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>> <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></di
v><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,<br>> 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&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;&nb
sp;&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,<br>> 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<br>> 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="f
ont-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,<br>> 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: 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<br>> 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 have used some PL features e.g definstance to make the code more readable?</span><br><br>;; T
he KM example continues as follows<br>;;; "Suburbans are both big and powerful<br>> 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 P
owerLoom 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<br>> (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;&a
mp;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:<br>> ?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,<br>> 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 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>> <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (instance-of (Person))<br>&nbsp;&nbsp;&nbsp;&nbsp;&a
mp;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><br><br>> </body></html>_______________________________________________<br>> powerloom-forum mailing list<br>> <a
> rel="nofollow" ymailto="mailto:[email protected]" target="_blank" href="mailto:[email protected]">[email protected]</a><br>> <a rel="nofollow" target="_blank" href="http://mailman.isi.edu/mailman/listinfo/powerloom-forum">http://mailman.isi.edu/mailman/listinfo/powerloom-forum</a><br></div></div></div><br>
> </div></div></div><br>
> </body></html>