Package org.eclipse.rdf4j.model.util
Class GraphComparisons.Partitioning
- java.lang.Object
-
- org.eclipse.rdf4j.model.util.GraphComparisons.Partitioning
-
- Enclosing class:
- GraphComparisons
static class GraphComparisons.Partitioning extends java.lang.Object
Encapsulates the current partitioning state of the algorithm, keeping track of previous and current node:hashcode mappings as well as static value mappings.
-
-
Field Summary
Fields Modifier and Type Field Description private com.google.common.collect.Multimap<com.google.common.hash.HashCode,BNode>
currentHashCodeMapping
private java.util.Map<BNode,com.google.common.hash.HashCode>
currentNodeMapping
private int
nodeCount
private java.util.Map<BNode,com.google.common.hash.HashCode>
previousNodeMapping
private java.util.Map<Value,com.google.common.hash.HashCode>
staticValueMapping
-
Constructor Summary
Constructors Constructor Description Partitioning(java.util.Map<BNode,com.google.common.hash.HashCode> nodeMapping, java.util.Map<Value,com.google.common.hash.HashCode> staticValueMapping)
Partitioning(java.util.Set<BNode> blankNodes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
currentUnchanged()
Verify if the current node mapping is unchanged compared to the previous node mapping.com.google.common.hash.HashCode
getCurrentHashCode(Value value)
private com.google.common.collect.Multimap<com.google.common.hash.HashCode,BNode>
getCurrentHashCodeMapping()
java.util.Map<BNode,com.google.common.hash.HashCode>
getCurrentNodeMapping()
java.util.Collection<BNode>
getLowestNonTrivialPartition()
java.math.BigInteger
getMappingSize()
Return a mapping size to determine a canonical lowest mapping.java.util.Set<BNode>
getNodes()
com.google.common.hash.HashCode
getPreviousHashCode(Value value)
private com.google.common.hash.HashCode
getStaticLiteralHashCode(Literal value)
java.util.Map<Value,com.google.common.hash.HashCode>
getStaticValueMapping()
boolean
isFine()
A partitioning is fine if every hashcode maps to exactly one blank node.boolean
isFullyDistinguished()
void
nextIteration()
void
setCurrentHashCode(BNode bnode, com.google.common.hash.HashCode hashCode)
-
-
-
Field Detail
-
staticValueMapping
private final java.util.Map<Value,com.google.common.hash.HashCode> staticValueMapping
-
previousNodeMapping
private java.util.Map<BNode,com.google.common.hash.HashCode> previousNodeMapping
-
currentNodeMapping
private java.util.Map<BNode,com.google.common.hash.HashCode> currentNodeMapping
-
currentHashCodeMapping
private com.google.common.collect.Multimap<com.google.common.hash.HashCode,BNode> currentHashCodeMapping
-
nodeCount
private final int nodeCount
-
-
Method Detail
-
getStaticValueMapping
public java.util.Map<Value,com.google.common.hash.HashCode> getStaticValueMapping()
-
getCurrentHashCode
public com.google.common.hash.HashCode getCurrentHashCode(Value value)
-
getNodes
public java.util.Set<BNode> getNodes()
-
getPreviousHashCode
public com.google.common.hash.HashCode getPreviousHashCode(Value value)
-
setCurrentHashCode
public void setCurrentHashCode(BNode bnode, com.google.common.hash.HashCode hashCode)
-
getCurrentNodeMapping
public java.util.Map<BNode,com.google.common.hash.HashCode> getCurrentNodeMapping()
-
nextIteration
public void nextIteration()
-
isFine
public boolean isFine()
A partitioning is fine if every hashcode maps to exactly one blank node.- Returns:
- true if the partitioning is fine, false otherwise.
-
isFullyDistinguished
public boolean isFullyDistinguished()
-
getLowestNonTrivialPartition
public java.util.Collection<BNode> getLowestNonTrivialPartition()
-
getMappingSize
public java.math.BigInteger getMappingSize()
Return a mapping size to determine a canonical lowest mapping.
-
getStaticLiteralHashCode
private com.google.common.hash.HashCode getStaticLiteralHashCode(Literal value)
-
getCurrentHashCodeMapping
private com.google.common.collect.Multimap<com.google.common.hash.HashCode,BNode> getCurrentHashCodeMapping()
-
currentUnchanged
private boolean currentUnchanged()
Verify if the current node mapping is unchanged compared to the previous node mapping.it is unchanged if: all bnodes that have the same hashcode in current also shared the same hashcode in previous, and all bnodes that have different ones in current also have different ones in previous.
- Returns:
- true if unchanged, false otherwise
-
-