com.hp.hpl.mesa.rdf.jena.common
Class ModelMatcher

java.lang.Object
  |
  +--com.hp.hpl.mesa.rdf.jena.common.ModelMatcher

public class ModelMatcher
extends java.lang.Object

An implemantation of graph isomorphism for Model 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.

The documentation at Model.equals was not written by a mathematician and is hence more readable.

Version:
Release='$Name: $' Revision='$Revision: 1.3 $' Date='$Date: 2001/09/21 08:38:27 $'
Author:
jjc
See Also:
Model.equals(java.lang.Object)

Method Summary
static boolean equals(Model m1, Model m2)
          Are the two models isomorphic.
static Resource[][] match(Model m1, Model m2)
          Return an isomorphism between the two models.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equals

public static boolean equals(Model m1,
                             Model m2)
                      throws RDFException
Are the two models isomorphic. The isomorphism is defined as a bijection between the anonymous variables such that the statements are identical.
See Also:
For a less mathematical explanation.

match

public static Resource[][] match(Model m1,
                                 Model m2)
                          throws RDFException
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 resources. match(m1,m2)[i][0] is from m1, and match(m1,m2)[i][1] is the corresponding node in m2.


Copyright 2001 Hewlett-Packard. All Rights Reserved.