Class SolutionMappingsHashTableBasedOnTwoVars
java.lang.Object
se.liu.ida.hefquin.base.datastructures.impl.SolutionMappingsIndexBase
se.liu.ida.hefquin.base.datastructures.impl.SolutionMappingsHashTableBasedOnTwoVars
- All Implemented Interfaces:
 Iterable<SolutionMapping>,Collection<SolutionMapping>,SolutionMappingsIndex,StatsProvider
This is a hash table based implementation of 
 that can be used for indexes that are built on two query variables 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 
invalid reference
SolutionMappingsIndex
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 variables
 relevant for index look-ups are the variable on which the index is built.
 In other words, the assumption is that the only variables that the solution
 mappings added to the index have in common with the solution mappings given
 to the method getJoinPartners(SolutionMapping) are the two variables
 on which the index is built. For cases in which this assumption does not
 hold, a SolutionMappingsIndexWithPostMatching can be used to wrap
 a SolutionMappingsHashTableBasedOnTwoVars.- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected class - 
Field Summary
Fields - 
Constructor Summary
ConstructorsConstructorDescriptionSolutionMappingsHashTableBasedOnTwoVars(org.apache.jena.sparql.core.Var joinVar1, org.apache.jena.sparql.core.Var joinVar2)  - 
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 variables that the given solution mapping has in common with the solution mappings in the index are the two variables on which the index is built.booleanisEmpty()protected List<SolutionMapping> returnLookupResultOrEmptyList(org.apache.jena.graph.Node keyValue1, org.apache.jena.graph.Node keyValue2) 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
protected final Map<org.apache.jena.graph.Node,Map<org.apache.jena.graph.Node, mapList<SolutionMapping>>>  - 
joinVar1
protected final org.apache.jena.sparql.core.Var joinVar1 - 
joinVar2
protected final org.apache.jena.sparql.core.Var joinVar2 
 - 
 - 
Constructor Details
- 
SolutionMappingsHashTableBasedOnTwoVars
public SolutionMappingsHashTableBasedOnTwoVars(org.apache.jena.sparql.core.Var joinVar1, org.apache.jena.sparql.core.Var joinVar2)  
 - 
 - 
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 variables that the given solution mapping has in common with the solution mappings in the index are the two variables 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). - 
returnLookupResultOrEmptyList
protected List<SolutionMapping> returnLookupResultOrEmptyList(org.apache.jena.graph.Node keyValue1, org.apache.jena.graph.Node keyValue2)  
 -