org.jrdf.graph.index.operation.mem
Class ComparisonImpl

java.lang.Object
  extended by org.jrdf.graph.index.operation.mem.ComparisonImpl
All Implemented Interfaces:
Comparison

public final class ComparisonImpl
extends Object
implements Comparison

Default in memory Comparison.

Currently, only implements grounded isomorphism.

Version:
$Revision: 1045 $
Author:
Andrew Newman

Constructor Summary
ComparisonImpl()
           
 
Method Summary
 boolean areIsomorphic(Graph g1, Graph g2)
          Return true if both graphs are equivalent (isomorphic) to one another.
 boolean groundedGraphsAreEqual(Graph g1, Graph g2)
          Return true if both graphs are equivalent (isomophic) to one another.
 boolean isGrounded(Graph g)
          Returns true if the graph is grounded (does not contain blank nodes).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComparisonImpl

public ComparisonImpl()
Method Detail

isGrounded

public boolean isGrounded(Graph g)
                   throws GraphException
Description copied from interface: Comparison
Returns true if the graph is grounded (does not contain blank nodes).

Specified by:
isGrounded in interface Comparison
Parameters:
g - the graph to test.
Returns:
true if the graph is grounded (does not contain blank nodes).
Throws:
GraphException

areIsomorphic

public boolean areIsomorphic(Graph g1,
                             Graph g2)
                      throws GraphException
Description copied from interface: Comparison
Return true if both graphs are equivalent (isomorphic) to one another. That is, that the nodes in one graph map equivalently to nodes in the other. In a non-grounded graph (ones with blank nodes) nodes can map to other nodes with different values but are equivalent. This may inclue: <a>, <b>, <c> is equivalient to _x, <b>, <c>, where _x is a blank node or isomorphism could be limited to just blank nodes (not able to stand in place for URIs or Literals).

Specified by:
areIsomorphic in interface Comparison
Parameters:
g1 - The first graph to test.
g2 - The second graph to test.
Returns:
true if they are equivalent.
Throws:
GraphException

groundedGraphsAreEqual

public boolean groundedGraphsAreEqual(Graph g1,
                                      Graph g2)
                               throws GraphException
Description copied from interface: Comparison
Return true if both graphs are equivalent (isomophic) to one another. These graphs must contain only labelled nodes i.e. no blank nodes.

Specified by:
groundedGraphsAreEqual in interface Comparison
Parameters:
g1 - The first graph to test.
g2 - The second graph to test.
Returns:
true if they are equivalent.
Throws:
GraphException