org.apache.clerezza.rdf.core.impl.graphmatching
Class GraphMatcher

java.lang.Object
  extended by org.apache.clerezza.rdf.core.impl.graphmatching.GraphMatcher

public class GraphMatcher
extends Object

Author:
reto

Constructor Summary
GraphMatcher()
           
 
Method Summary
static Map<BNode,BNode> getValidMapping(TripleCollection og1, TripleCollection og2)
          get a mapping from g1 to g2 or null if the graphs are not isomorphic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphMatcher

public GraphMatcher()
Method Detail

getValidMapping

public static Map<BNode,BNode> getValidMapping(TripleCollection og1,
                                               TripleCollection og2)
get a mapping from g1 to g2 or null if the graphs are not isomorphic. The returned map maps each BNodes from g1 to one of g2. If the graphs are ground graphs the method return an empty map if the graph are equals and null otherwise.

NOTE: This method does not returned mapping from blank nodes to grounded nodes, a bnode in g1 is not a vraiable that may match any node, but must match a bnode in g2.

On the algorithm:
- In a first step it checked if every grounded triple in g1 matches one in g2
- [optional] blank node blind matching
- in a map mbng1 bnode of g1 is mapped to a set of of its properties and inverse properties, this is the predicate and the object or subject respectively, analoguosly in mbgn2 every bnode of g2
- based on the incoming and outgoing properties a hash is calculated for each bnode, in the first step when calculating the hash aconstant value is taken for the bnodes that might be subject or object in the (inverse properties) - hash-classes:

Parameters:
g1 -
g2 -
Returns:
a Set of NodePairs


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.