info-gnuprologjava
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Info-gnuprologjava] Question on loading Prolog files


From: Sergio Castro
Subject: [Info-gnuprologjava] Question on loading Prolog files
Date: Fri, 17 May 2013 10:43:26 -0700 (PDT)

I was looking for a Prolog interpreter embedded in Java and this project took my interest.

I am reading the setup instructions in the user manual (http://www.gnu.org/software/gnuprologjava/manual/Constructing-Terms.html#Constructing-Terms) and there is something that is not entirely clear to me. Quoting relevant sentences from the manual:

---
..."load any prolog files you want to which define additional predicates etc using environment.ensureLoaded(AtomTerm.get(``URL of file'')) for each file. " ...
"you will need to create at least one gnu.prolog.vm.Interpreter which is used to execute goals. You do this using environment.createInterpreter(). "
"Having created it you need to use it to run the initialization of any files you have loaded by using env.runInitialization(interpreter);. This ensures the goals contained in any “:- initialization(goal).” or “:- goal.”s in the files you have loaded are run."
---

Does it mean that the only mechanism for loading files is with "environment.ensureLoaded" ? So the ISO predicate "ensure_loaded/1" does not work ?
I am wondering if there is a way to load additional files after the Interpreter has been created and initialized with "env.runInitialization(...)"

I guess that in case "environment.ensureLoaded(...)" needs to be called again AFTER the instantiation and initialization of the interpreter then
"env.runInitialization(...)" should also be called again in order to load any “:- initialization(goal).” or “:- goal.”s in the new loaded file ???.
If this is correct, does it mean that all the initialization directives that were executed in the first call to "env.runInitialization(...)" will be executed again ?

Thanks for any help on this regard,

cheers,

Sergio


reply via email to

[Prev in Thread] Current Thread [Next in Thread]