Class 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 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
    • Constructor Detail

      • Partitioning

        public Partitioning​(java.util.Set<BNode> blankNodes)
      • Partitioning

        public Partitioning​(java.util.Map<BNode,​com.google.common.hash.HashCode> nodeMapping,
                            java.util.Map<Value,​com.google.common.hash.HashCode> staticValueMapping)
    • 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