Re: Question about representing frame information and unification in PL

Srini Ram <[email protected]> Thu, 30 Oct 2008 12:02:47 -0700 (PDT)
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
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 <[email protected]>
To: Srini Ram <[email protected]>
Cc: Hans Chalupsky <[email protected]>; [email protected]
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.

_______________________________________________
powerloom-forum mailing list
[email protected]
http://mailman.isi.edu/mailman/listinfo/powerloom-forum