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> (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&
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);"> 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</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0,
> 0);"> &nbs
p; (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-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);"><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);"&
gt; (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="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)) :-> (?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);">(de
ffunction 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: 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);">
:=> (= (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 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> (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 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> (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) &
;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> (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);"> #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);"&g
t;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 &a
mp;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> (*Joe has
> <br> (instance-of (Person))<br> &
;nbsp; (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>&l
t;br>
> </body></html>_______________________________________________
> powerloom-forum mailing list
>
powerloom-forum <at> isi.edu>
http://mailman.isi.edu/mailman/listinfo/powerloom-forum