[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Info-gnuprologjava] Adding facts to environment dynamicly
From: |
Daniel Thomas |
Subject: |
Re: [Info-gnuprologjava] Adding facts to environment dynamicly |
Date: |
Mon, 06 Jun 2011 13:20:40 +0100 |
Hello,
Before you can use assert[a,z] on a predicate you first need to declare
it to be dynamic e.g.
:- dynamic(foo/1).
I hope that helps,
Daniel
On Sun, 2011-06-05 at 14:32 +0200, Dominik Schmeiser wrote:
> Hi all,
>
> Me and my collegue are working with GPJ on an project for the university.
> we have a Prolog-Environment which already loaded some facts. (using
> environment.ensureLoaded(...))
>
> e.g.
> foo(bar1).
> foo(bar2).
>
> Now we try to invoke a rule (using interpreter.execute(...)).
> This rule should create some new facts in the environment,
>
> e.g.
> invoke :- assert( foo(bar3) ).
>
> Our problem:
> When we use the predicate "assert" t is not recognized:
> - gnu.prolog.vm.PrologException: error(existence_error(procedure,assert /
> 1),error)
> When we try "asserta" or "assertz" we have another error that implies we
> would like to override the facts which are already in the environment:
> - gnu.prolog.vm.PrologException:
> error(permission_error(modify,static_procedure,foo / 1),error)
>
> Our question:
> Is there any possibility to add facts to the environment dynamicly?
>
> Please note that I'm not on the mailing list so please reply directly.
>
> TIA
>
> Dominik
>
>
>
>
signature.asc
Description: This is a digitally signed message part