public abstract class AbstractEngine extends Object implements PrologEngine
PrologEngine.| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractEngine.PrologProgramIterator |
| Modifier and Type | Field and Description |
|---|---|
protected PrologProvider |
provider |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractEngine(PrologProvider provider) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(PrologTerm goal)
Check if the given goal array have solution using the resolution engine
mechanism.
|
boolean |
contains(PrologTerm goal,
PrologTerm... goals)
Check if the given goal array have solution using the resolution engine
mechanism.
|
boolean |
contains(String goal)
Parse the string creating internal prolog clause and returning true if the
given goal have solution using the resolution engine mechanism.
|
Set<PrologIndicator> |
currentPredicates()
Predicate set defined in the wrapped prolog engine.
|
boolean |
equals(Object object) |
protected <K> K |
fromTerm(PrologTerm term,
Class<K> to) |
protected <K> K |
fromTerm(PrologTerm head,
PrologTerm[] body,
Class<K> to) |
PrologLogger |
getLogger()
Get the prolog system logger instance to report any errors or exceptions
|
String |
getOSArch()
Return the host operating system architecture.
|
String |
getOSName()
Return the host operating system name.
|
String |
getOSVersion()
Return the host operating system version.
|
Set<PrologClause> |
getProgramClauses()
Make and return a copy of the clause set present in the current engine.
|
Map<String,List<PrologClause>> |
getProgramMap()
Make and return a copy of the clause map present in the current engine.
|
PrologProvider |
getProvider()
Get a Prolog provider instance hold in the current engine.
|
int |
hashCode() |
boolean |
isProgramEmpty()
Check if the program in main memory is empty returning true if the clause
number in the program is 0 and false in otherwise.
|
Map<String,PrologTerm> |
match(PrologTerm t1,
PrologTerm t2)
Match to other term returning list of substitutions.
|
io.github.prolobjectlink.prolog.DefaultClauseBuilder |
newClauseBuilder()
Create a new clause builder instance to build prolog clauses
programmatically.
|
io.github.prolobjectlink.prolog.DefaultQueryBuilder |
newQueryBuilder()
Create a new query builder instance to build prolog goal programmatically.
|
void |
persist(Writer writer)
Write the prolog clauses in program present in the current engine using the
given driver.
|
List<Map<String,PrologTerm>> |
queryAll(PrologTerm goal) |
List<Map<String,PrologTerm>> |
queryAll(PrologTerm goal,
PrologTerm... goals)
Create a new prolog query and return the list of prolog terms that conform
the solution set for the current query.
|
List<Map<String,PrologTerm>> |
queryAll(String goal)
Create a new prolog query and return the list of prolog terms that conform
the solution set for the current query.
|
List<Map<String,PrologTerm>> |
queryN(int n,
PrologTerm term) |
List<Map<String,PrologTerm>> |
queryN(int n,
PrologTerm term,
PrologTerm... terms)
Create a new prolog query and return the list of (N) prolog terms that
conform the solution set for the current query.
|
List<Map<String,PrologTerm>> |
queryN(int n,
String goal)
Create a new prolog query and return the list of (N) prolog terms that
conform the solution set for the current query.
|
Map<String,PrologTerm> |
queryOne(PrologTerm goal) |
Map<String,PrologTerm> |
queryOne(PrologTerm goal,
PrologTerm... goals)
Create a new prolog query and return the prolog terms that conform the
solution set for the current query.
|
Map<String,PrologTerm> |
queryOne(String goal)
Create a new prolog query and return the prolog terms that conform the
solution set for the current query.
|
protected String |
removeQuoted(String functor) |
boolean |
runOnLinux()
Check if the host operating system name refer to Linux OS.
|
boolean |
runOnOSX()
Check if the host operating system name refer to OsX.
|
boolean |
runOnWindows()
Check if the host operating system name refer to Windows OS.
|
String |
toString() |
protected <K extends PrologTerm> |
toTerm(Object o,
Class<K> from) |
protected <K extends PrologTerm,V> |
toTermMapArray(Map<String,V>[] map,
Class<K> from) |
boolean |
unify(PrologTerm t1,
PrologTerm t2)
Check that two terms (x and y) unify.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitabolish, asserta, asserta, asserta, assertz, assertz, assertz, clause, clause, clause, consult, consult, currentOperator, currentOperators, currentPredicate, dispose, getBuiltIns, getLicense, getName, getPredicates, getProgram, getProgramSize, getVendor, getVersion, include, include, operator, persist, query, query, query, query, retract, retract, retract, verifyforEach, iterator, spliteratorprotected final PrologProvider provider
protected AbstractEngine(PrologProvider provider)
public final PrologProvider getProvider()
PrologEnginegetProvider in interface PrologEnginepublic final void persist(Writer writer)
PrologEnginepersist in interface PrologEnginewriter - writer for write prolog clauses in the program.public final boolean unify(PrologTerm t1, PrologTerm t2)
PrologEngineunify in interface PrologEnginet1 - the term to unify.t2 - the term to unify.public Map<String,PrologTerm> match(PrologTerm t1, PrologTerm t2)
PrologEnginematch in interface PrologEnginet1 - the term to unify.t2 - the term to unify.public final boolean contains(String goal)
PrologEnginequery(goal).hasSolution()contains in interface PrologEnginegoal - goal to be queriedpublic final boolean contains(PrologTerm goal)
PrologEnginequery(goal).hasSolution()contains in interface PrologEnginegoal - goal to be checkedpublic final boolean contains(PrologTerm goal, PrologTerm... goals)
PrologEnginequery(goal).hasSolution()contains in interface PrologEnginegoal - goal to be checkedgoals - goals array with the rest of conjunctive goals term (can be
empty)public final Map<String,PrologTerm> queryOne(String goal)
PrologEngine
List<Map<String, PrologTerm>> m = engine.queryAll("parent(X, Y)");
queryOne in interface PrologEnginegoal - string query with prolog format.public final Map<String,PrologTerm> queryOne(PrologTerm goal)
queryOne in interface PrologEnginepublic final Map<String,PrologTerm> queryOne(PrologTerm goal, PrologTerm... goals)
PrologEngine
PrologVariable x = provider.newVariable("X", 0);
PrologVariable y = provider.newVariable("Y", 1);
Map<String, PrologTerm> m = engine.queryOne(provider.newStructure("parent", x, y));
queryOne in interface PrologEnginegoal - prolog term to be querygoals - prolog term array to be query.public final List<Map<String,PrologTerm>> queryN(int n, String goal)
PrologEnginequeryN in interface PrologEnginen - query result instance numbergoal - string with prolog syntax to be querypublic final List<Map<String,PrologTerm>> queryN(int n, PrologTerm term)
queryN in interface PrologEnginepublic final List<Map<String,PrologTerm>> queryN(int n, PrologTerm term, PrologTerm... terms)
PrologEngine
PrologVariable x = provider.newVariable("X", 0);
PrologVariable y = provider.newVariable("Y", 1);
List<Map<String, PrologTerm>> m = engine.queryN(5, provider.newStructure("parent", x, y));
queryN in interface PrologEnginen - query result instance numberterm - prolog term to be queryterms - prolog term array to be query.public final List<Map<String,PrologTerm>> queryAll(String goal)
PrologEnginequeryAll in interface PrologEnginegoal - string with prolog syntax to be querypublic final List<Map<String,PrologTerm>> queryAll(PrologTerm goal)
queryAll in interface PrologEnginepublic final List<Map<String,PrologTerm>> queryAll(PrologTerm goal, PrologTerm... goals)
PrologEngine
PrologVariable x = provider.newVariable("X", 0);
PrologVariable y = provider.newVariable("Y", 1);
List<Map<String, PrologTerm>> m = engine.queryAll(provider.newStructure("parent", x, y));
queryAll in interface PrologEnginegoal - prolog term to be querygoals - prolog term array to be query.public final Map<String,List<PrologClause>> getProgramMap()
PrologEnginegetProgramMap in interface PrologEnginepublic final Set<PrologClause> getProgramClauses()
PrologEnginegetProgramClauses in interface PrologEnginepublic final boolean isProgramEmpty()
PrologEnginePrologEngine.isProgramEmpty() will be defined like
PrologEngine#getProgramSize()==0;.isProgramEmpty in interface PrologEnginepublic final Set<PrologIndicator> currentPredicates()
PrologEngineSet<PrologIndicator> cp = new HashSet<PrologIndicator>(); cp.addAll(getPredicates()); cp.addAll(getBuiltIns());
currentPredicates in interface PrologEnginepublic final io.github.prolobjectlink.prolog.DefaultQueryBuilder newQueryBuilder()
PrologEnginenewQueryBuilder in interface PrologEnginepublic final io.github.prolobjectlink.prolog.DefaultClauseBuilder newClauseBuilder()
PrologEnginenewClauseBuilder in interface PrologEnginepublic final boolean runOnOSX()
PrologEnginerunOnOSX in interface PrologEnginepublic final boolean runOnWindows()
PrologEnginerunOnWindows in interface PrologEnginepublic final boolean runOnLinux()
PrologEnginerunOnLinux in interface PrologEnginepublic final String getOSName()
PrologEngineSystem.getProperty("os.name");.getOSName in interface PrologEnginepublic final String getOSVersion()
PrologEngineSystem.getProperty("os.version");.getOSVersion in interface PrologEnginepublic final String getOSArch()
PrologEngineSystem.getProperty("os.arch");.getOSArch in interface PrologEnginepublic final PrologLogger getLogger()
PrologEnginegetLogger in interface PrologEngineprotected final <K extends PrologTerm> K toTerm(Object o, Class<K> from)
protected final <K extends PrologTerm,V> Map<String,PrologTerm>[] toTermMapArray(Map<String,V>[] map, Class<K> from)
protected final <K> K fromTerm(PrologTerm term, Class<K> to)
protected final <K> K fromTerm(PrologTerm head, PrologTerm[] body, Class<K> to)
Copyright © 2020–2024 Prolobjectlink Project. All rights reserved.