uk.ac.ic.doc.rodex.qproc
Class QuerySubGoal

java.lang.Object
  extended by uk.ac.ic.doc.rodex.qproc.QuerySubGoal

public class QuerySubGoal
extends java.lang.Object


Constructor Summary
QuerySubGoal(java.lang.String schemeDef)
          Create a new sub goal from a scheme definition, e.g.
QuerySubGoal(java.lang.String[] schemeElements)
          Creates a new instance of QuerySubGoal
QuerySubGoal(java.lang.String schemaName, java.lang.String schemeDef)
          Create a new sub goal from a schema name and a short scheme definition, e.g.
QuerySubGoal(java.lang.String schemaName, java.lang.String[] schemeElements)
          Create a new sub goal from a schema name and scheme elements
 
Method Summary
 void addDefQuery(TransformationAbstraction defQuery)
          Add a definition query for the schema object represented by this sub-goal.
 void addVariable(QueryVariable var)
          A head variable of the sub-goal.
 boolean equals(java.lang.Object o)
          Override the comparison method
 java.util.List getDefQueries()
           
 java.lang.String[] getElements()
          Return all scheme elements (scheme name + fields) as one array
 java.lang.String[] getFields()
           
 java.lang.String getID()
          Return the object if corresponding to this scheme
 int getIndex()
          Return the temporary index position of this sub-goal in a list
 java.lang.String getSchemaName()
          Return the schema name (e.g.
 java.lang.String getSchemeName()
          Return the scheme name (e.g.
 java.util.List getSharedVariables()
          Return a List of shared variables
 java.util.List getVariables()
          Query's head variables
 boolean hasField(java.lang.String fieldName)
          Check that it contains a field
 int hashCode()
          Override the Object.hashCode() method for use in a collection.
Basically this method helps produces unique key for a QuerySubGoal
object when it is stored in a collection, such as HashTable/code>
 boolean isMappableTo(QuerySubGoal anotherSubGoal)
          Test for containment mapping to another subgoal.
 void setID(java.lang.String id)
          Set the id for this sub-goal using the corresponding schema object id from
the repository
 void setIndex(int index)
          Set the temporary index position of this scheme in a list of schemes
.
 java.lang.String toExtendedString()
          Output a String representation of the sub goal with schema name (if any)
 java.lang.String toInternalString()
          Output a String representation of the sub-goal using sub-goal's unique id instead of the scheme name string
 java.lang.String toIQLString()
          Output a String representation of the sub goal with schema name (if any) toIQLString() = "{x,y} ->" + toString()
 java.lang.String toString()
          Output a String representation of the sub goal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QuerySubGoal

public QuerySubGoal(java.lang.String[] schemeElements)
Creates a new instance of QuerySubGoal

Parameters:
schemeElements - an array of scheme elements of the query subgoal

QuerySubGoal

public QuerySubGoal(java.lang.String schemeDef)
Create a new sub goal from a scheme definition, e.g. uni_s1:<> or <>


QuerySubGoal

public QuerySubGoal(java.lang.String schemaName,
                    java.lang.String schemeDef)
Create a new sub goal from a schema name and a short scheme definition, e.g. <>


QuerySubGoal

public QuerySubGoal(java.lang.String schemaName,
                    java.lang.String[] schemeElements)
Create a new sub goal from a schema name and scheme elements

Method Detail

isMappableTo

public boolean isMappableTo(QuerySubGoal anotherSubGoal)
Test for containment mapping to another subgoal. Basically, two subgoals
are mappable if their sematic structure is exactly the same (i.e. same scheme name
and fields)

Parameters:
anotherSubGoal - another QuerySubGoal object
Returns:
boolean true if the two are mappable, false otherwise

hasField

public boolean hasField(java.lang.String fieldName)
Check that it contains a field


toString

public java.lang.String toString()
Output a String representation of the sub goal

Overrides:
toString in class java.lang.Object

toIQLString

public java.lang.String toIQLString()
Output a String representation of the sub goal with schema name (if any) toIQLString() = "{x,y} ->" + toString()


toExtendedString

public java.lang.String toExtendedString()
Output a String representation of the sub goal with schema name (if any)


toInternalString

public java.lang.String toInternalString()
                                  throws QueryIntegrityException
Output a String representation of the sub-goal using sub-goal's unique id instead of the scheme name string

Throws:
QueryIntegrityException

equals

public boolean equals(java.lang.Object o)
Override the comparison method

Overrides:
equals in class java.lang.Object

addVariable

public void addVariable(QueryVariable var)
A head variable of the sub-goal. Each head variable is mapped to a corresponding
field in the same position

Parameters:
var - a QueryVariable object

getSharedVariables

public java.util.List getSharedVariables()
Return a List of shared variables

Returns:
List a list of shared variables; null if there
are no shared variables

getSchemeName

public java.lang.String getSchemeName()
Return the scheme name (e.g. staff)


getSchemaName

public java.lang.String getSchemaName()
Return the schema name (e.g. uni_s1)


getFields

public java.lang.String[] getFields()

getElements

public java.lang.String[] getElements()
Return all scheme elements (scheme name + fields) as one array

Returns:
String[]

getVariables

public java.util.List getVariables()
Query's head variables


getID

public java.lang.String getID()
Return the object if corresponding to this scheme


setID

public void setID(java.lang.String id)
Set the id for this sub-goal using the corresponding schema object id from
the repository


getIndex

public int getIndex()
Return the temporary index position of this sub-goal in a list


setIndex

public void setIndex(int index)
Set the temporary index position of this scheme in a list of schemes
. This method is useful for processing sub-goals which involves getting an object
from list, changing its content and pushing it back to list at a lates stage


addDefQuery

public void addDefQuery(TransformationAbstraction defQuery)
Add a definition query for the schema object represented by this sub-goal. A definition query is repreresented by a TransformationAbstraction object


getDefQueries

public java.util.List getDefQueries()

hashCode

public int hashCode()
Override the Object.hashCode() method for use in a collection.
Basically this method helps produces unique key for a QuerySubGoal
object when it is stored in a collection, such as HashTable/code>

Overrides:
hashCode in class java.lang.Object