Class GraphComparisons

java.lang.Object
org.eclipse.rdf4j.model.util.GraphComparisons

class GraphComparisons extends Object
Functions for canonicalizing RDF models and computing isomorphism.
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • hashFunction

      private static final com.google.common.hash.HashFunction hashFunction
    • initialHashCode

      private static final com.google.common.hash.HashCode initialHashCode
    • outgoing

      private static final com.google.common.hash.HashCode outgoing
    • incoming

      private static final com.google.common.hash.HashCode incoming
    • distinguisher

      private static final com.google.common.hash.HashCode distinguisher
  • Constructor Details

    • GraphComparisons

      GraphComparisons()
  • Method Details

    • isomorphic

      public static boolean isomorphic(Model model1, Model model2)
      Compares two RDF models, and returns true if they consist of isomorphic graphs and the isomorphic graph identifiers map 1:1 to each other. RDF graphs are isomorphic graphs if statements from one graphs can be mapped 1:1 on to statements in the other graphs. In this mapping, blank nodes are not considered mapped when having an identical internal id, but are mapped from one graph to the other by looking at the statements in which the blank nodes occur. A Model can consist of more than one graph (denoted by context identifiers). Two models are considered isomorphic if for each of the graphs in one model, an isomorphic graph exists in the other model, and the context identifiers of these graphs are identical.
      See Also:
    • isomorphicSingleContext

      private static boolean isomorphicSingleContext(Model model1, Model model2)
    • mappingsIncompatible

      private static boolean mappingsIncompatible(Map<BNode,com.google.common.hash.HashCode> mapping1, Map<BNode,com.google.common.hash.HashCode> mapping2)
    • isoCanonicalize

      protected static Model isoCanonicalize(Model m)
    • getIsoCanonicalMapping

      protected static Map<BNode,com.google.common.hash.HashCode> getIsoCanonicalMapping(Model m)
    • getBlankNodes

      protected static Set<BNode> getBlankNodes(Model m)
    • distinguish

      private static Map<BNode,com.google.common.hash.HashCode> distinguish(Model m, GraphComparisons.Partitioning partitioning, Map<BNode,com.google.common.hash.HashCode> lowestFound, List<BNode> parentFixpoints, List<Map<BNode,com.google.common.hash.HashCode>> finePartitionMappings)
    • findCompatibleAutomorphism

      protected static Map<BNode,BNode> findCompatibleAutomorphism(List<BNode> fixpoints, List<Map<BNode,com.google.common.hash.HashCode>> partitionMappings)
    • partitions

      protected static List<Collection<BNode>> partitions(com.google.common.collect.Multimap<com.google.common.hash.HashCode,BNode> partitionMapping)
    • partitionMapping

      protected static com.google.common.collect.Multimap<com.google.common.hash.HashCode,BNode> partitionMapping(Map<BNode,com.google.common.hash.HashCode> blankNodeMapping)
    • labelModel

      private static Model labelModel(Model original, Map<BNode,com.google.common.hash.HashCode> hash)
    • hashBNodes

      protected static GraphComparisons.Partitioning hashBNodes(Model m)
    • hashBNodes

      private static GraphComparisons.Partitioning hashBNodes(Model m, GraphComparisons.Partitioning partitioning)
    • hashTuple

      protected static com.google.common.hash.HashCode hashTuple(com.google.common.hash.HashCode... hashCodes)
    • hashBag

      protected static com.google.common.hash.HashCode hashBag(com.google.common.hash.HashCode... hashCodes)
    • createCanonicalBNode

      private static BNode createCanonicalBNode(BNode node, Map<BNode,com.google.common.hash.HashCode> mapping)