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

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

public class Scheme
extends java.lang.Object
implements PersistentObject

The Scheme class is used to described each element of the scheme of SchemaObject. For example, the scheme of an ER entity might be <<person>> where person is a String. This would be represented one Scheme with a position of 0. The scheme of an ER attribute might be <<person,name>>, which would be represented by two Schemes, the first at position 0 containing a SchemaObject for entity person, and the second at position 1 containing a String "name".

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

Field Summary
static int HDM_TYPE_C
          Scheme relates to a constraint sentence in HDM
static int HDM_TYPE_E
          Scheme relates to edge name in HDM when instantiating the containing construct, this scheme position takes the name of the new edge to be created in HDM
static int HDM_TYPE_MAXIMUM
           
static int HDM_TYPE_MINIMUM
           
static int HDM_TYPE_N
          Scheme relates to node name in HDM.
static int HDM_TYPE_N1
          Deprecated.  
static int HDM_TYPE_N2
          Deprecated.  
static int HDM_TYPE_P1
          Deprecated.  
static int HDM_TYPE_P2
          Deprecated.  
static int HDM_TYPE_R
          Scheme relates to node or edge name/s in HDM and to other Construct/s in the automed.reps API.
static int HDM_TYPE_Z
          Scheme has no HDM representation
static int TYPE_ALTERNATION
          Deprecated. see Construct.CLASS_ALTERNATION
static int TYPE_CONSTRUCT
          Scheme type of construct scheme
static int TYPE_MAXIMUM
           
static int TYPE_MINIMUM
           
static int TYPE_NAME
          Scheme type of construct scheme
static int TYPE_SEQUENCE
          Deprecated. see Construct.CLASS_SEQUENCE
 
Constructor Summary
protected Scheme(SchemaObject object, int position, SchemaObject refObject, boolean isKey, int hdmType, boolean create)
          Creates a new scheme for a schema object.
 
Method Summary
 int getHDMType()
           
 PersistentKey getKey()
           
 java.util.Map getPersistentAttributes()
           
 SchemaObject getRefSchemaObject()
          Returns the SchemaObject that this Scheme wraps
 SchemaObject getSchemaObject()
          Returns the SchemaObject that this Scheme element is contained within, i.e.
 int getSchemePos()
          Returns the position of this Scheme in the definition of the SchemaObject it defines.
 boolean isKey()
          Determine if this Scheme is part of the set of Schemes that uniquely identify the parent SchemaObject in a particular Schema
 boolean isString()
          Determine if this Scheme defines a String, rather than a reference to some other SchemaObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_MINIMUM

public static final int TYPE_MINIMUM
See Also:
Constant Field Values

TYPE_NAME

public static final int TYPE_NAME
Scheme type of construct scheme

See Also:
Constant Field Values

TYPE_CONSTRUCT

public static final int TYPE_CONSTRUCT
Scheme type of construct scheme

See Also:
Constant Field Values

TYPE_ALTERNATION

public static final int TYPE_ALTERNATION
Deprecated. see Construct.CLASS_ALTERNATION
Scheme type of construct scheme

See Also:
Constant Field Values

TYPE_SEQUENCE

public static final int TYPE_SEQUENCE
Deprecated. see Construct.CLASS_SEQUENCE
Scheme type of construct scheme

See Also:
Constant Field Values

TYPE_MAXIMUM

public static final int TYPE_MAXIMUM
See Also:
Constant Field Values

HDM_TYPE_MINIMUM

public static final int HDM_TYPE_MINIMUM
See Also:
Constant Field Values

HDM_TYPE_N1

public static final int HDM_TYPE_N1
Deprecated. 
HDM type of construct scheme - new node at position 1

See Also:
Constant Field Values

HDM_TYPE_N2

public static final int HDM_TYPE_N2
Deprecated. 
HDM type of construct scheme - new node at position 2

See Also:
Constant Field Values

HDM_TYPE_P1

public static final int HDM_TYPE_P1
Deprecated. 
HDM type of construct scheme - pre-existing node at position 1

See Also:
Constant Field Values

HDM_TYPE_P2

public static final int HDM_TYPE_P2
Deprecated. 
HDM type of construct scheme - pre-existing node at position 2

See Also:
Constant Field Values

HDM_TYPE_N

public static final int HDM_TYPE_N
Scheme relates to node name in HDM. when instantiating the containing construct, this scheme position takes the name/s of the new nodes to be created in HDM

See Also:
Constant Field Values

HDM_TYPE_E

public static final int HDM_TYPE_E
Scheme relates to edge name in HDM when instantiating the containing construct, this scheme position takes the name of the new edge to be created in HDM

See Also:
Constant Field Values

HDM_TYPE_R

public static final int HDM_TYPE_R
Scheme relates to node or edge name/s in HDM and to other Construct/s in the automed.reps API. When instantiating the containing construct, this scheme position takes reference/s to existing constructs, i.e. existing nodes or edges in the HDM.

See Also:
Constant Field Values

HDM_TYPE_C

public static final int HDM_TYPE_C
Scheme relates to a constraint sentence in HDM

See Also:
Constant Field Values

HDM_TYPE_Z

public static final int HDM_TYPE_Z
Scheme has no HDM representation

See Also:
Constant Field Values

HDM_TYPE_MAXIMUM

public static final int HDM_TYPE_MAXIMUM
See Also:
Constant Field Values
Constructor Detail

Scheme

protected Scheme(SchemaObject object,
                 int position,
                 SchemaObject refObject,
                 boolean isKey,
                 int hdmType,
                 boolean create)
Creates a new scheme for a schema object. Each SchemaObject has one or more Scheme objects associated with it.

Parameters:
object - the SchemaObject to which the Scheme being created belongs.
posititon - position of the scheme.
refObject - the SchemaObject that appears in the given position of the scheme.
create - set to true if corresponding entries in the scheme table in the STR are to be made; false otherwise.
Method Detail

getSchemaObject

public SchemaObject getSchemaObject()
Returns the SchemaObject that this Scheme element is contained within, i.e. the SchemaObject that it being defined by this Scheme along with posibily other Schemes.

Returns:
the containing SchemaObject of this scheme.

getSchemePos

public int getSchemePos()
Returns the position of this Scheme in the definition of the SchemaObject it defines.

Returns:
the position of the scheme.

getRefSchemaObject

public SchemaObject getRefSchemaObject()
Returns the SchemaObject that this Scheme wraps

Returns:
the SchemaObject represented by this Scheme.

getHDMType

public int getHDMType()

isString

public boolean isString()
Determine if this Scheme defines a String, rather than a reference to some other SchemaObject


isKey

public boolean isKey()
Determine if this Scheme is part of the set of Schemes that uniquely identify the parent SchemaObject in a particular Schema


getKey

public PersistentKey getKey()
Specified by:
getKey in interface PersistentObject

getPersistentAttributes

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