Re: assert vs instance-of and other questions
Hans Chalupsky <[email protected]>
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
One follow-up to Tom's reply: >>>>> Kotaro FUNAKOSHI <[email protected]> writes: > Dear members, > I have three questions about PowerLoom. I will highly appreciate it > if somebody gives me answers. > (1) assert vs instance-of > I found an asymmetricity between (A) asserting conceptual propositions using > command "assert" directly and (B) asserting conceptual propositions using > relation "instance-of". > ... > Why cannot PowerLoom answer that (monkey george) is TRUE when I use > "instance-of" even though it answers correctly against (ask (instance-of george animal))? > I just wanted to use "instance-of" because I prefer frame-style descriptions > such as > (definstance george > :instance-of monkey > :likes banana > :at forest1 > :age 4). > I can simply avoid this problem by using always command "assert" like > (definstance george > :likes banana > :at forest1 > :age 4) > (assert (monkey george)). ( yet not so elegant :-( ) > Even avoidable, such a behavior of PowerLoom makes me feel ill at ease... > Is this an intended behavior or just a bug? Well it's somewhere inbetween. "instance-of" and "type-of" are really just intended to be query relations that allow you to retrieve the types an instance belongs to. PowerLoom's inference machinery makes strong assumptions about the nature of type assertions in many places and looks for assertions of the type `(<concept> <i>)', but not for `(instance-of <i> <concept>)'. Currently, `instance-of' assertions are not forbidden but also not normalized into the corresponding `(<concept> <i>)' assertion. One way to work around this would be by adding a rule as you suggest below, however, there are two caveats: (1) the rule should be a forward rule for efficiency, that way every time you assert `instance-of' the corresponding type assertion is generated instantly and no inference is needed during backchaining to generate it. You would do this as follows (note the double arrow): (forall (?x ?c) (=>> (and (concept ?c) (instance-of ?x ?c)) (?c ?x))) This also avoids the rule indexing problem. (2) unfortunately, this doesn't work since for performance reasons `instance-of' is currently marked as a non-chainable relation, so the rule will not do what you want it to. Conceivably, this might be relaxed at some point. > (2) Warning: PowerLoom can't index the rule > I tried to avoid the problem described above by using a rule. But I got a > warning message "Warning: PowerLoom can't index the rule" and the rule > seems not to work. > The rule is here: > (defrule "instance-of TO assert" > (forall (?x ?c) (=> (and (concept ?c) (instance-of ?x ?c)) (?c ?x)))) > What's the meaning of the message and what's wrong with my rule? Just to elaborate on Tom's reply: the reason that this can't be indexed is that the rule consequent is second-order since it has a variable in the relation position. This rule would be way too general and could lead to serious performance problems, since it would match any unary goal. Turning the rule into a forward rule fixes this, since in that case the relation variable ?c gets instantiated during forward inference and produces a regular assertion (again with the caveat that currently this won't work for "instance-of"). Hans