Metaprogramming question: transform assert+query to query+assert
From: Daniel Speicher (dsp_at_iai.uni-bonn.de)
Date: 04/06/04
- Next message: Jörg Striegnitz: "MPOOL'04 -- Second Call for Contributions"
- Previous message: Bill Spight: "Re: Why does Prolog fail?"
- Next in thread: Dave: "Re: Metaprogramming question: transform assert+query to query+assert"
- Reply: Dave: "Re: Metaprogramming question: transform assert+query to query+assert"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 06 Apr 2004 19:23:49 +0200
Hi all!
I'm thinking about a question, which should have been solved somewhere
out there. Up to now I wasn't able to find the whole answer. I'll state
my question by an simple example:
There is a predicate:
mypredicate(_a, _b) :- myfact(_a, _b), anotherfact(_a). (1)
Then
assert(myfact(1, 2)). (2)
followed by
mypredicate(_a, _b).
should give the same result as
mypredicate(_a, _b); _a=1,_b=2,anotherfact(1). (3)
and after
assert(myfact(1, 2)).
the fact base should be in the same state.
I generated (3) from (1) and (2). This was easy in this simple case. But
I wonder if there is a systematic way to do this. My final aim is to
have a transformation of a sequence of the form
{assert(..), query(..)}*
to a somehow equivalent sequence of the form
{modified-query(..)}*, {modified-assert(..)}*
I made some progress on this although the things become harder if
retraction of facts or recursive predicates are involved.
Can anybody answer this question or point me to some research work on
this topic. It would be even helpful to get to know the appropriate name
or keyword for this kind of question.
Thanks for any hint,
Daniel
- Next message: Jörg Striegnitz: "MPOOL'04 -- Second Call for Contributions"
- Previous message: Bill Spight: "Re: Why does Prolog fail?"
- Next in thread: Dave: "Re: Metaprogramming question: transform assert+query to query+assert"
- Reply: Dave: "Re: Metaprogramming question: transform assert+query to query+assert"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]