Re: :axioms (single-valued r) not work
Hans Chalupsky <[email protected]> Wed, 21 Mar 2007 10:56:31 -0800
| Newsgroups | gmane.comp.ai.powerloom |
|---|---|
| Message-ID | <[email protected]> |
Hi,
the problem is that PowerLoom delays the processing of bodies of
definition until either a query is run or the command
`process-definitions' is called. Therefore, when you made the two age
assertions, the single-valued assertion hadn't been seen yet.
Currently, PowerLoom is not aggressive enough to raise a clash after
the fact if you change a relation to single-valued-ness, in case an
object with multiple values is found (that would require the scanning
of a potentially very large number of assertions).
There are various things you can do:
(1) call (process-definitions) before you make the age assertions
(see example below)
(2) define age via deffunction
(3) make the (single-valued age) assertion separate outside the
defrelation body
STELLA(17): (defconcept person)
|c|PERSON
STELLA(18): (defrelation age ((?p person) ?y) :axioms (single-valued age))
|r|AGE
STELLA(19): (process-definitions)
()
STELLA(20): (assert (age p1 2))
|P|(AGE P1 2)
STELLA(21): (assert (age p1 4))
|P|(AGE P1 4)
STELLA(22): (retrieve all (age ?x ?y))
There is 1 solution:
#1: ?X=P1, ?Y=4
STELLA(23):
Note, that PowerLoom will do clipping on top-level assertions to
single-valued relations (and functions), i.e., the second assertion
will non-monotonically retract the previous value and assert the new
one. If something like that happens during inference, a clash will be
raised.
Hans
--------------------------------------------------------------------------
Hans Chalupsky, PhD USC Information Sciences Institute
Project Leader, Loom KR&R Group 4676 Admiralty Way
<[email protected]> Marina del Rey, CA 90292
(310) 448-8745
--------------------------------------------------------------------------
>>>>> hui wangh <[email protected]> writes:
> No one help me?
> 2007/3/20, hui wangh <[email protected]>:
>>
>> hello everyone !
>> I try to use single-valued with relation, but it not work. powerloom
>> version is 3.2.11
>> this is my code ,between --start-- and --end--
>>
>> --start--
>> PL-USER |= (defconcept person)
>>
>> |c|PERSON
>>
>> PL-USER |= (defrelation age ((?p person) ?y) :axioms (single-valued age))
>>
>> |r|AGE
>>
>> PL-USER |= (assert (person p1))
>>
>> |P|(PERSON P1)
>>
>> PL-USER |= (assert (age p1 2))
>>
>> |P|(AGE P1 2)
>>
>> PL-USER |= (assert (age p1 4))
>>
>> |P|(AGE P1 4)
>>
>> PL-USER |= (retrieve all (age ?x ?y))
>>
>> There are 2 solutions:
>> #1: ?X=P1, ?Y=4
>> #2: ?X=P1, ?Y=2
>>
>> --end--
>>
>> Any wrong here? what should I do?