uk.ac.ic.doc.automed.modelmanagement.modelgen
Class HDMToEER

java.lang.Object
  extended by uk.ac.ic.doc.automed.modelmanagement.modelgen.HDMToEER

public class HDMToEER
extends java.lang.Object

A class to do HDM to ER model transformations

Author:
Andrew Charles Smith - acs203

Field Summary
private  java.util.ArrayList allConstraintObjects
           
private  java.util.ArrayList allEdgeObjects
           
private  java.util.ArrayList allNodeObjects
           
private  Construct attribute
           
private  java.util.Hashtable attributeEdges
           
private  java.util.Hashtable attributeNodes
           
private  Construct cons
           
private  Construct edge
           
private  Model eer
           
private  Construct entity
           
private  Construct entityOrRelationship
           
private  java.util.Hashtable extents
           
private  Construct generalisation
           
private  Model hdm
           
private  TypeHierarchy hlth
           
private  Construct node
           
private  java.util.Hashtable parentObjects
           
private  Construct relationship
           
private  java.util.ArrayList rootNodeObjects
           
private  Schema sourceSchema
           
private  Construct subset
           
 
Constructor Summary
HDMToEER(Schema s1)
          Creates a new instance of HDMToEER
 
Method Summary
private  Schema addAttribute(Schema transformedSchema, SchemaObject parentObject, SchemaObject hdmChild, SchemaObject edgeSchemaObject)
          Add an attribute
private  Schema addEntity(Schema transformedSchema, SchemaObject hdmObject)
          Add a ER entity to Automed
private  void addHDMObjectsToHashTables()
          Add all the HDM objects to the appropriate hash entities
private  Schema addRelationship(Schema s, SchemaObject hdmEdgeObject)
          Add a relationship
private  Schema addSubset(Schema s, SchemaObject hdmConstraintObject)
          Add a subset
private  java.lang.String computeCardinality(Schema transformedSchema, SchemaObject hdmEdgeObject)
           
private  SchemaObject findEntity(Schema s, SchemaObject hdmNode)
          Find an enity associated with this node
 Schema modelGen(TransformModel am)
          Transform the HDM elements in this schema into relational elements
private  Schema removeEdgeObject(Schema s, SchemaObject edgeObject)
          Recusively removes any HDM edges from the schema
private  Schema removeHDMConstructs(Schema transformedSchema)
          Remove the HDM constructs from the transformed schema
 void setSchema(Schema s)
          Set the schema to transform
private  void setUpEERModel()
          Set up the relational model, the constructs and the type hierarchy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hdm

private Model hdm

node

private Construct node

cons

private Construct cons

edge

private Construct edge

eer

private Model eer

entity

private Construct entity

entityOrRelationship

private Construct entityOrRelationship

attribute

private Construct attribute

relationship

private Construct relationship

generalisation

private Construct generalisation

subset

private Construct subset

sourceSchema

private Schema sourceSchema

hlth

private TypeHierarchy hlth

allEdgeObjects

private java.util.ArrayList allEdgeObjects

allConstraintObjects

private java.util.ArrayList allConstraintObjects

allNodeObjects

private java.util.ArrayList allNodeObjects

rootNodeObjects

private java.util.ArrayList rootNodeObjects

extents

private java.util.Hashtable extents

parentObjects

private java.util.Hashtable parentObjects

attributeNodes

private java.util.Hashtable attributeNodes

attributeEdges

private java.util.Hashtable attributeEdges
Constructor Detail

HDMToEER

public HDMToEER(Schema s1)
         throws NotFoundException
Creates a new instance of HDMToEER

Parameters:
s1 - The schema to transform
Throws:
NotFoundException - Throws an exception if constrcuts are not found
Method Detail

setSchema

public void setSchema(Schema s)
Set the schema to transform

Parameters:
s - The schema to transform

addHDMObjectsToHashTables

private void addHDMObjectsToHashTables()
                                throws AutoMedException
Add all the HDM objects to the appropriate hash entities

Throws:
AutoMedException

removeEdgeObject

private Schema removeEdgeObject(Schema s,
                                SchemaObject edgeObject)
                         throws AutoMedException
Recusively removes any HDM edges from the schema

Parameters:
s - the schema we wish to remove the HDM edges from
Returns:
A schema with no HDM edges
Throws:
AutoMedException

removeHDMConstructs

private Schema removeHDMConstructs(Schema transformedSchema)
                            throws AutoMedException
Remove the HDM constructs from the transformed schema

Throws:
AutoMedException

addEntity

private Schema addEntity(Schema transformedSchema,
                         SchemaObject hdmObject)
                  throws IntegrityException,
                         TypeMismatchException,
                         NotFoundException
Add a ER entity to Automed

Throws:
IntegrityException
TypeMismatchException
NotFoundException

addAttribute

private Schema addAttribute(Schema transformedSchema,
                            SchemaObject parentObject,
                            SchemaObject hdmChild,
                            SchemaObject edgeSchemaObject)
                     throws TypeMismatchException,
                            NotFoundException,
                            IntegrityException
Add an attribute

Throws:
TypeMismatchException
NotFoundException
IntegrityException

computeCardinality

private java.lang.String computeCardinality(Schema transformedSchema,
                                            SchemaObject hdmEdgeObject)

findEntity

private SchemaObject findEntity(Schema s,
                                SchemaObject hdmNode)
                         throws AutoMedException
Find an enity associated with this node

Parameters:
hdmNode - - the HDM node
Returns:
the entity object
Throws:
AutoMedException

addRelationship

private Schema addRelationship(Schema s,
                               SchemaObject hdmEdgeObject)
                        throws AutoMedException
Add a relationship

Throws:
AutoMedException

addSubset

private Schema addSubset(Schema s,
                         SchemaObject hdmConstraintObject)
                  throws AutoMedException
Add a subset

Throws:
AutoMedException

setUpEERModel

private void setUpEERModel()
                    throws NotFoundException
Set up the relational model, the constructs and the type hierarchy

Throws:
NotFoundException

modelGen

public Schema modelGen(TransformModel am)
                throws AutoMedException
Transform the HDM elements in this schema into relational elements

Parameters:
sourceModel -
targetModel -
am -
Returns:
Returns the relational schema
Throws:
AutoMedException - General AutoMedException