uk.ac.ic.doc.automed.modelmanagement.matchmodel
Class MatchModel

java.lang.Object
  extended by uk.ac.ic.doc.automed.modelmanagement.matchmodel.MatchModel

public class MatchModel
extends java.lang.Object

The MatchModel base class

Author:
acs203@doc.ic.ac.uk

Field Summary
private  Construct _constraint
           
private  Construct _edge
           
private  Model _hdm
           
private  Construct _node
           
private  int _numMatches
           
private  Model _targetModel
          The target model
(package private)  java.util.HashMap matchObjects
           
(package private)  boolean reverseMatch
           
 
Constructor Summary
MatchModel(Model targetModel)
          Creates a new instance of MatchModel This sets up the HDM model and the target model for the algorithms
 
Method Summary
 java.util.HashMap autoMatch(Schema schema)
           
private  boolean checkConstraintStructure(Schema s, MatchObject mo, Construct targetConstruct)
          Determine whether @param mo match the structure of @param targetConstruct By this stage all the objects that mo.so is attached to should have been identified We should check this
private  boolean checkLinkNodalStructure(Schema s, SchemaObject so, Construct targetConstruct)
          Determine whether @param so and its dependent object match the structure of
private  java.util.ArrayList createConstructList(Model targetModel)
          Returns a list of TargetConstructs in the @param targetModel.
private  boolean matchConstraint(Schema schema, MatchObject mc, TargetConstruct targetConstruct)
          Determine whether object @param mc matches the constraint construct We need to check schema object types here
private  boolean matchEdgeConstraint(Schema schema, MatchObject mc, TargetConstruct targetConstruct)
          Determine whether object @param mc matches the constraint construct We need to check schema object types here This is for construct like the SQL primary key
private  boolean matches(java.lang.String constraintString, java.lang.String targetConstraintString)
          Determine whether @param constraintString is a subset of
private  boolean matchLink(Schema schema, MatchObject me, TargetConstruct targetConstruct)
          Determine whether object @param me matches the link construct
private  boolean matchLinkNodal(Schema schema, MatchObject me, TargetConstruct targetConstruct)
          Determine whether object @param me matches the linkNodal construct
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_targetModel

private Model _targetModel
The target model


_hdm

private Model _hdm

_constraint

private Construct _constraint

_edge

private Construct _edge

_node

private Construct _node

matchObjects

java.util.HashMap matchObjects

_numMatches

private int _numMatches

reverseMatch

boolean reverseMatch
Constructor Detail

MatchModel

public MatchModel(Model targetModel)
           throws NotFoundException
Creates a new instance of MatchModel This sets up the HDM model and the target model for the algorithms

Parameters:
targetModel - - The target Model for this auto match
Throws:
NotFoundException - if the HDM model cannot be found in the repository
Method Detail

createConstructList

private java.util.ArrayList createConstructList(Model targetModel)
Returns a list of TargetConstructs in the @param targetModel. The list is ordered as follows: link nodals, links, constraints, nodes The TargetConstruct includes the Construct and any constraint definition associated with the construct

Parameters:
targetModel - - The target Model for this transformation
Returns:
ArrayList - A list of TargetConstructs

checkLinkNodalStructure

private boolean checkLinkNodalStructure(Schema s,
                                        SchemaObject so,
                                        Construct targetConstruct)
                                 throws AutoMedException
Determine whether @param so and its dependent object match the structure of

Parameters:
targetConstruct -
Throws:
AutoMedException

checkConstraintStructure

private boolean checkConstraintStructure(Schema s,
                                         MatchObject mo,
                                         Construct targetConstruct)
                                  throws AutoMedException
Determine whether @param mo match the structure of @param targetConstruct By this stage all the objects that mo.so is attached to should have been identified We should check this

Throws:
AutoMedException

matches

private boolean matches(java.lang.String constraintString,
                        java.lang.String targetConstraintString)
                 throws AutoMedException
Determine whether @param constraintString is a subset of

Parameters:
targetConstraintString. -
Throws:
AutoMedException

matchLink

private boolean matchLink(Schema schema,
                          MatchObject me,
                          TargetConstruct targetConstruct)
                   throws AutoMedException
Determine whether object @param me matches the link construct

Parameters:
schema -
me -
targetConstruct - Assume for the moment that a link construct does not link single nodes
Returns:
Throws:
AutoMedException

matchEdgeConstraint

private boolean matchEdgeConstraint(Schema schema,
                                    MatchObject mc,
                                    TargetConstruct targetConstruct)
                             throws AutoMedException
Determine whether object @param mc matches the constraint construct We need to check schema object types here This is for construct like the SQL primary key

Parameters:
schema -
mc - - contains an edge
targetConstruct - The high level construct we are matching against
Returns:
whether or not the match was successful
Throws:
AutoMedException

matchLinkNodal

private boolean matchLinkNodal(Schema schema,
                               MatchObject me,
                               TargetConstruct targetConstruct)
                        throws AutoMedException
Determine whether object @param me matches the linkNodal construct

Parameters:
targetConstruct - In this method the SchemaObject me._object is always an edge
me - - a MatchObject containing an edge
targetConstruct - - a link nodal construct from the target Model
Throws:
AutoMedException

matchConstraint

private boolean matchConstraint(Schema schema,
                                MatchObject mc,
                                TargetConstruct targetConstruct)
                         throws AutoMedException
Determine whether object @param mc matches the constraint construct We need to check schema object types here

Parameters:
schema -
mc -
targetConstruct -
Returns:
Throws:
AutoMedException

autoMatch

public java.util.HashMap autoMatch(Schema schema)
                            throws AutoMedException
Throws:
AutoMedException