/** * {@inheritDoc} * * <p/>This also resets the entire knowledge base of this resolver, so that it is empty. */ public void reset() { // Empty the knowledge base and clear the current query. domain = new HashMap<Integer, List<PrologCompiledClause>>(); currentQuery = null; // Reset the underlying search. resolutionSearch.reset(); // If printing execution traces, ensure the execution indenter starts from zero. /*if (TRACE) { indenter.reset(); }*/ }
/** * Calculates the set of free variables in a term. * * @param query The term to calculate the free non-anonymous variable set from. * * @return A set of variables that are free and non-anonymous in the term. */ public static Set<Variable> findFreeVariables(Term query) { QueueBasedSearchMethod<Term, Term> freeVarSearch = new DepthFirstSearch<Term, Term>(); freeVarSearch.reset(); freeVarSearch.addStartState(query); freeVarSearch.setGoalPredicate(new FreeVariablePredicate()); return (Set<Variable>) (Set) Searches.setOf(freeVarSearch); }
/** * Calculates the set of free and non-anonymous variables in a term. This is the set of variables that a user query * usually wants to be made aware of. * * @param query The term to calculate the free non-anonymous variable set from. * * @return A set of variables that are free and non-anonymous in the term. */ public static Set<Variable> findFreeNonAnonymousVariables(Term query) { QueueBasedSearchMethod<Term, Term> freeVarSearch = new DepthFirstSearch<Term, Term>(); freeVarSearch.reset(); freeVarSearch.addStartState(query); freeVarSearch.setGoalPredicate(new FreeNonAnonymousVariablePredicate()); return (Set<Variable>) (Set) Searches.setOf(freeVarSearch); }
search.reset(); search.addStartState(new HierarchyLabelState(label, initialPath));
/** {@inheritDoc} */ public void setQuery(PrologCompiledClause query) { // Reset the search in order to initialize it. resolutionSearch.reset(); // Keep a reference to the current query. currentQuery = query; // Create the starting point for the resolution, consisting of the queries to resolve as the intial goal stack, // and an empty list of bindings. goalStack = new StackQueue<BuiltInFunctor>(); // Create a fresh list to hold the results of the resolution in. bindings = new StackQueue<Variable>(); // Create the initial state of the proof search. ResolutionState initialState = new ResolutionStateImpl(query); addStartState(initialState); // If printing execution traces, ensure the execution indenter starts from zero. /*if (TRACE) { indenter.reset(); }*/ }
/** * Calculates the set of free variables in a term. * * @param query The term to calculate the free non-anonymous variable set from. * * @return A set of variables that are free and non-anonymous in the term. */ public static Set<Variable> findFreeVariables(Term query) { QueueBasedSearchMethod<Term, Term> freeVarSearch = new DepthFirstSearch<Term, Term>(); freeVarSearch.reset(); freeVarSearch.addStartState(query); freeVarSearch.setGoalPredicate(new FreeVariablePredicate()); return (Set<Variable>) (Set) Searches.setOf(freeVarSearch); }
search.reset();
/** * Calculates the set of free and non-anonymous variables in a term. This is the set of variables that a user query * usually wants to be made aware of. * * @param query The term to calculate the free non-anonymous variable set from. * * @return A set of variables that are free and non-anonymous in the term. */ public static Set<Variable> findFreeNonAnonymousVariables(Term query) { QueueBasedSearchMethod<Term, Term> freeVarSearch = new DepthFirstSearch<Term, Term>(); freeVarSearch.reset(); freeVarSearch.addStartState(query); freeVarSearch.setGoalPredicate(new FreeNonAnonymousVariablePredicate()); return (Set<Variable>) (Set) Searches.setOf(freeVarSearch); }
search.reset();
search.reset();
search.reset();
postfixSearch.reset(); postfixSearch.addStartState(nextFunctorArg); postfixSearch.setGoalPredicate(new FunctorTermPredicate());