uk.ac.ic.doc.automed.reps
Class Transformation

java.lang.Object
  extended by uk.ac.ic.doc.automed.reps.Transformation
All Implemented Interfaces:
java.lang.Comparable, PersistentObject

public class Transformation
extends java.lang.Object
implements java.lang.Comparable, PersistentObject

The Transformation class describes a single premitive transformation that connects a pair of schemas. Each Transformation may be one of add, delete, rename, extend, contract or ident.

Author:
Michael Boyd (mboyd@doc.ic.ac.uk), Peter McBrien (pjm@doc.ic.ac.uk), Nerissa Tong (nnyt98@doc.ic.ac.uk)

Field Summary
static int ACTION_ADD
          Transformation action "add"
static java.lang.String ACTION_ADD_STR
           
static int ACTION_CONTRACT
          Transformation action "contract"
static java.lang.String ACTION_CONTRACT_STR
           
static int ACTION_DELETE
          Transformation action "delete"
static java.lang.String ACTION_DELETE_STR
           
static int ACTION_EXTEND
          Transformation action "extend"
static java.lang.String ACTION_EXTEND_STR
           
static int ACTION_IDENT
          Transformation action "ident"
static java.lang.String ACTION_IDENT_STR
           
static int ACTION_MAXIMUM
           
static int ACTION_MINIMUM
           
static int ACTION_RENAME
          Transformation action "rename"
static java.lang.String ACTION_RENAME_STR
           
static java.lang.String[][] actionWeights
           
static java.lang.String IQL_TRUE_CONSTRAINT
          Constraint that evaluates to true
static int NULL_ID
           
static java.lang.String PROPERTY_IQL_FUNCTION
          Name of property used to label IDENT transformations with the IQL function that is used to merge values from either side of the IDENT (i.e.
static java.lang.String PROPERTY_IQL_FUNCTION_DEFAULT_VALUE
          Default value for PROPERTY_IQL_FUNCTION
static java.lang.String RANGE_OBJECT_ANY
           
static java.lang.String RANGE_OBJECT_OBJECT
           
static java.lang.String RANGE_VOID_ANY
           
static java.lang.String RANGE_VOID_OBJECT
           
static java.lang.String[][] rangeWeights
           
 
Constructor Summary
protected Transformation(int action, int fromOBID, int toOBID, int fromSID, int toSID, java.lang.String function, java.lang.String constraint, boolean addToMap)
          Instantiates a transformation.
 
Method Summary
 int compareTo(java.lang.Object o)
           
static Transformation createAddTransformation(Schema fromSchema, Construct toObjectConstructType, AutoMedType amtype, java.lang.Object[] toObject, java.lang.String function, java.lang.String constraint)
           
static Transformation createAddTransformation(Schema fromSchema, Construct toObjectConstructType, java.lang.Object[] toObject, java.lang.String function, java.lang.String constraint)
          Creates a new ADD transformation.
static Transformation createAddTransformation(Schema fromSchema, Construct toObjectConstructType, java.lang.Object[] toObject, java.lang.String function, java.lang.String constraint, java.lang.String newSchemaName)
          Creates an ADD transformation.
static Transformation createContractTransformation(Schema fromSchema, SchemaObject fromObject, java.lang.String function, java.lang.String constraint)
          Creates an CONTRACT transformation.
static Transformation createContractTransformation(Schema fromSchema, SchemaObject fromObject, java.lang.String newSchemaName, java.lang.String function, java.lang.String constraint)
          Creates an CONTRACT transformation.
static Transformation createDeleteTransformation(Schema fromSchema, SchemaObject fromObject, java.lang.String function, java.lang.String constraint)
          Creates a DELETE transformation.
static Transformation createDeleteTransformation(Schema fromSchema, SchemaObject fromObject, java.lang.String function, java.lang.String constraint, java.lang.String newSchemaName)
          Creates a DELETE transformation.
static Transformation createExtendTransformation(Schema fromSchema, Construct toObjectConstructType, java.lang.Object[] toObject, java.lang.String function, java.lang.String constraint)
          Creates an EXTEND transformation.
static Transformation createExtendTransformation(Schema fromSchema, Construct toObjectConstructType, java.lang.Object[] toObject, java.lang.String newSchemaName, java.lang.String function, java.lang.String constraint)
          Creates an EXTEND transformation.
static Transformation createIdentTransformation(Schema fromSchema, Schema toSchema, java.lang.String function, java.lang.String constraint)
          Creates an IDENT transformation.
static Transformation createIdentTransformations(Schema fromSchema, Schema toSchema, java.lang.String function, java.lang.String constraint)
          Deprecated. Use #createIdentTransformations() instead.
static java.lang.String createIntSchemaName(java.lang.String sName, boolean isExtSchema, boolean canChangeOriginalName)
          Creates a name for an intentional schema based on a given schema.
static Transformation createRenameTransformation(Schema fromSchema, SchemaObject fromObject, java.lang.Object[] toObject)
          Creates a RENAME transformation.
static Transformation createRenameTransformation(Schema fromSchema, SchemaObject fromObject, java.lang.Object[] toObject, java.lang.String newSchemaName)
          Creates a RENAME transformation.
 java.lang.String debugString()
          A String representation of this object useful for debugging code
protected  Transformation duplicateTransformation(Schema fromSchema)
          Creates a duplicate of the transformation.
 int getActionFrom(Schema s)
          Returns the action of the transformation.
 java.lang.String getActionName()
          Return this transformation's action name
 java.lang.String getActionNameFrom(Schema s)
           
 java.lang.String getActionNameTo(Schema s)
           
static int getActionNumber(java.lang.String actionStr)
          Return an action number from its name
static java.lang.String getActionString(int actionId)
           
 int getActionTo(Schema s)
          Returns the action of the transformation.
 SchemaObject[] getAllReferencedSchemaObjects()
          Returns all the schema objects referenced in a transformation, including those referenced in its query.
The result of this method is the union of the results returned by the methods getReferencedSchemaObjects() and getReferencedSchemaObjectsInQuery().
static java.util.List getAllTrans()
           
 Schema getCommonSchema(Transformation t)
           
 java.lang.String getConstraint()
          Returns the constraint associated with the transformation.
protected  int getFromOBID()
          Returns the schema object identifier (OBID) of the input of the transformaiton (fromObject).
protected  SchemaObject getFromObject()
          Returns the SchemaObject input of the transformation.
protected  Schema getFromSchema()
          Returns the originating Schema of the transformation.
protected  int getFromSID()
          Returns the schema identifier (SID) of the originating schema.
 java.lang.String getFunction()
          Returns the function of the transformation.
 PersistentKey getKey()
           
 SchemaObject getKnownSchemaObject(int sid)
          Use instead of getSchemaObject(int) where you are sure that the sid is valid for the transformation.
 SchemaObject getKnownSchemaObject(Schema s)
          Use instead of getSchemaObject(Schema) where you are sure that the Schema is valid for the transformation.
static Transformation getKnownTransformation(Schema fs, Schema ts)
           
 Schema[] getOriginalSchemas()
           
 Schema getOtherSchema(Schema s)
          Returns the schemas of the transformation.
 java.util.Map getPersistentAttributes()
           
 java.lang.String getProperty(java.lang.String key)
          Returns a property associated with this Transformation.
 float getQuality()
           
protected  java.lang.String getRange()
          Determine the actual range of a transformation
 SchemaObject[] getReferencedSchemaObjects()
          Returns all the schema objects referenced in a transformation.
 SchemaObject[] getReferencedSchemaObjectsInQuery()
          Returns all the schema objects referenced in the query of a transformation.
protected  Transformation getReverseTransformation()
          Returns the reverse transformation of the given transformation.
 SchemaObject getSchemaObject(Schema s)
          Returns the SchemaObject of the transformation.
 Schema[] getSchemas()
          Returns the schemas of the transformation.
protected  int getToOBID()
          Returns the schema object identifier (OBID) of the output of the transformaiton (toObject).
protected  SchemaObject getToObject()
          Returns the SchemaObject output of the transformation.
protected  Schema getToSchema()
          Returns the resultant Schema of the transformation.
protected  int getToSID()
          Returns the schema identifier (SID) of the resultant schema.
static Transformation getTransformation(int fSID, int tSID)
          Returns the transformation between two given schemas.
static Transformation getTransformation(Schema fs, Schema ts)
          Returns the transformation between two given schemas.
static java.lang.Object[][] getTransformations()
           
static Transformation[] getTransformationsToObject(int tOBID)
          Get all transformations to a specific schema object
static void importTransformations(java.io.InputStream is)
           
static void importTransformations(java.io.InputStream is, java.lang.String suffix)
           
protected  boolean isDependentOn(Transformation tran)
          Determines whether or not the transformation is dependent on another transformation.
protected  boolean isRedundant(Transformation tran)
          Determines whether or not the transformation and the given tran are redundant, e.g., two transformations are redundant if they transform the same schema object and their action is the opposite of the other (add/delete, extend/contract, etc.).
protected  void measureQuality()
          Measure the quality of this transformation based on the action and range of values involved
static Transformation read(java.io.InputStream is)
           
 void remove()
          Removes this Transformation from the repository.
static void removeTransformation(java.lang.String fromSchema, java.lang.String toSchema)
          Removes the transformation between two given schemas.
 void retract()
           
 void setProperty(java.lang.String key, java.lang.String value)
          Sets a property associated with this Transformation.
 void setSyntaxChecking(boolean flag)
          Set if the syntax of transformations is checked as entered into the repository.
static void syncWithRepository()
           
 java.lang.String toLaTeX(Schema s1)
          Returns the transformation in a form that may rendered by the hdm.sty LaTeX package.
 java.lang.String toString()
           
 void write()
           
 void write(java.io.OutputStream os)
           
 void write(java.io.PrintWriter pw)
           
protected  void write(java.io.PrintWriter pw, java.lang.String prefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_ID

public static final int NULL_ID
See Also:
Constant Field Values

ACTION_ADD_STR

public static final java.lang.String ACTION_ADD_STR
See Also:
Constant Field Values

ACTION_DELETE_STR

public static final java.lang.String ACTION_DELETE_STR
See Also:
Constant Field Values

ACTION_RENAME_STR

public static final java.lang.String ACTION_RENAME_STR
See Also:
Constant Field Values

ACTION_EXTEND_STR

public static final java.lang.String ACTION_EXTEND_STR
See Also:
Constant Field Values

ACTION_CONTRACT_STR

public static final java.lang.String ACTION_CONTRACT_STR
See Also:
Constant Field Values

ACTION_IDENT_STR

public static final java.lang.String ACTION_IDENT_STR
See Also:
Constant Field Values

IQL_TRUE_CONSTRAINT

public static final java.lang.String IQL_TRUE_CONSTRAINT
Constraint that evaluates to true

See Also:
Constant Field Values

ACTION_MINIMUM

public static final int ACTION_MINIMUM
See Also:
Constant Field Values

ACTION_ADD

public static final int ACTION_ADD
Transformation action "add"

See Also:
Constant Field Values

ACTION_DELETE

public static final int ACTION_DELETE
Transformation action "delete"

See Also:
Constant Field Values

ACTION_RENAME

public static final int ACTION_RENAME
Transformation action "rename"

See Also:
Constant Field Values

ACTION_EXTEND

public static final int ACTION_EXTEND
Transformation action "extend"

See Also:
Constant Field Values

ACTION_CONTRACT

public static final int ACTION_CONTRACT
Transformation action "contract"

See Also:
Constant Field Values

ACTION_IDENT

public static final int ACTION_IDENT
Transformation action "ident"

See Also:
Constant Field Values

ACTION_MAXIMUM

public static final int ACTION_MAXIMUM
See Also:
Constant Field Values

PROPERTY_IQL_FUNCTION

public static final java.lang.String PROPERTY_IQL_FUNCTION
Name of property used to label IDENT transformations with the IQL function that is used to merge values from either side of the IDENT (i.e. gives the semantics to query processing). At present the value should be one of "choose", "setUnion", "(++)" and "intersect"

See Also:
Constant Field Values

PROPERTY_IQL_FUNCTION_DEFAULT_VALUE

public static final java.lang.String PROPERTY_IQL_FUNCTION_DEFAULT_VALUE
Default value for PROPERTY_IQL_FUNCTION

See Also:
Constant Field Values

actionWeights

public static final java.lang.String[][] actionWeights

RANGE_VOID_OBJECT

public static final java.lang.String RANGE_VOID_OBJECT
See Also:
Constant Field Values

RANGE_OBJECT_OBJECT

public static final java.lang.String RANGE_OBJECT_OBJECT
See Also:
Constant Field Values

RANGE_OBJECT_ANY

public static final java.lang.String RANGE_OBJECT_ANY
See Also:
Constant Field Values

RANGE_VOID_ANY

public static final java.lang.String RANGE_VOID_ANY
See Also:
Constant Field Values

rangeWeights

public static final java.lang.String[][] rangeWeights
Constructor Detail

Transformation

protected Transformation(int action,
                         int fromOBID,
                         int toOBID,
                         int fromSID,
                         int toSID,
                         java.lang.String function,
                         java.lang.String constraint,
                         boolean addToMap)
Instantiates a transformation.

Parameters:
action - the action of the transformation.
fromOBID - the schema object identifier (OBID) of the fromObject of the transformation.
toOBID - the schema object identifier (OBID) of the toObject of the transformation.
fromSID - the schema identifier (SID) of the fromSchema of the transformation.
toSID - the schema identifier (SID) of the toSchema of the transformation.
function - the query that expresses the extent of the construct being transformed.
constraint - the constraint associated with the transformation (if any).
addToMap - set to true if the transformation is to be added to the transformation HashMap; false otherwise.
Method Detail

createAddTransformation

public static Transformation createAddTransformation(Schema fromSchema,
                                                     Construct toObjectConstructType,
                                                     java.lang.Object[] toObject,
                                                     java.lang.String function,
                                                     java.lang.String constraint)
                                              throws TypeMismatchException,
                                                     IntegrityException
Creates a new ADD transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
toObjectConstructType - the construct type (see Construct) of the resulting transformation object.
toObject - the scheme (in an Object array) that forms the output of the transformation.
function - the query that expresses the extent of the construct being transformed.
constraint - the constraint associated with the transformation (if any).
Returns:
the Transformation object.
Throws:
InconsistentException
TypeMismatchException
IntegrityException

createAddTransformation

public static Transformation createAddTransformation(Schema fromSchema,
                                                     Construct toObjectConstructType,
                                                     AutoMedType amtype,
                                                     java.lang.Object[] toObject,
                                                     java.lang.String function,
                                                     java.lang.String constraint)
                                              throws TypeMismatchException,
                                                     IntegrityException
Throws:
TypeMismatchException
IntegrityException

createAddTransformation

public static Transformation createAddTransformation(Schema fromSchema,
                                                     Construct toObjectConstructType,
                                                     java.lang.Object[] toObject,
                                                     java.lang.String function,
                                                     java.lang.String constraint,
                                                     java.lang.String newSchemaName)
                                              throws TypeMismatchException,
                                                     IntegrityException
Creates an ADD transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
toObjectConstructType - the construct type (see Construct) of the resulting transformation object.
toObject - the scheme (in an Object array) that forms the output of the transformation.
function - the query that expresses the extent of the construct being transformed.
constraint - the constraint associated with the transformation (if any).
newSchemaName - the name of the resultant schema.
Returns:
the Transformation object.
Throws:
InconsistentException
TypeMismatchException
IntegrityException

createDeleteTransformation

public static Transformation createDeleteTransformation(Schema fromSchema,
                                                        SchemaObject fromObject,
                                                        java.lang.String function,
                                                        java.lang.String constraint)
                                                 throws TypeMismatchException,
                                                        IntegrityException
Creates a DELETE transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
fromObject - the SchemaObject to be deleted in the transformation. Note that this schema object must belong to the given fromSchema.
function - the query that expresses the extent of the construct being transformed.
constraint - the constraint associated with the transformation (if any).
Returns:
the Transformation object.
Throws:
InconsistentException
TypeMismatchException
IntegrityException

createDeleteTransformation

public static Transformation createDeleteTransformation(Schema fromSchema,
                                                        SchemaObject fromObject,
                                                        java.lang.String function,
                                                        java.lang.String constraint,
                                                        java.lang.String newSchemaName)
                                                 throws TypeMismatchException,
                                                        IntegrityException
Creates a DELETE transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
fromObject - the SchemaObject to be deleted in the transformation. Note that this schema object must belong to the given fromSchema.
function - the query that expresses the extent of the construct being transformed.
constraint - the constraint associated with the transformation (if any).
newSchemaName - the name of the resultant schema.
Returns:
the Transformation object.
Throws:
InconsistentException
TypeMismatchException
IntegrityException

createRenameTransformation

public static Transformation createRenameTransformation(Schema fromSchema,
                                                        SchemaObject fromObject,
                                                        java.lang.Object[] toObject)
                                                 throws TypeMismatchException,
                                                        IntegrityException
Creates a RENAME transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
fromObject - the SchemaObject to be renamed in the transformation. Note that this schema object must belong to the given fromSchema.
toObject - the scheme (in an Object array) that forms the output of the transformation. (The construct type of toObject must be the same as the fromObject).
function - the query that expresses the extent of the construct being transformed.
constraint - the constraint associated with the transformation (if any).
Returns:
the Transformation object.
Throws:
InconsistentException
TypeMismatchException
IntegrityException

createRenameTransformation

public static Transformation createRenameTransformation(Schema fromSchema,
                                                        SchemaObject fromObject,
                                                        java.lang.Object[] toObject,
                                                        java.lang.String newSchemaName)
                                                 throws TypeMismatchException,
                                                        IntegrityException
Creates a RENAME transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
fromObject - the SchemaObject to be renamed in the transformation. Note that this schema object must belong to the given fromSchema.
toObject - the scheme (in an Object array) that forms the output of the transformation. (The construct type of toObject must be the same as the fromObject).
newSchemaName - the name of the resultant schema.
Returns:
the Transformation object.
Throws:
InconsistentException
TypeMismatchException
IntegrityException

createExtendTransformation

public static Transformation createExtendTransformation(Schema fromSchema,
                                                        Construct toObjectConstructType,
                                                        java.lang.Object[] toObject,
                                                        java.lang.String function,
                                                        java.lang.String constraint)
                                                 throws TypeMismatchException,
                                                        IntegrityException
Creates an EXTEND transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
toObjectConstructType - the construct type (see Construct) of the resulting transformation object.
toObject - the scheme (in an Object array) that forms the output of the transformation.
function - the query that expresses the extent of the construct being transformed.
constraint - the constraint associated with the transformation (if any).
Returns:
the Transformation object.
Throws:
TypeMismatchException
IntegrityException

createExtendTransformation

public static Transformation createExtendTransformation(Schema fromSchema,
                                                        Construct toObjectConstructType,
                                                        java.lang.Object[] toObject,
                                                        java.lang.String newSchemaName,
                                                        java.lang.String function,
                                                        java.lang.String constraint)
                                                 throws TypeMismatchException,
                                                        IntegrityException
Creates an EXTEND transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
toObjectConstructType - the construct type (see Construct) of the resulting transformation object.
toObject - the scheme (in an Object array) that forms the output of the transformation.
newSchemaName - the name of the resultant schema.
Returns:
the Transformation object.
Throws:
TypeMismatchException
IntegrityException

createContractTransformation

public static Transformation createContractTransformation(Schema fromSchema,
                                                          SchemaObject fromObject,
                                                          java.lang.String function,
                                                          java.lang.String constraint)
                                                   throws TypeMismatchException,
                                                          IntegrityException
Creates an CONTRACT transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
fromObject - the SchemaObject to be contracted in the transformation. Note that this schema object must belong to the given fromSchema.
function - the query that expresses the extent of the construct being transformed.
constraint - the constraint associated with the transformation (if any).
Returns:
the Transformation object.
Throws:
InconsistentException
TypeMismatchException
IntegrityException

createContractTransformation

public static Transformation createContractTransformation(Schema fromSchema,
                                                          SchemaObject fromObject,
                                                          java.lang.String newSchemaName,
                                                          java.lang.String function,
                                                          java.lang.String constraint)
                                                   throws TypeMismatchException,
                                                          IntegrityException
Creates an CONTRACT transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
fromObject - the SchemaObject to be contracted in the transformation. Note that this schema object must belong to the given fromSchema.
newSchemaName - the name of the resultant schema.
Returns:
the Transformation object.
Throws:
InconsistentException
TypeMismatchException
IntegrityException

createIdentTransformations

public static Transformation createIdentTransformations(Schema fromSchema,
                                                        Schema toSchema,
                                                        java.lang.String function,
                                                        java.lang.String constraint)
                                                 throws SchemasNotIdenticalException
Deprecated. Use #createIdentTransformations() instead.

Throws:
SchemasNotIdenticalException

createIdentTransformation

public static Transformation createIdentTransformation(Schema fromSchema,
                                                       Schema toSchema,
                                                       java.lang.String function,
                                                       java.lang.String constraint)
                                                throws SchemasNotIdenticalException
Creates an IDENT transformation.

Parameters:
fromSchema - the originating Schema of the transformation.
toSchema - the resultant Schema of the transformation.
function - the query that expresses the extent of the construct being transformed.
constraint - the constraint associated with the transformation (if any).
Returns:
an array of Transformation objects.
Throws:
SchemasNotIdenticalException

createIntSchemaName

public static java.lang.String createIntSchemaName(java.lang.String sName,
                                                   boolean isExtSchema,
                                                   boolean canChangeOriginalName)
Creates a name for an intentional schema based on a given schema.

Parameters:
sName - the name of the schema that the new schema name is based on, i.e., the schema from which the new intentional schema is derived.
isExtSchema - set to true if the schema from which the new intentional schema is derived is an extentional schema; false otherwise.
canChangeOriginalName - set to true if the given base schema name can be altered (e.g., "schema" will be changed to "schema1" first before anything is appended to the name to produce the new intentional schema name).
Returns:
a unique intentional schema name that is created based on a given schema.

getTransformation

public static Transformation getTransformation(int fSID,
                                               int tSID)
                                        throws NotFoundException
Returns the transformation between two given schemas. Only one transformation may be held between any pair of Schemas.

Parameters:
fSID - the schema identifier (SID) of the first schema.
tSID - the schema identifier (SID) of the second schema.
Returns:
the transformation between two given schemas.
Throws:
NotFoundException

measureQuality

protected void measureQuality()
Measure the quality of this transformation based on the action and range of values involved


getRange

protected java.lang.String getRange()
Determine the actual range of a transformation

Returns:
String which takes one of the followings: Adapted from TransformationView.getValueAt() method

getTransformation

public static Transformation getTransformation(Schema fs,
                                               Schema ts)
                                        throws NotFoundException
Returns the transformation between two given schemas.

Parameters:
fs - the Schema of the originating schema.
ts - the Schema of the resultant schema.
Returns:
the transformation between two given schemas.
Throws:
NotFoundException - if no transformation exists between the schemas

getTransformationsToObject

public static Transformation[] getTransformationsToObject(int tOBID)
                                                   throws NotFoundException
Get all transformations to a specific schema object

Throws:
NotFoundException

getKnownTransformation

public static Transformation getKnownTransformation(Schema fs,
                                                    Schema ts)

removeTransformation

public static void removeTransformation(java.lang.String fromSchema,
                                        java.lang.String toSchema)
                                 throws NotFoundException,
                                        IntegrityException
Removes the transformation between two given schemas.

Parameters:
fromSchema - the name of the originating schema.
toSchema - the name of the resultant schema.
Throws:
NotFoundException - if either of the two named schemas do not exist
IntegrityException

remove

public void remove()
            throws IntegrityException
Removes this Transformation from the repository. Clearly, once called, this Transformation object instance should not be used again.

Throws:
IntegrityException

retract

public void retract()

getActionNumber

public static int getActionNumber(java.lang.String actionStr)
                           throws NotFoundException
Return an action number from its name

Throws:
NotFoundException

getActionName

public java.lang.String getActionName()
Return this transformation's action name


getActionNameFrom

public java.lang.String getActionNameFrom(Schema s)

getActionNameTo

public java.lang.String getActionNameTo(Schema s)

getActionFrom

public int getActionFrom(Schema s)
Returns the action of the transformation.

Returns:
the action of the transformation.

getActionTo

public int getActionTo(Schema s)
Returns the action of the transformation.

Returns:
the action of the transformation.

getFromObject

protected SchemaObject getFromObject()
Returns the SchemaObject input of the transformation. Returns null if no fromObject is associated with the transformation.

Returns:
the SchemaObject input of the transformation. Returns null if no fromObject is associated with the transformation.

getToObject

protected SchemaObject getToObject()
Returns the SchemaObject output of the transformation.

Returns:
the SchemaObject output of the transformation, or null if there is no such object, as will be the case for delete and contract transformations

getKnownSchemaObject

public SchemaObject getKnownSchemaObject(int sid)
Use instead of getSchemaObject(int) where you are sure that the sid is valid for the transformation. Will throw a runtime exception if this is not the case. Useful only to make code look tidy.


getKnownSchemaObject

public SchemaObject getKnownSchemaObject(Schema s)
Use instead of getSchemaObject(Schema) where you are sure that the Schema is valid for the transformation. Will throw a runtime exception if this is not the case. Useful only to make code look tidy.


getSchemaObject

public SchemaObject getSchemaObject(Schema s)
                             throws NotFoundException
Returns the SchemaObject of the transformation.

Parameters:
s - the schema in which the transformation object exists as a result of applying the transformation.
Returns:
the SchemaObject of the transformation, which may be null.
Throws:
NotFoundException

getFromSchema

protected Schema getFromSchema()
Returns the originating Schema of the transformation.

Returns:
the originating Schema of the transformation.

getToSchema

protected Schema getToSchema()
Returns the resultant Schema of the transformation.

Returns:
the resultant Schema of the transformation.

getSchemas

public Schema[] getSchemas()
Returns the schemas of the transformation.

Returns:
the schemas of the transformation.

getOtherSchema

public Schema getOtherSchema(Schema s)
Returns the schemas of the transformation.

Parameters:
s - one of the schemas associated with the transformation.
Returns:
the schemas of the transformation.

getFromSID

protected int getFromSID()
Returns the schema identifier (SID) of the originating schema.

Returns:
the schema identifier (SID) of the originating schema.

getToSID

protected int getToSID()
Returns the schema identifier (SID) of the resultant schema.

Returns:
the schema identifier (SID) of the resultant schema.

getFromOBID

protected int getFromOBID()
Returns the schema object identifier (OBID) of the input of the transformaiton (fromObject).

Returns:
the schema object identifier (OBID) of the input of the transformaiton (fromObject).

getToOBID

protected int getToOBID()
Returns the schema object identifier (OBID) of the output of the transformaiton (toObject).

Returns:
the schema object identifier (OBID) of the output of the transformaiton (toObject).

getFunction

public java.lang.String getFunction()
Returns the function of the transformation.

Returns:
the function of the transformation.

getConstraint

public java.lang.String getConstraint()
Returns the constraint associated with the transformation.

Returns:
the constraint associated with the transformation.

getQuality

public float getQuality()

getReverseTransformation

protected Transformation getReverseTransformation()
Returns the reverse transformation of the given transformation.

Parameters:
tran - the transformation that is to be reversed.
Returns:
the reverse transformation of the given transformation.

isDependentOn

protected boolean isDependentOn(Transformation tran)
                         throws IntegrityException
Determines whether or not the transformation is dependent on another transformation. If the transformation object appears anywhere in the scheme of the given transformation's object, this method will return true.

Parameters:
tran - the Transformation whose transformation object is to be compared.
Returns:
true if the transformation is dependent on the given Transformation; false otherwise.
Throws:
InconsistentException
IntegrityException

isRedundant

protected boolean isRedundant(Transformation tran)
                       throws IntegrityException
Determines whether or not the transformation and the given tran are redundant, e.g., two transformations are redundant if they transform the same schema object and their action is the opposite of the other (add/delete, extend/contract, etc.).

Parameters:
tran - the Transformation whose transformation object and action are to be compared.
Returns:
true if the transformation and the given Transformation are redundant; false otherwise.
Throws:
IntegrityException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

syncWithRepository

public static void syncWithRepository()
                               throws InconsistentException
Throws:
InconsistentException

getReferencedSchemaObjects

public SchemaObject[] getReferencedSchemaObjects()
Returns all the schema objects referenced in a transformation.

Returns:
an array of SchemaObject instances that are referenced in the transformation.

getReferencedSchemaObjectsInQuery

public SchemaObject[] getReferencedSchemaObjectsInQuery()
Returns all the schema objects referenced in the query of a transformation.

Returns:
an array of SchemaObject instances that are referenced in the query of the transformation.

getAllReferencedSchemaObjects

public SchemaObject[] getAllReferencedSchemaObjects()
Returns all the schema objects referenced in a transformation, including those referenced in its query.
The result of this method is the union of the results returned by the methods getReferencedSchemaObjects() and getReferencedSchemaObjectsInQuery().

Returns:
an array of SchemaObject instances that are referenced in the transformation, plus the SchemaObject instances referenced in its query.

duplicateTransformation

protected Transformation duplicateTransformation(Schema fromSchema)
                                          throws IntegrityException
Creates a duplicate of the transformation. A new intentional schema and entries in the STR will be created.

Parameters:
fromSchema - the originating Schema of the transformation.
Returns:
a duplicate of the transformation with the given fromSchema.
Throws:
IntegrityException

getTransformations

public static java.lang.Object[][] getTransformations()
                                               throws InconsistentException
Throws:
InconsistentException

importTransformations

public static void importTransformations(java.io.InputStream is)
                                  throws java.io.IOException,
                                         SyntaxException,
                                         NotFoundException,
                                         TypeMismatchException,
                                         IntegrityException,
                                         SchemasNotIdenticalException
Throws:
java.io.IOException
SyntaxException
NotFoundException
TypeMismatchException
IntegrityException
SchemasNotIdenticalException

importTransformations

public static void importTransformations(java.io.InputStream is,
                                         java.lang.String suffix)
                                  throws java.io.IOException,
                                         SyntaxException,
                                         NotFoundException,
                                         TypeMismatchException,
                                         IntegrityException,
                                         SchemasNotIdenticalException
Throws:
java.io.IOException
SyntaxException
NotFoundException
TypeMismatchException
IntegrityException
SchemasNotIdenticalException

read

public static Transformation read(java.io.InputStream is)
                           throws SyntaxException,
                                  NotFoundException,
                                  TypeMismatchException,
                                  IntegrityException,
                                  SchemasNotIdenticalException
Throws:
SyntaxException
NotFoundException
TypeMismatchException
IntegrityException
SchemasNotIdenticalException

write

public void write()

write

public void write(java.io.OutputStream os)

write

public void write(java.io.PrintWriter pw)

write

protected void write(java.io.PrintWriter pw,
                     java.lang.String prefix)

getOriginalSchemas

public Schema[] getOriginalSchemas()

getAllTrans

public static java.util.List getAllTrans()

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

getCommonSchema

public Schema getCommonSchema(Transformation t)

debugString

public java.lang.String debugString()
A String representation of this object useful for debugging code


setSyntaxChecking

public void setSyntaxChecking(boolean flag)
Set if the syntax of transformations is checked as entered into the repository. By default, this is on, and leads to a check being performed each time a transformation is created to ensure that the query function and constraints supplied are valid for the type of transformation being created. If you want to experiment with alternative query languages other than the IQL, you will need to turn this off.

Parameters:
flag - boolean value to determine if transformation query language checking is performed.

getKey

public PersistentKey getKey()
Specified by:
getKey in interface PersistentObject
See Also:
PersistentObject.getKey()

getPersistentAttributes

public java.util.Map getPersistentAttributes()
Specified by:
getPersistentAttributes in interface PersistentObject
See Also:
PersistentObject.getPersistentAttributes()

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Sets a property associated with this Transformation.

Parameters:
key - name given to identify this property. The only standard property name at present is{#link PROPERTY_IQL_FUNCTION}.
the - value to hold against the key value.

getProperty

public java.lang.String getProperty(java.lang.String key)
                             throws NotFoundException
Returns a property associated with this Transformation.

Parameters:
key - name given to identify this property. The only standard property name at present is {#link PROPERTY_IQL_FUNCTION}.
Returns:
the value held against the key value.
Throws:
NotFoundException - is there is no value recorded under key.

toLaTeX

public java.lang.String toLaTeX(Schema s1)
                         throws NotFoundException
Returns the transformation in a form that may rendered by the hdm.sty LaTeX package.

Parameters:
s1 - is the schema that the transformation goes from.
Throws:
NotFoundException

getActionString

public static java.lang.String getActionString(int actionId)