All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class DSRG.VKB.View_Definition

java.lang.Object
   |
   +----DSRG.VKB.View_Definition

public class View_Definition
extends Object
implements Serializable, VSA_View_Definition, Cloneable
Represents the View definition.

It has a small parser in it, so, it can generate from a string of ESQL. It contains three lists: select, from and where.

ViewDefinition Overall Function


Variable Index

 o DEBUG
 o DONTCARE
VE is DONTCARE
 o EQUIVALENT
VE is EQUIVALENT
 o from
Vector of FROM clause.
 o FROM
FROM clause constant
 o JOIN
JOIN list constant
 o name
Name of this ViewDefinition.
 o PROJECT
PROJECT list constant
 o SELECT
SELECT here has two meaning.
 o select
it will keep the order of the select clause.
 o SUBSET
VE is SUBSET.
 o SUPERSET
VE is SUPERSET
 o versions
A Vector of Versions of this View-Definition.
 o VExtent
VE parameter of this View Definition
 o where
Vector of Condition clause.
 o WHERE
WHERE clause constant

Constructor Index

 o View_Definition()
Default construction.
 o View_Definition(String, MKB)
Parse E-SQL/SQL String and create the View definition object.

Method Index

 o addJCs(Vector)
Add a Vector of JCs to the View Definition.
 o addRelFrom(Relation)
Add Relation to from clause of the View Definition.
 o attrSelect(Relation, boolean, boolean)
Get Attributes in Select Clause.
 o attrWhere(Relation, boolean, boolean)
Get Attributes in Where Clause.
 o clean()
Clean the View Definition: 1.
 o clone()
Clone the view definition.
 o contains(Attribute)
Descide whether VD contains some Attribute.
 o contains(Relation)
Descide whether VD contains some Relation
 o contains(String)
Descide whether VD contains some IS
 o dropAttrSelect(Relation, boolean, boolean)
Drop Attributes from Select clause of this view definition.
 o dropAttrSelect(Vector)
Drop attribute-components from Select clause for specific vector of attributes
 o dropComponents(Vector)
Drop a vector of components from one view definition.
 o dropCondWhere(Relation, boolean, boolean)
Drop Conditions from Where clause of this view definition.
 o evolvable(Attribute)
Similar to evolvable for del_relation.
 o evolvable(Relation)
Check if this view is evolvable or not for a specific relation.
 o from_get(Relation)
Get a Relation Component for specific Relation.
 o get(Vector, Attribute)
Get an Attribute Component from a vector of attribute_components clause for specific Attribute.
 o getAttrComponent(Attribute)
Get an Attribute_Component from select clause for specific attribute
 o getAttributes(Relation)
Get all attributes of one Relation of this View.
 o getClause(int)
Get clause from this view definition.
 o getComponents(Relation)
Get all components of one Relation
 o getCondComponents(Attribute)
Get Condition_Component for specific Attribute.
 o getDispensableComponent()
Get Dispensable components of one view defintion.
 o getESQL()
Get E-SQL of this view definition.
 o getISs()
Return vector of ISs of this VD.
 o getName()
Return view name.
 o getPSJList(int)
Get PSJ List of this View Definition.
 o getRelComponent(Relation)
Get Relation_Component for specific Relation.
 o getSQL()
Get SQL of this view definition without the IS information.
 o getVersions()
return the vector of all versions of this view after view synchronization.
 o getVExtent()
 o makeStrongest()
 o replaceAttrSelect(Attribute, Attribute)
replace Attributes in Select Clause.
 o replaceAttrSelect(Relation, Replacement, boolean, boolean)
replace Attributes in Select clause.
 o replaceAttrWhere(Attribute, Attribute)
Replace attribute in the Where clause.
 o replaceCondWhere(Relation, Replacement, boolean, boolean)
replace Attributes in the condition in the Where clause.
 o replaceRelFrom(Relation, Relation)
Replace relation at From clause.
 o setFrom(Vector)
Set From clause
 o setName(String)
Set View Definition's Name
 o setSelect(Vector)
Set Select Clause
 o setVersions(Vector)
Set a list of versions of rewritings of this View_Definition by VSA.
 o setVExtent(int)
Set VE parameter of this View Definition
 o setWhere(Condition_index)
Set Where clause
 o toString()
Debug Function show the View_Definition
 o VExtentoStr(int)
Return string representation of VExtent parameter

Variables

 o DEBUG
 private static final boolean DEBUG
 o versions
 Vector versions
A Vector of Versions of this View-Definition. To be used for selecting a version out of some suggestions after a view synchronization.

 o SELECT
 public static final int SELECT
SELECT here has two meaning. If it used in getClause() function, it means the select clause of view definition. If it used in getPSJList() function, it means the local_conditions in the where clause of view definition.

 o FROM
 public static final int FROM
FROM clause constant

 o WHERE
 public static final int WHERE
WHERE clause constant

 o PROJECT
 public static final int PROJECT
PROJECT list constant

 o JOIN
 public static final int JOIN
JOIN list constant

 o SUBSET
 public static final int SUBSET
VE is SUBSET.

 o SUPERSET
 public static final int SUPERSET
VE is SUPERSET

 o EQUIVALENT
 public static final int EQUIVALENT
VE is EQUIVALENT

 o DONTCARE
 public static final int DONTCARE
VE is DONTCARE

 o name
 String name
Name of this ViewDefinition.

 o VExtent
 int VExtent
VE parameter of this View Definition

 o select
 Vector select
it will keep the order of the select clause. It stores a vector of Attribute_Component

 o from
 Vector from
Vector of FROM clause. The elements are objects of class Relation_Component.

 o where
 Condition_index where
Vector of Condition clause. It's a list of conditions. Each elememt is an object of Condition_Component.

Constructors

 o View_Definition
 public View_Definition()
Default construction.

 o View_Definition
 public View_Definition(String ESQL,
                        MKB mkb)
Parse E-SQL/SQL String and create the View definition object.

Parameters:
ESQL - E-SQL/SQL of this view definition.

Methods

 o setVersions
 public void setVersions(Vector vs)
Set a list of versions of rewritings of this View_Definition by VSA.

Parameters:
A - Vector of Version.
 o getVersions
 public Vector getVersions()
return the vector of all versions of this view after view synchronization. This vector is updated from the outside, it's never changed from within this class.

 o clean
 public void clean()
Clean the View Definition: 1. Clean the from clause to remove the useless relations that only appeared in Where clause. 2. It also clean the duplicate relations. 3. Clean the Where Clause JC conditions.

 o dropAttrSelect
 public void dropAttrSelect(Relation r,
                            boolean di,
                            boolean re)
Drop Attributes from Select clause of this view definition.

Parameters:
r - the attribute's relation
di - ESQL dispensable parameter
re - ESQL replaceable parameter
 o dropCondWhere
 public void dropCondWhere(Relation r,
                           boolean di,
                           boolean re)
Drop Conditions from Where clause of this view definition.

Parameters:
r - the attribute's relation
di - ESQL dispensable parameter
re - ESQL replaceable parameter
 o replaceAttrSelect
 public boolean replaceAttrSelect(Attribute attr,
                                  Attribute reattr)
replace Attributes in Select Clause.

Parameters:
attr - The Attribute to be replaced
reattr - The Substitute Attribute
Returns:
If replace successful (view evolvable) return true. That means for (f, t), all attributes can be replaced; otherwise, fail.
 o replaceAttrSelect
 public boolean replaceAttrSelect(Relation r,
                                  Replacement rep,
                                  boolean di,
                                  boolean re)
replace Attributes in Select clause.

Parameters:
r - the attribute's relation.
rep - Replace ment of this relation with hashtable of substitute attributes.
di - ESQL dispensable parameter
re - ESQL replaceable parameter
Returns:
If replace successfull (view evolvable) return true. That means for (f,t), all attributes should be replaced, otherwise, fail.
 o replaceCondWhere
 public boolean replaceCondWhere(Relation r,
                                 Replacement rep,
                                 boolean di,
                                 boolean re)
replace Attributes in the condition in the Where clause.

Parameters:
r - the attribute's relation.
rep - Replace ment of this relation with hashtable of substitute attributes.
di - ESQL dispensable parameter
re - ESQL replaceable parameter
Returns:
If replace successfull (view evolvable) return true. That means for (f,t), all attributes should be replaced, otherwise, fail.
 o attrSelect
 public Vector attrSelect(Relation r,
                          boolean di,
                          boolean re)
Get Attributes in Select Clause.

Parameters:
r - the attribute's relation
di - ESQL dispensable parameter
re - ESQL replaceable parameter
Returns:
a Vector of attributes satisfied the specifications.
 o attrWhere
 public Vector attrWhere(Relation r,
                         boolean di,
                         boolean re)
Get Attributes in Where Clause.

Parameters:
r - the attribute's relation
di - ESQL dispensable parameter
re - ESQL replaceable parameter
Returns:
a Vector of attributes satisfied the specifications.
 o VExtentoStr
 String VExtentoStr(int ext)
Return string representation of VExtent parameter

 o setName
 public void setName(String str)
Set View Definition's Name

 o setVExtent
 public void setVExtent(int ext)
Set VE parameter of this View Definition

 o setSelect
 public void setSelect(Vector clause)
Set Select Clause

 o setFrom
 public void setFrom(Vector clause)
Set From clause

 o setWhere
 public void setWhere(Condition_index clause)
Set Where clause

 o getESQL
 public String getESQL()
Get E-SQL of this view definition.

Returns:
E-SQL of this view definition.
 o getSQL
 public String getSQL()
Get SQL of this view definition without the IS information.

Returns:
SQL of this view definition.
 o getVExtent
 public int getVExtent()
 o getClause
 public Vector getClause(int type)
Get clause from this view definition.

Parameters:
type - type of clause. SELECT for SELECT clause, FROM for FROM clause, WHERE for WHERE clause. These are constants in this class.
Returns:
for type=SELECT: A vector of Attribute_Component.
 o getPSJList
 public Vector getPSJList(int type)
Get PSJ List of this View Definition.

Parameters:
type - type of PSJ list. PROJECT for PROJECT list, SELECT for SELECT list, JOIN for JOIN list.
Returns:
a vector of PSJ list.
 o getName
 public String getName()
Return view name.

 o getISs
 public Vector getISs()
Return vector of ISs of this VD. Return a vector of Information source names (in String format).

 o contains
 public boolean contains(String IS_name)
Descide whether VD contains some IS

Parameters:
IS_name - Information source name.
Returns:
true: VD has; false: VD hasn't
 o contains
 public boolean contains(Relation rel)
Descide whether VD contains some Relation

Parameters:
IS_name - Information source name.
Rel_name - Relation name.
Returns:
true: VD has; false: VD hasn't
 o from_get
 public Relation_Component from_get(Relation rel)
Get a Relation Component for specific Relation.

Parameters:
rel - the Relation
Returns:
if found, return RC reference, otherwise, null.
 o contains
 public boolean contains(Attribute attr)
Descide whether VD contains some Attribute.

Parameters:
IS_name - Information source name.
Rel_name - Relation name.
Attr_name - Attribute name.
Returns:
true: VD has; false: VD hasn't.
 o toString
 public String toString()
Debug Function show the View_Definition

Overrides:
toString in class Object
 o makeStrongest
 public void makeStrongest()
 o evolvable
 public boolean evolvable(Relation rel)
Check if this view is evolvable or not for a specific relation. It depends on theorem 1 in POC/SPOC paper. If this view is not evolvable, then all affected components are both indispensable and non-replaceable (false, false). We assume the View_Definition is in the strongest format.

 o evolvable
 public boolean evolvable(Attribute attr)
Similar to evolvable for del_relation. Under same assumption, we only need to check the FROM clause.

 o clone
 public Object clone()
Clone the view definition. Need to be implemented.

Overrides:
clone in class Object
 o replaceRelFrom
 public void replaceRelFrom(Relation r,
                            Relation s)
Replace relation at From clause.

Parameters:
r - relation to be replaced.
s - substitute relation.
 o dropComponents
 public void dropComponents(Vector s)
Drop a vector of components from one view definition.

 o getDispensableComponent
 public Vector getDispensableComponent()
Get Dispensable components of one view defintion.

 o getRelComponent
 Relation_Component getRelComponent(Relation r)
Get Relation_Component for specific Relation.

Parameters:
r - Reference of Relation in MKB
Returns:
Relation Component in FROM clause of View; null not found.
 o getCondComponents
 public Vector getCondComponents(Attribute a)
Get Condition_Component for specific Attribute.

Parameters:
a - Reference of Attribute in MKB
Returns:
a vector of Condition_Component which contains the attribute.
 o getAttrComponent
 public Attribute_Component getAttrComponent(Attribute attr)
Get an Attribute_Component from select clause for specific attribute

Parameters:
attr - The reference of attribute.
Returns:
the Attribute Component; not found return null
 o get
 Attribute_Component get(Vector sec,
                         Attribute attr)
Get an Attribute Component from a vector of attribute_components clause for specific Attribute.

Parameters:
vec - the vector of Attribute Components.
attr - The reference of attribute.
Returns:
the Attribute Component; not found return null
 o dropAttrSelect
 public void dropAttrSelect(Vector attrs)
Drop attribute-components from Select clause for specific vector of attributes

Parameters:
attrs - Vector of attributes
 o addRelFrom
 public void addRelFrom(Relation r)
Add Relation to from clause of the View Definition.

Parameters:
r - Reference of relation to be added.
 o addJCs
 public void addJCs(Vector jcs)
Add a Vector of JCs to the View Definition. Here I haven't considering the correctness of Join_Conditions. The default parameter for it is: true, true.

Parameters:
jcs - A Vector of Join Conditions
 o replaceAttrWhere
 public void replaceAttrWhere(Attribute attr,
                              Attribute reattr)
Replace attribute in the Where clause.

Parameters:
attr - Attribute to be replaced.
reattr - Substitute Attribute.
 o getComponents
 public Vector getComponents(Relation rel)
Get all components of one Relation

Parameters:
rel - the specific Relation.
Returns:
a Vector of components or a empty vector
 o getAttributes
 public Vector getAttributes(Relation rel)
Get all attributes of one Relation of this View. It will contains all the attributes in the SELECT clause, and all the attributes in the JOIN Condition of the WHERE clause.

Parameters:
rel - the specific Relation.
Returns:
a Vector of unique attributes or a empty vector

All Packages  Class Hierarchy  This Package  Previous  Next  Index