/** * Return true if the given predicated is tabled, currently this is true if the predicate is a * tabled predicate or the predicate is a wildcard and some tabled predictes exist. */ public boolean isTabled(Node predicate) { if (allTabled) return true; if (predicate.isVariable() && !tabledPredicates.isEmpty()) { return true; } else { return tabledPredicates.contains(predicate); } }
/** * Register an RDF predicate as one whose presence in a goal should force the goal to be tabled. */ public synchronized void tablePredicate(Node predicate) { tabledPredicates.add(predicate); if (predicate == Node.ANY) allTabled = true; }
/** Add all the rules and tabling instructions from an existing rulestore into this one. */ public void addAll(LPRuleStore store) { super.addAll(store); tabledPredicates.addAll(store.tabledPredicates); allTabled = tabledPredicates.contains(Node.ANY); }