|
View:
New views
13 Messages
—
Rating Filter:
Alert me
|
|
|
Question about representing frame information and unification in PLI 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 _______________________________________________ powerloom-forum mailing list powerloom-forum@... http://mailman.isi.edu/mailman/listinfo/powerloom-forum |
|
|
|
|
|
Re: Question about representing frame information and unification in PLOn 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. _______________________________________________ powerloom-forum mailing list powerloom-forum@... http://mailman.isi.edu/mailman/listinfo/powerloom-forum |
|
|
Re: Question about representing frame information and unification in PLSrini,
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@...> 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</span><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-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);"> (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);">(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);">(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: 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)</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 PowerLoom 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) <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);">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 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 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@... > http://mailman.isi.edu/mailman/listinfo/powerloom-forum _______________________________________________ powerloom-forum mailing list powerloom-forum@... http://mailman.isi.edu/mailman/listinfo/powerloom-forum |
|
|
|
|
|
|
|
|
Re: Question about representing frame information and unification in PLOn 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. _______________________________________________ powerloom-forum mailing list powerloom-forum@... http://mailman.isi.edu/mailman/listinfo/powerloom-forum |
|
|
Re: Question about representing frame information and unification in PLOn 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. _______________________________________________ powerloom-forum mailing list powerloom-forum@... http://mailman.isi.edu/mailman/listinfo/powerloom-forum |
|
|
|
|
|
Re: Question about representing frame information and unification in PLOn Oct 30, 2008, at 12:02 PM, Srini Ram wrote: > Thanks Tom. > > I am not looking to try alternate scenarios, I am trying to ease the > maintainability of managing complex objects. > > Lets say I have person joe. Joe has a large number of moving parts: > hands, feets, eyes, bowels :-) etc. > When I retract person joe, I want to automatically retract all these > assertions about his hands, feets as well as assertions about their > sub-parts > such as fingers, toes and so on. I dont want to have to retract them > one by one (similar to having a destructor method that deletes sub- > objects). > Advantage is that one will never attempt to retract something that > wasnt asserted as could happen if there is separate assertion and > retraction code. > > Storing the assertion in the PowerLoom interface is not useful, > since I cannot then query in KIF to find all the complex assertions. > The storage of the assertions is not expressed in KIF itself. So what you want to have is some interactive way of doing this? Instead of using a programming interface? Well, I did just remember that you are using the Lisp version of PowerLoom, so you can use Lisp to come to your rescue for this particular case. I had actually done my initial investigation using Lisp and then translated some code to Java. > I would like to say something like > (assert > (person-assertion joe-facts <-meta assertion? > (assert > (and > (person joe) > (hands joe 2) > (legs joe 2) > (exists (?h) (and (hand joe ?h) (nails ?h 5)) <- > assertion about nails cant be found by (get-propositions-of joe) or > (all-facts-of joe) > .... > )))) You can just save the results of an ASSERT statement in a lisp variable and then iterate over the contents. STELLA> (setq joes-facts (assert (and (c Joe) (r Joe Jim) (exists (?h) (and (r Joe ?h) (r ?h something-else)))))) (|P|(C JOE) |P|(R JOE JIM) |P|(R JOE sk53) |P|(R sk53 SOMETHING-ELSE)) STELLA> (retrieve all (r ?x ?y)) There are 5 solutions: #1: ?X=sk53, ?Y=SOMETHING-ELSE #2: ?X=JOE, ?Y=sk53 #3: ?X=JOE, ?Y=JIM #4: ?X=JOHN, ?Y=MIKE #5: ?X=JOHN, ?Y=BILL STELLA> (cl:dolist (p joes-facts) (cl:print p) (pli:retract-proposition p null null)) |P|(C JOE) |P|(R JOE JIM) |P|(R JOE sk53) |P|(R sk53 SOMETHING-ELSE) COMMON-LISP:NIL STELLA> (retrieve all (r ?x ?y)) There are 2 solutions: #1: ?X=JOHN, ?Y=MIKE #2: ?X=JOHN, ?Y=BILL STELLA> > > > and subsequently do > (retract-from-query (retrieve (person-assertion joe-facts)) -> all > assertions about joe , and his hands and feet and their sub-assertions > are > retracted > > I guess what I am asking is...can the argument of a relation be a > logic-object (which is what assert returns)? > If yes, then the above should be possible.... Well, that is an interesting suggestion for some meta-relations. We don't really have that supported right now. The real problem is that ASSERT is a command rather than an operator in the logic language itself, so you can't really use it inside of logical sentences. So there isn't any way of getting the value to assert for person- assertion into the assertion. _______________________________________________ powerloom-forum mailing list powerloom-forum@... http://mailman.isi.edu/mailman/listinfo/powerloom-forum |
|
|
Re: Question about representing frame information and unification in PLWhat 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 <srini_ramaswamy_i@...> 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 <srini_ramaswamy_i@...> > To: Hans Chalupsky <hans@...> > Cc: powerloom-forum@... > 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 <hans@...> > To: Srini Ram <srini_ramaswamy_i@...> > Cc: powerloom-forum@... > 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 <srini_ramaswamy_i@...> 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</span><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-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);"> (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);">(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);">(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: 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)</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 PowerLoom 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) <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);">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 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 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@... >> 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>Thanks<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 <srini_ramaswamy_i@...><br><b><span style="font-weight: bold;">To:</span></b> Hans Chalupsky <hans@...><br><b><span style="font-weight: bold;">Cc:</span></b> powerloom-forum@...<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 sub-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 wondering 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 <hans@...><br><b><span style="font-weight: bold;">To:</span></b> Srini Ram <srini_ramaswamy_i@...><br><b><span style="font-weight: bold;">Cc:</span></b> powerloom-forum@...<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 about, 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<br>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:srini_ramaswamy_i@..." target="_blank" href="mailto:srini_ramaswamy_i@...">srini_ramaswamy_i@...</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>> (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> (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>> <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</span><br style="font-weight: bold; color: rgb(128, 0, 0);"><span style="font-weight: bold; color: rgb(128, 0,<br>> 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-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,<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);"> :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<br>> 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);">(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,<br>> 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: 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);"> > :=> (= (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<br>> 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 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<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);"> #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="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:<br>> ?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,<br>> 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 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>> <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><br><br>> </body></html>_______________________________________________<br>> powerloom-forum mailing list<br>> <a > rel="nofollow" ymailto="mailto:powerloom-forum@..." target="_blank" href="mailto:powerloom-forum@...">powerloom-forum@...</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> _______________________________________________ powerloom-forum mailing list powerloom-forum@... http://mailman.isi.edu/mailman/listinfo/powerloom-forum |
|
|
Re: Question about representing frame information and unification in PLAs I said in my previous message, the right way to do this is via
defproposition which will be even better once I fix its shortcomings. Another standard way of doing this is to use `retract-facts-of' which will retract all propositions in which `joe' is an argument (the list returned by `all-facts-of'). You can define a relation `person-assertion' as you suggest below, e.g., (defrelation person-assertion (?name (?p proposition))) Unfortunately, you'd have to write a little update demon that would assert or retract the proposition ?p inside whenever person-assertion gets asserted or retracted (you can't nest another assert the way you had it). Hans >>>>> Srini Ram <srini_ramaswamy_i@...> writes: > Thanks Tom. > I am not looking to try alternate scenarios, I am trying to ease the maintainability of managing complex objects. > Lets say I have person joe. Joe has a large number of moving parts: hands, feets, eyes, bowels :-) etc. > When I retract person joe, I want to automatically retract all these assertions about his hands, feets as well as assertions about their sub-parts > such as fingers, toes and so on. I dont want to have to retract them one by one (similar to having a destructor method that deletes sub-objects). > Advantage is that one will never attempt to retract something that wasnt asserted as could happen if there is separate assertion and retraction code. > Storing the assertion in the PowerLoom interface is not useful, since I cannot then query in KIF to find all the complex assertions. The storage of the assertions is not expressed in KIF itself. > I would like to say something like > (assert > (person-assertion joe-facts <-meta assertion? > (assert > (and > (person joe) > (hands joe 2) > (legs joe 2) > (exists (?h) (and (hand joe ?h) (nails ?h 5)) <- assertion about nails cant be found by (get-propositions-of joe) or (all-facts-of joe) > .... > )))) > and subsequently do > (retract-from-query (retrieve (person-assertion joe-facts)) -> all assertions about joe , and his hands and feet and their sub-assertions > are retracted > I guess what I am asking is...can the argument of a relation be a logic-object (which is what assert returns)? > If yes, then the above should be possible.... > Thanks > Srini > ________________________________ > From: Thomas Russ <tar@...> > To: Srini Ram <srini_ramaswamy_i@...> > Cc: Hans Chalupsky <hans@...>; powerloom-forum@... > Sent: Thursday, October 30, 2008 2:40:28 PM > Subject: Re: [PowerLoom Forum] 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. > <html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div>Thanks Tom.<br><br>I am not looking to try alternate scenarios, I am trying to ease the maintainability of managing complex objects.<br><br>Lets say I have person joe. Joe has a large number of moving parts: hands, feets, eyes, bowels :-) etc.<br>When I retract person joe, I want to automatically retract all these assertions about his hands, feets as well as assertions about their sub-parts<br>such as fingers, toes and so on. I dont want to have to retract them one by one (similar to having a destructor method that deletes sub-objects).<br>Advantage is that one will never attempt to retract something that wasnt asserted as could happen if there is separate assertion and retraction code.<br><br>Storing the assertion in the PowerLoom interface is not useful, since I cannot then query in KIF to find all > the complex assertions. The storage of the assertions is not expressed in KIF itself.<br><br>I would like to say something like<br>(assert <br> (person-assertion joe-facts <-meta assertion?<br> (assert <br> (and <br> (person joe) <br> (hands joe 2) <br> (legs joe 2)<br> (exists (?h) (and (hand joe ?h) (nails ?h 5)) <span style="color: rgb(128, 0, 0);"><- assertion about nails cant be found > by (get-propositions-of joe) or (all-facts-of joe)</span><br> ....<br>)))) <br><br>and subsequently do<br>(retract-from-query (retrieve (person-assertion joe-facts)) -> all assertions about joe , and his hands and feet and their sub-assertions <br> are retracted<br><br>I guess what I am asking is...can the argument of a relation be a logic-object (which is what assert returns)? <br>If > yes, then the above should be possible....<br><br>Thanks<br>Srini<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> Thomas Russ <tar@...><br><b><span style="font-weight: bold;">To:</span></b> Srini Ram <srini_ramaswamy_i@...><br><b><span style="font-weight: bold;">Cc:</span></b> Hans Chalupsky <hans@...>; powerloom-forum@...<br><b><span style="font-weight: bold;">Sent:</span></b> Thursday, October 30, 2008 2:40:28 PM<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> > <br>On Oct 30, 2008, at 9:41 AM, Srini Ram wrote:<br><br>> I wrote below<br>> Is there any way to tag a set of assertions, so that you can <br>> just retract them as a group?<br>><br>> After reading the documentation for assert and destroy, I see that <br>> assert returns an object and destroy deletes an object.<br>> Is it possible to store the return value of a compound assert, and <br>> later pass it to a destroy which will retract all the propositions <br>> contained in that assert in one step? I couldnt find any examples of <br>> the use of destroy in the documentation or in the demos directory...<br><br>I don't think you want to use DESTROY. But you could retract the <br>resulting proposition.<br><br>The value returned by assert will be either a PROPOSITION object or a <br>LIST of PROPOSITIONS. You could iterate through that and call RETRACT- > <br>PROPOSITION on each item.<br><br>The easiest way to do this would be to use the PowerLoom interface <br>functions to assert a sentence and then save the value for later <br>retraction. You would presumably use the S-ASSERT-PROPOSITION and <br>RETRACT-PROPOSITION code. From Java this would look like<br><br> String myModuleName = "PL-USER";<br> Module myModule = PLI.getModule(myModuleName, null);<br> PlIterator props = PLI.sAssertProposition("(and (c i1) (c i2) (r <br>i1 i2))", myModuleName, null);<br> ...<br> while (props.nextP()) {<br> p = ((Proposition)(props.value));<br> edu.isi.powerloom.PLI.retractProposition(p, myModule, null);<br> }<br><br>Another option would be to use the context mechanism to spawn a new <br>reasoning context as a child of your current module and then > just <br>destroy that context when you no longer need it. This is a more <br>global and less selective strategy, but it frees you from having to <br>keep track of what it is you need to retract.<br><br>That can be handy if you are trying alternate scenarios. It also has <br>the advantage that you can keep multiple such scenarios around in <br>parallel and move between them. There is even some query-level <br>support (the IST operator) that supports it.<br><br>-Tom.<br><br></div></div></div><br> > </body></html> _______________________________________________ powerloom-forum mailing list powerloom-forum@... http://mailman.isi.edu/mailman/listinfo/powerloom-forum |
|
|
Re: Question about representing frame information and unification in PLThere is nothing magical about multiple inheritance in PowerLoom. It
just means that certain results can be derived in multiple ways which is often the case in logic-based systems. There is no requirement for merging or unification, all that is required is that everything that can be derived through the various different paths is consistent (so, if there is a clash it will be reported as an inconsistency). For example, suppose you defined the cardinality constraint as follows: STELLA(41): (defconcept person (?p) :=>> (range-cardinality eye-of ?p 2)) |c|PERSON STELLA(42): (defrelation eye-of ((?p person) ?eye)) |r|EYE-OF STELLA(43): (defconcept blue-eyed-person (person)) |c|BLUE-EYED-PERSON STELLA(44): (defconcept black-eyed-person (person)) |c|BLACK-EYED-PERSON STELLA(45): (assert (and (blue-eyed-person fred) (black-eyed-person fred))) (|P|(BLUE-EYED-PERSON FRED) |P|(BLACK-EYED-PERSON FRED)) STELLA(46): (retrieve all (range-cardinality eye-of fred ?n)) There is 1 solution: #1: ?N=2 STELLA(47): It doesn't matter which way you go up the chain, the result will be the same. It would have also been the same had you defined the same cardinality constraint separately on each of blue-eyed-person and black-eyed-person. Now, suppose you defined this differently: STELLA(48): (defconcept person (?p)) |c|PERSON STELLA(49): (defrelation eye-of ((?p person) ?eye)) |r|EYE-OF STELLA(50): (defrelation color-of (?x ?color)) |r|COLOR-OF STELLA(51): (defconcept blue-eyed-person (?p person) :=> (exists (?x ?y) (and (eye-of ?p ?x) (eye-of ?p ?y) (not (= ?x ?y)) (color-of ?x blue) (color-of ?y blue)))) |c|BLUE-EYED-PERSON STELLA(52): (defconcept black-eyed-person (?p person) :=> (exists (?x ?y) (and (eye-of ?p ?x) (eye-of ?p ?y) (not (= ?x ?y)) (color-of ?x black) (color-of ?y black)))) |c|BLACK-EYED-PERSON STELLA(53): (assert (and (blue-eyed-person fred) (black-eyed-person fred))) (|P|(BLUE-EYED-PERSON FRED) |P|(BLACK-EYED-PERSON FRED)) ;;; Now you are running into the problem Tom pointed out that you are ;;; creating multiple skolem individuals, since it is nowhere stated ;;; that there are at most two: STELLA(54): (retrieve all (eye-of fred ?e)) There are 4 solutions: #1: ?E=sk10 #2: ?E=sk11 #3: ?E=sk12 #4: ?E=sk13 However, this also doesn't mean that he has four eyes, since some of them could be identical. The skolems just assert existence, not identity. Btw, counting in the presence of skolems is generally hairy (and PowerLoom doesn't yet a good job at it), so, if you care about cardinalities, try to avoid skolems. Hans >>>>> Thomas Russ <tar@...> writes: > 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. _______________________________________________ powerloom-forum mailing list powerloom-forum@... http://mailman.isi.edu/mailman/listinfo/powerloom-forum |
| Free embeddable forum powered by Nabble | Forum Help |