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
- Parse E-SQL
- Parse SQL
- Generate Strongest E-SQL ref: TR-98-4 P20~P23
- Generate SQL
- Get Clause of SELECT, FROM, and WHERE
-
DEBUG
-
-
DONTCARE
- VE is DONTCARE
-
EQUIVALENT
- VE is EQUIVALENT
-
from
- Vector of FROM clause.
-
FROM
- FROM clause constant
-
JOIN
- JOIN list constant
-
name
- Name of this ViewDefinition.
-
PROJECT
- PROJECT list constant
-
SELECT
- SELECT here has two meaning.
-
select
- it will keep the order of the select clause.
-
SUBSET
- VE is SUBSET.
-
SUPERSET
- VE is SUPERSET
-
versions
- A Vector of Versions of this View-Definition.
-
VExtent
- VE parameter of this View Definition
-
where
- Vector of Condition clause.
-
WHERE
- WHERE clause constant
-
View_Definition()
- Default construction.
-
View_Definition(String, MKB)
- Parse E-SQL/SQL String and create the View definition object.
-
addJCs(Vector)
- Add a Vector of JCs to the View Definition.
-
addRelFrom(Relation)
- Add Relation to from clause of the View Definition.
-
attrSelect(Relation, boolean, boolean)
- Get Attributes in Select Clause.
-
attrWhere(Relation, boolean, boolean)
- Get Attributes in Where Clause.
-
clean()
- Clean the View Definition:
1.
-
clone()
- Clone the view definition.
-
contains(Attribute)
- Descide whether VD contains some Attribute.
-
contains(Relation)
- Descide whether VD contains some Relation
-
contains(String)
- Descide whether VD contains some IS
-
dropAttrSelect(Relation, boolean, boolean)
- Drop Attributes from Select clause of this view definition.
-
dropAttrSelect(Vector)
- Drop attribute-components from Select clause for specific vector of attributes
-
dropComponents(Vector)
- Drop a vector of components from one view definition.
-
dropCondWhere(Relation, boolean, boolean)
- Drop Conditions from Where clause of this view definition.
-
evolvable(Attribute)
- Similar to evolvable for del_relation.
-
evolvable(Relation)
- Check if this view is evolvable or not for a specific relation.
-
from_get(Relation)
- Get a Relation Component for specific Relation.
-
get(Vector, Attribute)
- Get an Attribute Component from a vector of attribute_components clause for specific Attribute.
-
getAttrComponent(Attribute)
- Get an Attribute_Component from select clause for specific attribute
-
getAttributes(Relation)
- Get all attributes of one Relation of this View.
-
getClause(int)
- Get clause from this view definition.
-
getComponents(Relation)
- Get all components of one Relation
-
getCondComponents(Attribute)
- Get Condition_Component for specific Attribute.
-
getDispensableComponent()
- Get Dispensable components of one view defintion.
-
getESQL()
- Get E-SQL of this view definition.
-
getISs()
- Return vector of ISs of this VD.
-
getName()
- Return view name.
-
getPSJList(int)
- Get PSJ List of this View Definition.
-
getRelComponent(Relation)
- Get Relation_Component for specific Relation.
-
getSQL()
- Get SQL of this view definition without the IS information.
-
getVersions()
- return the vector of all versions of this view after view
synchronization.
-
getVExtent()
-
-
makeStrongest()
-
-
replaceAttrSelect(Attribute, Attribute)
- replace Attributes in Select Clause.
-
replaceAttrSelect(Relation, Replacement, boolean, boolean)
- replace Attributes in Select clause.
-
replaceAttrWhere(Attribute, Attribute)
- Replace attribute in the Where clause.
-
replaceCondWhere(Relation, Replacement, boolean, boolean)
- replace Attributes in the condition in the Where clause.
-
replaceRelFrom(Relation, Relation)
- Replace relation at From clause.
-
setFrom(Vector)
- Set From clause
-
setName(String)
- Set View Definition's Name
-
setSelect(Vector)
- Set Select Clause
-
setVersions(Vector)
- Set a list of versions of rewritings of this View_Definition by VSA.
-
setVExtent(int)
- Set VE parameter of this View Definition
-
setWhere(Condition_index)
- Set Where clause
-
toString()
- Debug Function show the View_Definition
-
VExtentoStr(int)
- Return string representation of VExtent parameter
DEBUG
private static final boolean DEBUG
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.
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.
FROM
public static final int FROM
- FROM clause constant
WHERE
public static final int WHERE
- WHERE clause constant
PROJECT
public static final int PROJECT
- PROJECT list constant
JOIN
public static final int JOIN
- JOIN list constant
SUBSET
public static final int SUBSET
- VE is SUBSET.
SUPERSET
public static final int SUPERSET
- VE is SUPERSET
EQUIVALENT
public static final int EQUIVALENT
- VE is EQUIVALENT
DONTCARE
public static final int DONTCARE
- VE is DONTCARE
name
String name
- Name of this ViewDefinition.
VExtent
int VExtent
- VE parameter of this View Definition
select
Vector select
- it will keep the order of the select clause. It stores a vector of Attribute_Component
from
Vector from
- Vector of FROM clause.
The elements are objects of class Relation_Component.
where
Condition_index where
- Vector of Condition clause.
It's a list of conditions. Each elememt is an object of Condition_Component.
View_Definition
public View_Definition()
- Default construction.
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.
setVersions
public void setVersions(Vector vs)
- Set a list of versions of rewritings of this View_Definition by VSA.
- Parameters:
- A - Vector of Version.
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.
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.
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
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
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.
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.
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.
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.
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.
VExtentoStr
String VExtentoStr(int ext)
- Return string representation of VExtent parameter
setName
public void setName(String str)
- Set View Definition's Name
setVExtent
public void setVExtent(int ext)
- Set VE parameter of this View Definition
setSelect
public void setSelect(Vector clause)
- Set Select Clause
setFrom
public void setFrom(Vector clause)
- Set From clause
setWhere
public void setWhere(Condition_index clause)
- Set Where clause
getESQL
public String getESQL()
- Get E-SQL of this view definition.
- Returns:
- E-SQL of this view definition.
getSQL
public String getSQL()
- Get SQL of this view definition without the IS information.
- Returns:
- SQL of this view definition.
getVExtent
public int getVExtent()
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.
getPSJList
public Vector getPSJList(int type)
- Get PSJ List of this View Definition.
- The projection list is same as select list
- The select list is local condition from where list
- The join list is join condition from where list
- Parameters:
- type - type of PSJ list. PROJECT for PROJECT list, SELECT for SELECT list, JOIN for JOIN list.
- Returns:
- a vector of PSJ list.
getName
public String getName()
- Return view name.
getISs
public Vector getISs()
- Return vector of ISs of this VD.
Return a vector of Information source names (in String format).
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
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
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.
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.
toString
public String toString()
- Debug Function show the View_Definition
- Overrides:
- toString in class Object
makeStrongest
public void makeStrongest()
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.
evolvable
public boolean evolvable(Attribute attr)
- Similar to evolvable for del_relation. Under same assumption,
we only need to check the FROM clause.
clone
public Object clone()
- Clone the view definition.
Need to be implemented.
- Overrides:
- clone in class Object
replaceRelFrom
public void replaceRelFrom(Relation r,
Relation s)
- Replace relation at From clause.
- Parameters:
- r - relation to be replaced.
- s - substitute relation.
dropComponents
public void dropComponents(Vector s)
- Drop a vector of components from one view definition.
getDispensableComponent
public Vector getDispensableComponent()
- Get Dispensable components of one view defintion.
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.
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.
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
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
dropAttrSelect
public void dropAttrSelect(Vector attrs)
- Drop attribute-components from Select clause for specific vector of attributes
- Parameters:
- attrs - Vector of attributes
addRelFrom
public void addRelFrom(Relation r)
- Add Relation to from clause of the View Definition.
- Parameters:
- r - Reference of relation to be added.
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
replaceAttrWhere
public void replaceAttrWhere(Attribute attr,
Attribute reattr)
- Replace attribute in the Where clause.
- Parameters:
- attr - Attribute to be replaced.
- reattr - Substitute Attribute.
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
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