DSRG.VKB
Class VKB

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

public class VKB
extends java.lang.Object
implements java.io.Serializable, VSA_VKB

This VKB class represents the VKB of EVE system.
It stores a hashtable of View_index.
We find the view definitiosn by name is by traverse

List of Functions VKB should provide

VKB should help VSA in the view synchronization. Now, in VSA we can do following schema evolutions:

I put some feature to MKB to let it help us do the Change Name functions. I do that by putting a reference of that object in MKB at every place where need a name. That's makes the changing name functions simple, but that increase the coupling between MKB and VKB. The reason why I select this strategy is that the Changing Name functions will affect both MKB and VKB anyway. That means, If we seperate the storage of name in the MKB and VKB, we still need another function to call both parts to change name synchronized. That will need a lot of more work. As well, because I specify the VKB/MKB interface in "interface" VKB_MKB, we can easily know how can VKB access MKB. Sure, if we want to use Relation and Attribute classes in MKB, we need to know the knowledge of them. I think that's the only drawback.

I try to do all the class design to help us make the implementation extendable. So, if in the future MKB needs to be changed, and that change will affect the Relation and Attribute classes in MKB, like MKB change its structure to keep the history, we just need to remain the same interface between VKB and those classes, then everything should be fine. I need to define another two interfaces between VKB and Relation and Attribute.

See Also:
View_Definition, Serialized Form

Field Summary
(package private)  MKB mkb
          The reference of MKB this VKB based on.
(package private)  java.util.Hashtable View_index
          Index of view definition on View Name.
 
Constructor Summary
VKB()
          Default constructor.
VKB(java.lang.String ESQL_file, MKB ref)
          Parse E-SQL/SQL String and create the VKB object.
 
Method Summary
 void addViewDefinition(View_Definition newVD)
          Add one view definition to this VKB It will affect the index structure.
 void changeAttributeName(java.lang.String IS_name, java.lang.String Rel_name, java.lang.String Attr_name, java.lang.String new_name)
          This function will call MKB to change the specific attribute.
 void changeRelationName(java.lang.String IS_name, java.lang.String Rel_name, java.lang.String new_name)
          This function will call MKB to change the specific relation.
 void dropSetOfVDs(java.util.Vector VDs)
          Drop a vector of view definitions specified by Vector VDs.
 void dropViewDefinition(java.lang.String viewName)
          Remove one view definition from this VKB with specific view name.
 void dropViewDefinition(View_Definition view)
          Remove one view definition from this VKB.
 java.lang.String getESQL(java.lang.String viewName)
          returns the E-SQl definition fo the view with the given name
 MKB getMKB()
          Get the MKB of this VKB
 java.lang.String getSQL(java.lang.String viewName)
          returns the SQl definition fo the view with the given name
 View_Definition getVD(java.lang.String view_name)
          Get View Definition for a View of a specific name
 java.util.Vector getViewDefinitions(java.lang.String IS_name)
          Get a vector of ViewDefinitions mentioning a specific Information Source (IS) name.
 java.util.Vector getViewDefinitions(java.lang.String IS_name, java.lang.String Rel_name)
          Get a vector of all ViewDefinitions mentioning a Relation of a specific Relation Name.
 java.util.Vector getViewDefinitions(java.lang.String IS_name, java.lang.String Rel_name, java.lang.String Attr_name)
          Get a vector of ViewDefinitions mentioning an Attribute of the given name.
 java.util.Vector getViewNames()
          Get a Vector of ViewNames in this VKB
 void replaceViewDefinition(View_Definition V, View_Definition bestV)
          Replace view V with bestV.
 void setMKB(MKB ref)
          Set the MKB of this VKB
 void setViewIndex(java.util.Hashtable index)
          Set View_Index Hashtable of this VKB
 java.lang.String toString()
          Display VKB in ESQL mode
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

View_index

java.util.Hashtable View_index
Index of view definition on View Name.

mkb

MKB mkb
The reference of MKB this VKB based on.
Constructor Detail

VKB

public VKB()
Default constructor.

VKB

public VKB(java.lang.String ESQL_file,
           MKB ref)
Parse E-SQL/SQL String and create the VKB object.
Parameters:
ESQL_file - E-SQL/SQL of this VKB/ or a file name
ref - MKB of this VKB depends on
Method Detail

getMKB

public MKB getMKB()
Get the MKB of this VKB

setMKB

public void setMKB(MKB ref)
Set the MKB of this VKB

replaceViewDefinition

public void replaceViewDefinition(View_Definition V,
                                  View_Definition bestV)
Replace view V with bestV. This is the place to update the view definition after selection. MAYA
Specified by:
replaceViewDefinition in interface VSA_VKB

setViewIndex

public void setViewIndex(java.util.Hashtable index)
Set View_Index Hashtable of this VKB
Parameters:
index - New index of view definitions

addViewDefinition

public void addViewDefinition(View_Definition newVD)
Add one view definition to this VKB

It will affect the index structure. We need to re-index the View definition.


dropViewDefinition

public void dropViewDefinition(java.lang.String viewName)
Remove one view definition from this VKB with specific view name.

It will affect the index structure. We need to re-index the View definition.


dropViewDefinition

public void dropViewDefinition(View_Definition view)
Remove one view definition from this VKB.

It will affect the index structure. We need to re-index the View definition.


dropSetOfVDs

public void dropSetOfVDs(java.util.Vector VDs)
Drop a vector of view definitions specified by Vector VDs.
Specified by:
dropSetOfVDs in interface VSA_VKB

getViewDefinitions

public java.util.Vector getViewDefinitions(java.lang.String IS_name)
Get a vector of ViewDefinitions mentioning a specific Information Source (IS) name.
Returns:
null: No View Definition affected by this IS, Vector: View Definitions affected by this IS.

getViewDefinitions

public java.util.Vector getViewDefinitions(java.lang.String IS_name,
                                           java.lang.String Rel_name)
Get a vector of all ViewDefinitions mentioning a Relation of a specific Relation Name.
Specified by:
getViewDefinitions in interface VSA_VKB
Parameters:
IS_name - Information Source Name
Rel_name - Relation Name
Returns:
null: No View Definition affected, Vector: View Definitions affected by relation

getViewDefinitions

public java.util.Vector getViewDefinitions(java.lang.String IS_name,
                                           java.lang.String Rel_name,
                                           java.lang.String Attr_name)
Get a vector of ViewDefinitions mentioning an Attribute of the given name.
Specified by:
getViewDefinitions in interface VSA_VKB
Parameters:
IS_name - Information Source Name
Rel_name - Relation Name
Attr_name - Attribute Name
Returns:
null: No View Definition affected, Vector: View Definitions affected by attribute

getESQL

public java.lang.String getESQL(java.lang.String viewName)
returns the E-SQl definition fo the view with the given name
Parameters:
viewName - the name of the view to be queried
Returns:
E-SQL view definition or empty String object

getSQL

public java.lang.String getSQL(java.lang.String viewName)
returns the SQl definition fo the view with the given name
Parameters:
viewName - the name of the view to be queried
Returns:
SQL view definition or empty String object

getVD

public View_Definition getVD(java.lang.String view_name)
Get View Definition for a View of a specific name
Parameters:
view_name - name of view definition
Returns:
View_Definition or null.

changeAttributeName

public void changeAttributeName(java.lang.String IS_name,
                                java.lang.String Rel_name,
                                java.lang.String Attr_name,
                                java.lang.String new_name)
This function will call MKB to change the specific attribute. It will change all the view_components in all view definitions in VKB from one attribute name to another name.

It's different from make one attribute_component in one view_definition reference to another attribute, which will only change one attribute_component of one view_definition.

Parameters:
IS_name - Information Source Name
Rel_name - Relation Name
Attr_name - Attribute Name
new_name - New attribute Name

changeRelationName

public void changeRelationName(java.lang.String IS_name,
                               java.lang.String Rel_name,
                               java.lang.String new_name)
This function will call MKB to change the specific relation. It will change all hte view_components in all view definitions in VKB from one relation name to another name.

It's means it will also affect the attribute_component and condition_component.

Parameters:
IS_name - Information Source Name
Rel_name - Relation Name
new_name - New Relation Name

getViewNames

public java.util.Vector getViewNames()
Get a Vector of ViewNames in this VKB
Returns:
null no view stores; else return a vector of view names.

toString

public java.lang.String toString()
Display VKB in ESQL mode
Overrides:
toString in class java.lang.Object