Package org.prolog4j
Class AbstractProver
- java.lang.Object
-
- org.prolog4j.AbstractProver
-
- All Implemented Interfaces:
Serializable
,Prover
- Direct Known Subclasses:
SWIPrologProver
,TuPrologProver
public abstract class AbstractProver extends Object implements Prover, Serializable
Serves as base class for prover implementation.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractProver(ConversionPolicy conversionPolicy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assertz(String fact, Object... args)
Asserts a Prolog fact or rule to the knowledge base.ConversionPolicy
getConversionPolicy()
Returns the conversion policy used by the prover.void
loadTheory(InputStream input)
Loads a Prolog theory from a stream.void
loadTheory(String input)
Loads a Prolog theory from a string.void
retract(String fact)
Retracts a Prolog fact or rule from the knowledge base.<A> Solution<A>
solve(String goal, Object... actualArgs)
Solves a Prolog goal and returns an object using which the individual solutions can be iterated over.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.prolog4j.Prover
addTheory, addTheory, loadLibrary, query
-
-
-
-
Constructor Detail
-
AbstractProver
public AbstractProver(ConversionPolicy conversionPolicy)
-
-
Method Detail
-
solve
public final <A> Solution<A> solve(String goal, Object... actualArgs)
Description copied from interface:Prover
Solves a Prolog goal and returns an object using which the individual solutions can be iterated over. It is equivalent with the following:query(goal).solve(actualArgs)
- Specified by:
solve
in interfaceProver
- Type Parameters:
A
- the type of an element of the solutions- Parameters:
goal
- the Prolog goalactualArgs
- the actual arguments of the goal- Returns:
- an object for traversing the solutions
- See Also:
Query.solve(Object...)
-
assertz
public void assertz(String fact, Object... args)
Description copied from interface:Prover
Asserts a Prolog fact or rule to the knowledge base.
-
retract
public void retract(String fact)
Description copied from interface:Prover
Retracts a Prolog fact or rule from the knowledge base.
-
loadTheory
public void loadTheory(InputStream input) throws IOException
Description copied from interface:Prover
Loads a Prolog theory from a stream.- Specified by:
loadTheory
in interfaceProver
- Parameters:
input
- the stream- Throws:
IOException
-
loadTheory
public void loadTheory(String input)
Description copied from interface:Prover
Loads a Prolog theory from a string.- Specified by:
loadTheory
in interfaceProver
- Parameters:
input
- the string
-
getConversionPolicy
public ConversionPolicy getConversionPolicy()
Description copied from interface:Prover
Returns the conversion policy used by the prover.- Specified by:
getConversionPolicy
in interfaceProver
- Returns:
- the conversion policy
-
-