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

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

public abstract class Integrator
extends java.lang.Object

The class that represents the Integrator component in the schema matching architecture. Its role is the integration of the schemas based on the discovered relationships.


Field Summary
protected  java.util.ArrayList disjoints
           
protected  java.util.ArrayList equivalents
           
protected  java.util.ArrayList overlaps
           
protected  java.util.ArrayList subsumptions
           
 
Constructor Summary
Integrator()
           
 
Method Summary
protected  java.util.ArrayList areRelated(SchemaObject[] objects1, SchemaObject[] objects2, SemanticRelationship rel, boolean isAtomic)
          Returns a list of SchemaElementPair arrays with all the combinations of related schema elements.
protected static boolean contains(SchemaElementPair[] pairs, SchemaElement[] elements, int index)
          Returns true if the specified elements are contained in the specified pairs.
protected static boolean contains(SchemaElementPair[] container, SchemaElementPair[] containee)
          Returns true if the pairs are contained in the specified array.
protected  boolean existsIn(SchemaElement element, SchemaElementPair[] pairs, int index)
          Returns true if the specified element appears in one of the pairs of the array.
protected  boolean existsIn(java.lang.String name, SchemaObject[] objects)
          Returns true if a schema object with the specified name exists in the array.
static Schema extendToMatch(Schema s1, Schema s2)
          Returns the Schema produced by extending the two schemas with schema objects which are missing from each other.
protected  java.util.ArrayList findRelated(SchemaObject[] objects1, SchemaObject[] objects2, SemanticRelationship rel, boolean isAtomic)
          Returns a list of SchemaElementPair arrays with all the combinations of related schema elements.
protected  java.util.ArrayList getAllCombinations(java.lang.Object[] pairs1, java.lang.Object[] pairs2)
           
protected  java.lang.Object[] getCombinations(java.lang.Object[] array)
           
protected  java.util.ArrayList[] getCombinationsOverMultipleArrays(java.util.ArrayList[] array)
           
protected static SemanticRelationship getCommonRelationship(SchemaElementPairRelationship[] pairs)
           
protected static SchemaElement[] getElements(SchemaObject[] objects, boolean isAtomic)
          Returns a SchemaElement array, whose member wraps the corresponding member in the SchemaObject array.
protected  SemanticRelationship getRelationship(SchemaElementPair pair)
          Returns the relationship in the pair.
abstract  Schema[] getSchemas()
           
protected  SchemaElementPair[] isRelated(SchemaObject object, SchemaObject[] objects, SemanticRelationship rel, boolean isAtomic)
          Returns a SchemaElementPair array with pairs defined by the specified schema object and the schema object array.
abstract  void mergeSchemas()
           
protected  SchemaElementPair[] removeDuplicates(SchemaElementPair[] hasDups)
          Returns a duplicate-free SchemaElementPair array.
abstract  void resolveNamingConflicts()
           
abstract  void resolveStructuralConflicts()
           
protected  SchemaElementPair[] selectPairs(java.util.ArrayList allPairs, java.util.ArrayList constraintPairs)
          Returns the maximum SchemaElementPair array which contains the constraint pairs.
protected  SchemaElementPair[] selectPairs(java.util.ArrayList allPairs, SchemaElement[] constraintElements, int index)
          Returns an array of schema element pairs which contain the specified constraint elements.
 void setRelationships(SchemaElementPairRelationship[] rels)
          Sets the discovered relationships between the 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
 

Field Detail

equivalents

protected java.util.ArrayList equivalents

subsumptions

protected java.util.ArrayList subsumptions

overlaps

protected java.util.ArrayList overlaps

disjoints

protected java.util.ArrayList disjoints
Constructor Detail

Integrator

public Integrator()
Method Detail

resolveNamingConflicts

public abstract void resolveNamingConflicts()
                                     throws IntegratorException,
                                            IntegrityException
Throws:
IntegratorException
IntegrityException

mergeSchemas

public abstract void mergeSchemas()
                           throws IntegratorException
Throws:
IntegratorException

resolveStructuralConflicts

public abstract void resolveStructuralConflicts()
                                         throws IntegratorException,
                                                IntegrityException
Throws:
IntegratorException
IntegrityException

getSchemas

public abstract Schema[] getSchemas()

setSchemas

public abstract void setSchemas(Schema[] schemas)
                         throws IntegratorException
Throws:
IntegratorException

setRelationships

public void setRelationships(SchemaElementPairRelationship[] rels)
Sets the discovered relationships between the schema elements.

Parameters:
rels - the array of the relationship of the pairs

extendToMatch

public static Schema extendToMatch(Schema s1,
                                   Schema s2)
                            throws IntegrityException,
                                   NotFoundException,
                                   TypeMismatchException
Returns the Schema produced by extending the two schemas with schema objects which are missing from each other. The return schema contains the constructs of both schemas.

Parameters:
s1 - the first schema
s2 - the second schema
Returns:
the Schema produced by extending the two schemas with schema objects that are missing from each other
Throws:
IntegrityException
NotFoundException
TypeMismatchException

contains

protected static boolean contains(SchemaElementPair[] pairs,
                                  SchemaElement[] elements,
                                  int index)
                           throws java.lang.IndexOutOfBoundsException
Returns true if the specified elements are contained in the specified pairs. The index determines which elements in the pairs are going to be examined, i.e. the first or the second elements in the pairs.

Parameters:
pairs - the contained array of schema element pairs
elements - the array of the elements to look for
index - the index where the elements are in the pairs
Returns:
true if the specified elements are contained in the specified pairs, false otherwise.
Throws:
java.lang.IndexOutOfBoundsException - if the index is >1.

contains

protected static boolean contains(SchemaElementPair[] container,
                                  SchemaElementPair[] containee)
Returns true if the pairs are contained in the specified array. All the pairs in containee should be contained in the container, for a true answer.

Parameters:
container - the container array of schema element pairs
containee - the containee array of schema element pairs
Returns:
true if the pairs are contained in the specified array, false otherwise.

selectPairs

protected SchemaElementPair[] selectPairs(java.util.ArrayList allPairs,
                                          SchemaElement[] constraintElements,
                                          int index)
                                   throws java.lang.IndexOutOfBoundsException
Returns an array of schema element pairs which contain the specified constraint elements. Each member of the list is a SchemaElementPair array. This array is checked whether it contains the specified elements. The index determines which part of the pairs are going to be examined, i.e. the first or the second elements in the pairs

Parameters:
allPairs - the list of SchemaElementPair arrays
constraintElements - the elements which define which array is selected
index - the index where the contraint elements should appear in the pairs
Returns:
an array of schema element pairs which contain the specified constraint elements.
Throws:
IndexOutOfBoundException - if index >1.
java.lang.IndexOutOfBoundsException

selectPairs

protected SchemaElementPair[] selectPairs(java.util.ArrayList allPairs,
                                          java.util.ArrayList constraintPairs)
                                   throws IntegratorException
Returns the maximum SchemaElementPair array which contains the constraint pairs. The allPairs and constraintPairs are two lists of SchemaElementPair arrays. This method returns the maximum array in allPairs which contains a constraint array of pairs.

Parameters:
allPairs - the list of all the SchemaElementPair arrays
constraintPairs - the lists of all the constraint SchemaElementPair arrays
Returns:
the maximum SchemaElementPair array which contains the constraint pairs.
Throws:
IntegratorException - if no array of pairs satisfies the constraint to contain one of the constraint arrays of constraintPairs

existsIn

protected boolean existsIn(SchemaElement element,
                           SchemaElementPair[] pairs,
                           int index)
                    throws java.lang.IndexOutOfBoundsException
Returns true if the specified element appears in one of the pairs of the array. index determines which part of the pairs are going to be examined, i.e. the first or the second elements in the pairs.

Parameters:
element - the element to look for
pairs - the array of schema element pairs
index - the index of the element in the pair
Returns:
true if the specified element appears in one of the pairs of the array, false otherwise
Throws:
IndexOutOfBounds - if index >1.
java.lang.IndexOutOfBoundsException

existsIn

protected boolean existsIn(java.lang.String name,
                           SchemaObject[] objects)
Returns true if a schema object with the specified name exists in the array.

Parameters:
name - the name to look for
objects - the array of schema objects
Returns:
true if a schema object with the specified name exists in the array, false otherwise.

getCommonRelationship

protected static SemanticRelationship getCommonRelationship(SchemaElementPairRelationship[] pairs)

getRelationship

protected SemanticRelationship getRelationship(SchemaElementPair pair)
Returns the relationship in the pair.

Parameters:
pair - the pair of schema elements
Returns:
the relationship in the pair.

areRelated

protected java.util.ArrayList areRelated(SchemaObject[] objects1,
                                         SchemaObject[] objects2,
                                         SemanticRelationship rel,
                                         boolean isAtomic)
Returns a list of SchemaElementPair arrays with all the combinations of related schema elements. The pairs are constructed from the schema object arrays, and each object must have a related counterpart. The relationship that is looked for is rel. The length of the arrays in the list increases as you go from the first to the last member.

Parameters:
objects1 - the first array of schema objects
objects2 - the second array of schema objects
rel - the semantic relationship in each returned pair
isAtomic - whether the schema elements are going to be atomic or not
Returns:
a list of SchemaElementPair arrays with all the combinations of related schema elements

findRelated

protected java.util.ArrayList findRelated(SchemaObject[] objects1,
                                          SchemaObject[] objects2,
                                          SemanticRelationship rel,
                                          boolean isAtomic)
Returns a list of SchemaElementPair arrays with all the combinations of related schema elements. The pairs are constructed from the schema object arrays, and each object may not have a related counterpart. The relationship that is looked for is rel. The length of the arrays in the list decreases as you go from the first to the last member.

Parameters:
objects1 - the first array of schema objects
objects2 - the second array of schema objects
rel - the semantic relationship in each returned pair
isAtomic - whether the schema elements are going to be atomic or not
Returns:
a list of SchemaElementPair arrays with all the combinations of related schema elements

getElements

protected static SchemaElement[] getElements(SchemaObject[] objects,
                                             boolean isAtomic)
Returns a SchemaElement array, whose member wraps the corresponding member in the SchemaObject array.

Parameters:
objects - the schema object array
isAtomic - whether the returned elements are atomic or not
Returns:
a SchemaElement array, whose member wraps the corresponding member in the SchemaObject array

getAllCombinations

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

removeDuplicates

protected SchemaElementPair[] removeDuplicates(SchemaElementPair[] hasDups)
Returns a duplicate-free SchemaElementPair array. Duplicates are removed from the specified array and the remaining pairs are returned.

Parameters:
hasDups - a SchemaElementPair array, which may contain duplicate members
Returns:
a duplicate-free SchemaElementPair array

getCombinationsOverMultipleArrays

protected java.util.ArrayList[] getCombinationsOverMultipleArrays(java.util.ArrayList[] array)

getCombinations

protected java.lang.Object[] getCombinations(java.lang.Object[] array)

isRelated

protected SchemaElementPair[] isRelated(SchemaObject object,
                                        SchemaObject[] objects,
                                        SemanticRelationship rel,
                                        boolean isAtomic)
Returns a SchemaElementPair array with pairs defined by the specified schema object and the schema object array. rel is the relationship that is being identified between the schema objects

Parameters:
object - the schema object to be compared
objects - the SchemaObject array whose member are compared to object
rel - the relationship to look for between the objects
isAtomic - whether the shcme alements in the returned pairs are atomic or not