/** * @param expressions * @return map with defined signatures as key and {@link SourceInfo} as value. * @throws ParserException */ protected Map<String, SourceInfo> getDefinedSignatures(Collection<DatabaseFormula> formulas) throws ParserException { CognitiveKR ckr = getCognitiveKR(); Map<String, SourceInfo> signatures = new LinkedHashMap<>(formulas.size()); for (DatabaseFormula formula : formulas) { for (String signature : ckr.getDefinedSignatures(formula)) { signatures.put(signature, formula.getSourceInfo()); } } return signatures; }
/** * @param formulas * @return map with all explicitly declared signatures as key and all * {@link SourceInfo} as value. * @throws ParserException */ protected Map<String, SourceInfo> getDeclaredSignatures(Collection<DatabaseFormula> formulas) throws ParserException { CognitiveKR ckr = getCognitiveKR(); Map<String, SourceInfo> signatures = new LinkedHashMap<>(formulas.size()); for (DatabaseFormula formula : formulas) { for (String signature : ckr.getDeclaredSignatures(formula)) { signatures.put(signature, formula.getSourceInfo()); } } return signatures; }
/** * Add predicates used in a clause as queries. */ public void addQuery(DatabaseFormula formula) { // we may assume the formula is a single term, so we can just // as well handle the inner term as a general term. addQuery(((PrologDBFormula) formula).getCompound(), formula.getSourceInfo()); }
@Override public Set<String> getDeclaredSignatures(DatabaseFormula formula) throws ParserException { return SemanticTools.getDeclaredSignatures(((PrologDBFormula) formula).getCompound(), formula.getSourceInfo()); }
@Override public Set<String> getDefinedSignatures(DatabaseFormula formula) throws ParserException { return SemanticTools.getDefinedSignatures(((PrologDBFormula) formula).getCompound(), formula.getSourceInfo()); }
reportWarning(MASWarning.PREDICATE_UNUSED, belief.getSourceInfo(), belief.getSignature());