uk.ac.ic.doc.automed.matching
Class RelationshipExtractor

java.lang.Object
  extended by uk.ac.ic.doc.automed.matching.RelationshipExtractor
Direct Known Subclasses:
SQLRelationshipExtractor

public abstract class RelationshipExtractor
extends java.lang.Object

The class that represents the RelationshipExtractor component in the schema matching architecture. Its role is to produce the semantic relationships between the schema elements based on structural constraints. The results are based on the DegreeCombinator's relationships.

See Also:
SchemaElementPair, SchemaElementPairRelationship, SemanticRelationship, SchemaObject

Constructor Summary
RelationshipExtractor()
           
 
Method Summary
protected static SemanticRelationship combineRelationships(SemanticRelationship rel1, SemanticRelationship rel2)
          Returns the relationship that can be deduced from the specified relationships.
protected static boolean containsRelationship(SemanticRelationship[] rels, SemanticRelationship rel)
          Returns true if the specified relationship appears in the array of relationships
protected  SchemaElementPairRelationship[] findAtomicRelationships(SchemaObject[] sos1, SchemaObject[] sos2)
          Returns the semantic relationships between the atomic schema element pairs defined by the schema object arrays.
protected  SchemaElementPairRelationship[] findAtomicRelationships(SchemaObject object, SchemaObject[] objects)
          Returns a SchemaElementPairRelationship array for the specified schema objects.
protected  java.util.ArrayList getAllCombinations(java.lang.Object[] pairs1, java.lang.Object[] pairs2)
           
protected  SchemaElementPairRelationship[] getAtomicPairRelationships()
          Returns the relationships of pairs of atomic schema elements.
protected  SemanticRelationship getAtomicRelationship(SchemaElementPair pair)
          Returns the relationship of the pair of atomic schema elements
protected  java.util.ArrayList getAtomicRelationshipCombinations(SchemaObject[] objects1, SchemaObject[] objects2)
          Returns a list of SchemaElementPairRelationship arrays for the specified schema objects.
protected  SchemaElementPairRelationship[] getNonAtomicPairRelationships()
          Returns the relationships of pairs of non-atomic schema elements.
protected  SemanticRelationship getNonAtomicRelationship(SchemaElementPair pair)
          Returns the relationship of the pair of non-atomic schema elements
protected static SemanticRelationship getRelationship(SchemaElementPairRelationship[] pairs)
          Returns the relationship for the pair of elements.
abstract  SchemaElementPairRelationship[] getRelationships()
           
protected static SemanticRelationship[] getRelationships(java.util.ArrayList relationshipPairs)
          Returns the relationships for each pair of elements in the specified list.
protected static SemanticRelationship getWeakestRelationship(SemanticRelationship[] rels)
          Returns the weakest relationship of the specified relationships.
protected  SchemaElementPairRelationship[] removeDuplicates(SchemaElementPairRelationship[] hasDups)
           
protected  SchemaElementPairRelationship reverseRelationshipPair(SchemaElementPairRelationship rel)
          Returns the reverse relationship for the specified pair.
protected  SchemaElementPairRelationship[] reverseRelationshipPairs(SchemaElementPairRelationship[] rels)
           
 void setAtomicPairRelationships(SchemaElementPairRelationship[] atomic)
          Sets the relationships of pairs of atomic schema elements.
 void setNonAtomicPairRelationships(SchemaElementPairRelationship[] nonatomic)
          Sets the relationships of pairs of non-atomic schema elements.
abstract  void setSchemas(Schema[] schemas)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationshipExtractor

public RelationshipExtractor()
Method Detail

getRelationships

public abstract SchemaElementPairRelationship[] getRelationships()
                                                          throws RelationshipExtractorException
Throws:
RelationshipExtractorException

setSchemas

public abstract void setSchemas(Schema[] schemas)

getNonAtomicPairRelationships

protected SchemaElementPairRelationship[] getNonAtomicPairRelationships()
Returns the relationships of pairs of non-atomic schema elements. These are defined by the DegreeCombinator.

Returns:
the relationships of pairs of non-atomic schema elements

getAtomicPairRelationships

protected SchemaElementPairRelationship[] getAtomicPairRelationships()
Returns the relationships of pairs of atomic schema elements. These are defined by the DegreeCombinator.

Returns:
the relationships of pairs of atomic schema elements

setNonAtomicPairRelationships

public void setNonAtomicPairRelationships(SchemaElementPairRelationship[] nonatomic)
Sets the relationships of pairs of non-atomic schema elements.

Parameters:
nonatomic - the relationships of pairs of non-atomic schema elements

setAtomicPairRelationships

public void setAtomicPairRelationships(SchemaElementPairRelationship[] atomic)
Sets the relationships of pairs of atomic schema elements. These are defined by the DegreeCombinator.

Parameters:
atomic - the relationships of pairs of atomic schema elements

findAtomicRelationships

protected SchemaElementPairRelationship[] findAtomicRelationships(SchemaObject[] sos1,
                                                                  SchemaObject[] sos2)
Returns the semantic relationships between the atomic schema element pairs defined by the schema object arrays. The schema object arrays define atomic schema elements whose pairs are created and their relationships are returned.

Parameters:
sos1 - the first array of schema objects
sos2 - the second array of schema objects
Returns:
the semantic relationships between the atomic schema element pairs defined by the schema object arrays.

getAtomicRelationship

protected SemanticRelationship getAtomicRelationship(SchemaElementPair pair)
Returns the relationship of the pair of atomic schema elements

Parameters:
pair - the pair of elements
Returns:
the relationship of the pair of atomic schema elements

getNonAtomicRelationship

protected SemanticRelationship getNonAtomicRelationship(SchemaElementPair pair)
Returns the relationship of the pair of non-atomic schema elements

Parameters:
pair - the pair of elements
Returns:
the relationship of the pair of non-atomic schema elements

getWeakestRelationship

protected static SemanticRelationship getWeakestRelationship(SemanticRelationship[] rels)
Returns the weakest relationship of the specified relationships.

Parameters:
rels - the array of the specified relationships
Returns:
the weakest relationship of the specified relationships.

containsRelationship

protected static boolean containsRelationship(SemanticRelationship[] rels,
                                              SemanticRelationship rel)
Returns true if the specified relationship appears in the array of relationships

Parameters:
rels - the array of relationships
rel - the relationship to look for
Returns:
true if the specified relationship appears in the array of relationships, false otherwise

getRelationships

protected static SemanticRelationship[] getRelationships(java.util.ArrayList relationshipPairs)
Returns the relationships for each pair of elements in the specified list. Each member of the list is an array of SchemaElementPairRelationship objects of the same pair of elements. For this pair of elements a semantic relationship is computed.

Parameters:
relationshipPairs - the list of SchemaElementPairRelationship arrays
Returns:
the relationships for each pair of elements in the specified list

getRelationship

protected static SemanticRelationship getRelationship(SchemaElementPairRelationship[] pairs)
Returns the relationship for the pair of elements. Each member of the specified array is a SchemaElementPairRelationship object for a single pair of elements. For this pair of elements a semantic relationship is computed.

Parameters:
pairs - the array of SchemaElementPairRelationship objects
Returns:
the relationship for the pair of elements.

combineRelationships

protected static SemanticRelationship combineRelationships(SemanticRelationship rel1,
                                                           SemanticRelationship rel2)
Returns the relationship that can be deduced from the specified relationships.

Parameters:
rel1 - the first relationship
rel2 - the second relationship

getAtomicRelationshipCombinations

protected java.util.ArrayList getAtomicRelationshipCombinations(SchemaObject[] objects1,
                                                                SchemaObject[] objects2)
                                                         throws RelationshipExtractorException
Returns a list of SchemaElementPairRelationship arrays for the specified schema objects. The schema objects are wrapped into atomic schema elements and schema element pairs, whose relationships are returned. Each member of the list defines the relationships of a single pair of elements. The direction of the relationships are from the objects of the first array to the objects of the second array.

Parameters:
objects1 - the first array of schema objects
objects2 - the second array of schema objects
Returns:
a list of SchemaElementPairRelationship arrays for the specified schema objects
Throws:
RelationshipExtractorException - if no relationships can be found for specific pairs

getAllCombinations

protected java.util.ArrayList getAllCombinations(java.lang.Object[] pairs1,
                                                 java.lang.Object[] pairs2)

removeDuplicates

protected SchemaElementPairRelationship[] removeDuplicates(SchemaElementPairRelationship[] hasDups)

findAtomicRelationships

protected SchemaElementPairRelationship[] findAtomicRelationships(SchemaObject object,
                                                                  SchemaObject[] objects)
Returns a SchemaElementPairRelationship array for the specified schema objects. The schema objects are wrapped into atomic schema elements and for each pair its relationship is returned

Returns:
a SchemaElementPairRelationship array for the specified schema objects.

reverseRelationshipPairs

protected SchemaElementPairRelationship[] reverseRelationshipPairs(SchemaElementPairRelationship[] rels)

reverseRelationshipPair

protected SchemaElementPairRelationship reverseRelationshipPair(SchemaElementPairRelationship rel)
Returns the reverse relationship for the specified pair. The problem is only with the subsumption relationship for which the direction is important whether a subset or a superset is identified.

Returns:
the reverse relationship for the specified pair