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

java.lang.Object
  extended by uk.ac.ic.doc.automed.matching.RelationshipExtractor
      extended by uk.ac.ic.doc.automed.matching.SQLRelationshipExtractor

public class SQLRelationshipExtractor
extends RelationshipExtractor

The class for the extraction of relationships between SQL schema elements. Mainly, the relationship between tables can be defined based on the relationship of their primary key columns.


Field Summary
protected  java.util.ArrayList[] columns
           
protected  java.util.ArrayList[] pks
           
protected  java.util.ArrayList[] tables
           
 
Constructor Summary
SQLRelationshipExtractor()
           
 
Method Summary
protected  SchemaObject[] getColumns(SchemaObject table, java.util.ArrayList columns)
          Returns an array of schema objects that are the columns of the specified table.
protected  SchemaObject getPK(SchemaObject table, java.util.ArrayList pks)
          Returns a schema object that is the primary key of the specified table.
protected  SchemaObject[] getPKColumns(SchemaObject table, java.util.ArrayList pks)
          Returns an array of schema objects that are the columns constituting the primary key of the specified table.
 SchemaElementPairRelationship[] getRelationships()
          Returns the semantic relationships for the schema objects in the schemas
 void setSchemas(Schema[] schemas)
          Sets the schemas that are being matched.
 
Methods inherited from class uk.ac.ic.doc.automed.matching.RelationshipExtractor
combineRelationships, containsRelationship, findAtomicRelationships, findAtomicRelationships, getAllCombinations, getAtomicPairRelationships, getAtomicRelationship, getAtomicRelationshipCombinations, getNonAtomicPairRelationships, getNonAtomicRelationship, getRelationship, getRelationships, getWeakestRelationship, removeDuplicates, reverseRelationshipPair, reverseRelationshipPairs, setAtomicPairRelationships, setNonAtomicPairRelationships
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tables

protected java.util.ArrayList[] tables

pks

protected java.util.ArrayList[] pks

columns

protected java.util.ArrayList[] columns
Constructor Detail

SQLRelationshipExtractor

public SQLRelationshipExtractor()
Method Detail

setSchemas

public void setSchemas(Schema[] schemas)
Sets the schemas that are being matched. Currently only pairwise comparison of schemas is possible, therefore the specified array should have length 2.

Specified by:
setSchemas in class RelationshipExtractor
Parameters:
schemas - the array of the schemas to be matched.

getRelationships

public SchemaElementPairRelationship[] getRelationships()
                                                 throws RelationshipExtractorException
Returns the semantic relationships for the schema objects in the schemas

Specified by:
getRelationships in class RelationshipExtractor
Returns:
the semantic relationships for the schema objects in the schemas
Throws:
RelationshipExtractorException - if specific contructs cannot be found

getPKColumns

protected SchemaObject[] getPKColumns(SchemaObject table,
                                      java.util.ArrayList pks)
                               throws RelationshipExtractorException
Returns an array of schema objects that are the columns constituting the primary key of the specified table.

Parameters:
table - the table whose primary key columns are returned
pks - the SchemaObject list of all the primary key columns
Returns:
an array of schema objects that are the columns constituting the primary key of the specified table.
Throws:
RelationshipExtractorException - if the primary key of the table cannot be found

getPK

protected SchemaObject getPK(SchemaObject table,
                             java.util.ArrayList pks)
Returns a schema object that is the primary key of the specified table.

Parameters:
table - the table whose primary key is returned
pks - the SchemaObject list of all the primary key columns
Returns:
a schema object that is the primary key of the specified table.

getColumns

protected SchemaObject[] getColumns(SchemaObject table,
                                    java.util.ArrayList columns)
Returns an array of schema objects that are the columns of the specified table.

Parameters:
table - the table whose columns are returned
columns - the SchemaObject list of all the columns
Returns:
an array of schema objects that are the columns of the specified table.