Class SolutionMappingsHashTableBasedOnOneVar
java.lang.Object
se.liu.ida.hefquin.base.datastructures.impl.SolutionMappingsIndexBase
se.liu.ida.hefquin.base.datastructures.impl.SolutionMappingsHashTableBasedOnOneVar
- All Implemented Interfaces:
Iterable<SolutionMapping>,Collection<SolutionMapping>,SolutionMappingsIndex,StatsProvider
This is a hash table based implementation of
SolutionMappingsIndex
that can be used for indexes that are built on one query variable and that
are meant to be used for cases in which adding and probing into the index
may not happen concurrently.
As mentioned above, this implementation assumes that adding and probing
into the index may not happen concurrently. Based on this assumption,
for every method that returns an Iterable of solution mappings,
the Iterable that it returns is directly based on an internal
data structure (rather than being a new Iterable into which the
solution mappings have been copied). For cases in which the assumption
does not hold (i.e., cases in which adding and probing into the index
may actually happen concurrently), an object of this class may simply
be wrapped in a SolutionMappingsIndexForMixedUsage which then
creates a new Iterable for every Iterable returned by
this implementation.
Another assumption of this implementation is that the only variable
relevant for index look-ups is the variable on which the index is built.
In other words, the assumption is that the only variable that the solution
mappings added to the index have in common with the solution mappings
given to the method getJoinPartners(SolutionMapping) is the
variable on which the index is built. For cases in which this assumption
does not hold, a SolutionMappingsIndexWithPostMatching can be
used to wrap a SolutionMappingsHashTableBasedOnOneVar.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.jena.sparql.core.Varprotected final Map<org.apache.jena.graph.Node,List<SolutionMapping>> -
Constructor Summary
ConstructorsConstructorDescriptionSolutionMappingsHashTableBasedOnOneVar(org.apache.jena.sparql.core.Var joinVar) -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidclear()booleanfindSolutionMappings(org.apache.jena.sparql.core.Var var, org.apache.jena.graph.Node value) Returns an iterator over all solution mappings in this index that map the given variable to the given value.findSolutionMappings(org.apache.jena.sparql.core.Var var1, org.apache.jena.graph.Node value1, org.apache.jena.sparql.core.Var var2, org.apache.jena.graph.Node value2) Returns an iterator over all solution mappings in this index that map the first variable to the first value and the second variable to the second value.findSolutionMappings(org.apache.jena.sparql.core.Var var1, org.apache.jena.graph.Node value1, org.apache.jena.sparql.core.Var var2, org.apache.jena.graph.Node value2, org.apache.jena.sparql.core.Var var3, org.apache.jena.graph.Node value3) This method is a three-variables version of the methodSolutionMappingsIndex.findSolutionMappings(Var, Node).Returns all solution mappings currently in this index.This method assumes that the only variable that the given solution mapping has in common with the solution mappings in the index is the variable on which the index is built.protected org.apache.jena.graph.NodebooleanisEmpty()intsize()Methods inherited from class se.liu.ida.hefquin.base.datastructures.impl.SolutionMappingsIndexBase
addAll, containsAll, findSolutionMappingsLastResort, findSolutionMappingsLastResort, findSolutionMappingsLastResort, getStats, remove, removeAll, resetStats, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArrayMethods inherited from interface se.liu.ida.hefquin.base.datastructures.SolutionMappingsIndex
iterator
-
Field Details
-
map
-
joinVar
protected final org.apache.jena.sparql.core.Var joinVar
-
-
Constructor Details
-
SolutionMappingsHashTableBasedOnOneVar
public SolutionMappingsHashTableBasedOnOneVar(org.apache.jena.sparql.core.Var joinVar)
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
getAllSolutionMappings
Description copied from interface:SolutionMappingsIndexReturns all solution mappings currently in this index. -
add
-
clear
public void clear() -
getJoinPartners
This method assumes that the only variable that the given solution mapping has in common with the solution mappings in the index is the variable on which the index is built. For cases in which this assumption does not hold, the returned solution mappings are not actually join partners but only candidates for join partners; hence, they still need to be checked for compatibility with the given solution mapping. In cases in which he assumption is not guaranteed to hold, this index can be wrapped by aSolutionMappingsIndexWithPostMatchingwhich takes care of the compatibility check. -
findSolutionMappings
public Iterable<SolutionMapping> findSolutionMappings(org.apache.jena.sparql.core.Var var, org.apache.jena.graph.Node value) Description copied from interface:SolutionMappingsIndexReturns an iterator over all solution mappings in this index that map the given variable to the given value. Implementations may choose to support this method only for specific variables, in which case anUnsupportedOperationExceptionwill be thrown if the method is called with an unsupported variable. The result of this method should essentially be the same as the result of callingSolutionMappingsIndex.getJoinPartners(SolutionMapping)with a solution mapping that is defined only for the given variable and that maps this variable to the given value. -
findSolutionMappings
public Iterable<SolutionMapping> findSolutionMappings(org.apache.jena.sparql.core.Var var1, org.apache.jena.graph.Node value1, org.apache.jena.sparql.core.Var var2, org.apache.jena.graph.Node value2) Description copied from interface:SolutionMappingsIndexReturns an iterator over all solution mappings in this index that map the first variable to the first value and the second variable to the second value. Hence, this method is a two-variables version of the methodSolutionMappingsIndex.findSolutionMappings(Var, Node). -
findSolutionMappings
public Iterable<SolutionMapping> findSolutionMappings(org.apache.jena.sparql.core.Var var1, org.apache.jena.graph.Node value1, org.apache.jena.sparql.core.Var var2, org.apache.jena.graph.Node value2, org.apache.jena.sparql.core.Var var3, org.apache.jena.graph.Node value3) Description copied from interface:SolutionMappingsIndexThis method is a three-variables version of the methodSolutionMappingsIndex.findSolutionMappings(Var, Node). -
getVarKey
-