public class QueryAnswers extends HashSet<Map<VarName,Concept>>
Wrapper class for a set of answers providing higher level filtering facilities as well as unification and join operations.
| Constructor and Description |
|---|
QueryAnswers() |
QueryAnswers(Collection<? extends Map<VarName,Concept>> ans) |
| Modifier and Type | Method and Description |
|---|---|
QueryAnswers |
filterByEntityTypes(Set<TypeAtom> types) |
QueryAnswers |
filterBySubstitutions(Set<IdPredicate> subs) |
QueryAnswers |
filterKnown(QueryAnswers known)
filter answers by discarding the already known ones
|
QueryAnswers |
filterNonEquals(Set<NotEquals> filters)
filter answers by applying NonEquals filters
|
QueryAnswers |
filterVars(Set<VarName> vars)
filter answers by constraining the variable set to the provided one
|
static <T extends ReasonerQuery> |
getUnifiedAnswers(T parentQuery,
T childQuery,
QueryAnswers answers)
unify answers of childQuery with parentQuery
|
QueryAnswers |
join(QueryAnswers localTuples)
perform a join operation between this and provided answers
|
QueryAnswers |
permute(Set<Map<VarName,VarName>> unifierSet,
Set<IdPredicate> subs,
Set<TypeAtom> types)
permute answer based on specified sets of permutations defined by unifiers
|
static Map<VarName,Concept> |
unify(Map<VarName,Concept> answer,
Map<VarName,VarName> unifiers) |
QueryAnswers |
unify(Map<VarName,VarName> unifiers)
unify the answers by applying unifiers to variable set
|
add, clear, clone, contains, isEmpty, iterator, remove, size, spliteratorequals, hashCode, removeAlladdAll, containsAll, retainAll, toArray, toArray, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArrayparallelStream, removeIf, streampublic QueryAnswers()
public QueryAnswers(Collection<? extends Map<VarName,Concept>> ans)
public QueryAnswers permute(Set<Map<VarName,VarName>> unifierSet, Set<IdPredicate> subs, Set<TypeAtom> types)
unifierSet - set of unifier mappings to perform the permutation onsubs - substitutions that need to mettypes - type constraints that need to be metpublic QueryAnswers filterVars(Set<VarName> vars)
vars - set of variable namespublic QueryAnswers filterKnown(QueryAnswers known)
known - set of known answerspublic QueryAnswers filterNonEquals(Set<NotEquals> filters)
filters - non equal atoms topublic QueryAnswers filterBySubstitutions(Set<IdPredicate> subs)
public QueryAnswers filterByEntityTypes(Set<TypeAtom> types)
public QueryAnswers join(QueryAnswers localTuples)
localTuples - right operand of join operationpublic QueryAnswers unify(Map<VarName,VarName> unifiers)
unifiers - map of [key: from/value: to] unifierspublic static Map<VarName,Concept> unify(Map<VarName,Concept> answer, Map<VarName,VarName> unifiers)
public static <T extends ReasonerQuery> QueryAnswers getUnifiedAnswers(T parentQuery, T childQuery, QueryAnswers answers)
parentQuery - parent atomic query containing target variablesCopyright © 2017 Grakn Labs Ltd. All rights reserved.