Package org.eclipse.rdf4j.model.util
Class GraphComparisons
java.lang.Object
org.eclipse.rdf4j.model.util.GraphComparisons
Functions for canonicalizing RDF models and computing isomorphism.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
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
FieldsModifier and TypeFieldDescriptionprivate static final com.google.common.hash.HashCode
private static final com.google.common.hash.HashFunction
private static final com.google.common.hash.HashCode
private static final com.google.common.hash.HashCode
private static final org.slf4j.Logger
private static final com.google.common.hash.HashCode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static BNode
createCanonicalBNode
(BNode node, Map<BNode, com.google.common.hash.HashCode> mapping) 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
(List<BNode> fixpoints, List<Map<BNode, com.google.common.hash.HashCode>> partitionMappings) protected static com.google.common.hash.HashCode
hashBag
(com.google.common.hash.HashCode... hashCodes) protected static GraphComparisons.Partitioning
hashBNodes
(Model m) private static GraphComparisons.Partitioning
hashBNodes
(Model m, GraphComparisons.Partitioning partitioning) protected static com.google.common.hash.HashCode
hashTuple
(com.google.common.hash.HashCode... hashCodes) protected static Model
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.private static boolean
isomorphicSingleContext
(Model model1, Model model2) private static Model
labelModel
(Model original, Map<BNode, com.google.common.hash.HashCode> hash) private static boolean
mappingsIncompatible
(Map<BNode, com.google.common.hash.HashCode> mapping1, Map<BNode, com.google.common.hash.HashCode> mapping2) protected static com.google.common.collect.Multimap
<com.google.common.hash.HashCode, BNode> partitionMapping
(Map<BNode, com.google.common.hash.HashCode> blankNodeMapping) protected static List
<Collection<BNode>> partitions
(com.google.common.collect.Multimap<com.google.common.hash.HashCode, BNode> partitionMapping)
-
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
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
-
mappingsIncompatible
-
isoCanonicalize
-
getIsoCanonicalMapping
-
getBlankNodes
-
distinguish
-
findCompatibleAutomorphism
-
partitions
protected static List<Collection<BNode>> partitions(com.google.common.collect.Multimap<com.google.common.hash.HashCode, BNode> partitionMapping) -
partitionMapping
-
labelModel
-
hashBNodes
-
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
-