Class Inspect
- java.lang.Object
-
- org.projog.core.predicate.AbstractPredicateFactory
-
- org.projog.core.predicate.builtin.kb.Inspect
-
- All Implemented Interfaces:
KnowledgeBaseConsumer,PredicateFactory
public final class Inspect extends AbstractPredicateFactory
clause(X,Y)/retract(X)- matches terms to existing clauses.clause(X,Y)causesXandYto be matched to the head and body of an existing clause. If no clauses are found for the predicate represented byXthen the goal fails. If there are more than one that matches, the clauses will be matched one at a time as the goal is re-satisfied.Xmust be suitably instantiated that the predicate of the clause can be determined.retract(X)- remove clauses from the knowledge base. The first clause thatXmatches is removed from the knowledge base. When an attempt is made to re-satisfy the goal, the next clause thatXmatches is removed.Xmust be suitably instantiated that the predicate of the clause can be determined.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classInspect.InspectPredicate
-
Field Summary
Fields Modifier and Type Field Description private booleandoRemoveMatchestrueif matching rules should be removed (retracted) from the knowledge base as part of calls to#evaluate(Term, Term)orfalseif the knowledge base should remain unaltered.
-
Constructor Summary
Constructors Modifier Constructor Description privateInspect(boolean doRemoveMatches)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PredicategetPredicate(Term clauseHead)protected PredicategetPredicate(Term clauseHead, Term clauseBody)static InspectinspectClause()static Inspectretract()-
Methods inherited from class org.projog.core.predicate.AbstractPredicateFactory
getArithmeticOperators, getFileHandles, getKnowledgeBase, getOperands, getPredicate, getPredicate, getPredicate, getPredicate, getPredicates, getProjogListeners, getSpyPoints, getTermFormatter, init, isRetryable, setKnowledgeBase
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.projog.core.predicate.PredicateFactory
isAlwaysCutOnBacktrack
-
-
-
-
Method Detail
-
inspectClause
public static Inspect inspectClause()
-
retract
public static Inspect retract()
-
getPredicate
protected Predicate getPredicate(Term clauseHead)
- Overrides:
getPredicatein classAbstractPredicateFactory
-
getPredicate
protected Predicate getPredicate(Term clauseHead, Term clauseBody)
- Overrides:
getPredicatein classAbstractPredicateFactory
-
-