Package org.apache.jena.graph.impl
Class GraphMatcher
- java.lang.Object
-
- org.apache.jena.graph.impl.GraphMatcher
-
public class GraphMatcher extends java.lang.Object
An implementation of graph isomorphism for Graph equality. The underlying algorithm is exponential but will only enter a non-deterministic polynomial part when there are a lot of difficult to distinguish anonymous nodes connected to each other by statements with the same property(s). Non-pathological examples, where most nodes have some properties that help distinguish them from other nodes, will experience nearly linear performance.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
equals(Graph m1, Graph m2)
Are the two models isomorphic? The isomorphism is defined as a bijection between the anonymous variables such that the statements are identical.static int
hashCode(Graph g)
static Node[][]
match(Graph m1, Graph m2)
Return an isomorphism between the two models.
-
-
-
Method Detail
-
equals
public static boolean equals(Graph m1, Graph m2)
Are the two models isomorphic? The isomorphism is defined as a bijection between the anonymous variables such that the statements are identical. This is described in http://www.w3.org/TR/rdf-concepts#section-Graph-syntax
-
hashCode
public static int hashCode(Graph g)
-
match
public static Node[][] match(Graph m1, Graph m2)
Return an isomorphism between the two models. This function is nondeterministic in that it may return a different bijection on each call, in cases where there are multiple isomorphisms between the models.- Returns:
null
on failure or an array of related pairs (arrays of length 2) of anonymous nodes.match(m1,m2)[i][0]
is fromm1
, andmatch(m1,m2)[i][1]
is the corresponding node inm2
.
-
-