Class Inspect
java.lang.Object
org.projog.core.predicate.AbstractPredicateFactory
org.projog.core.predicate.builtin.kb.Inspect
- All Implemented Interfaces:
KnowledgeBaseConsumer, PredicateFactory
clause(X,Y) / retract(X) - matches terms to existing clauses.
clause(X,Y) causes X and Y to be matched to the head and body of an existing
clause. If no clauses are found for the predicate represented by X then 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. X
must be suitably instantiated that the predicate of the clause can be determined.
retract(X) - remove clauses from the knowledge base. The first clause that X matches is
removed from the knowledge base. When an attempt is made to re-satisfy the goal, the next clause that X
matches is removed. X must be suitably instantiated that the predicate of the clause can be determined.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleantrueif matching rules should be removed (retracted) from the knowledge base as part of calls toorinvalid reference
#evaluate(Term, Term)falseif the knowledge base should remain unaltered. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PredicategetPredicate(Term clauseHead) protected PredicategetPredicate(Term clauseHead, Term clauseBody) static Inspectstatic Inspectretract()Methods inherited from class AbstractPredicateFactory
getArithmeticOperators, getFileHandles, getKnowledgeBase, getOperands, getPredicate, getPredicate, getPredicate, getPredicate, getPredicates, getProjogListeners, getSpyPoints, getTermFormatter, init, isRetryable, setKnowledgeBaseMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PredicateFactory
isAlwaysCutOnBacktrack
-
Field Details
-
doRemoveMatches
private final boolean doRemoveMatchestrueif matching rules should be removed (retracted) from the knowledge base as part of calls toorinvalid reference
#evaluate(Term, Term)falseif the knowledge base should remain unaltered.
-
-
Constructor Details
-
Inspect
private Inspect(boolean doRemoveMatches)
-
-
Method Details
-
inspectClause
-
retract
-
getPredicate
- Overrides:
getPredicatein classAbstractPredicateFactory
-
getPredicate
- Overrides:
getPredicatein classAbstractPredicateFactory
-