edu.udo.cs.miningmart.m4
Interface Columnset

All Superinterfaces:
M4Data, M4Object
All Known Implementing Classes:
Columnset

public interface Columnset
extends M4Data

Version:
$Id: Columnset.java,v 1.13 2006/09/27 14:59:58 euler Exp $
Author:
Timm Euler, Daniel Hakenjos

Field Summary
static java.lang.String CS_TYPE_TABLE
          DB level: String constant used in the DB to indicate that this columnset is a table
static java.lang.String CS_TYPE_VIEW
          DB level: String constant used in the DB to indicate that this columnset is a view
static long THRESHOLD_FOR_SAMPLING
          A constant threshold to decide if computation of statistics is done on a sample or on the whole columnset.
static java.lang.String TYPE_MATERIALIZED_VIEW
           
static java.lang.String TYPE_SNAPSHOT
           
static java.lang.String TYPE_TABLE
           
static java.lang.String TYPE_VIEW
           
 
Method Summary
 void addColumn(Column c)
          Add a column to this columnset's columns.
 void addMultiStepBranch(java.lang.String branch)
           
 void addMultiStepBranchInfo(java.lang.String oldDef, java.lang.String attribute, java.lang.String value)
          Adds an attribute-value pair to the MultiStepBranch field if the attribute isn't already present there.
 void clearStatistics()
          If data changes in the database, e.g. a DB Concept is edited, then this method allows to delete the deprecated statistics objects without running a garbage collection.
 Columnset copy(Concept newConcept)
           
 Column createColumn(java.lang.String name, java.lang.String datatype)
          Creates a Column that will be connected to this ColumnSet.
 void createColumnsFromDbObject(java.lang.String nameOfTableOrView)
          Creates an M4 Column for every column of the table or view with the given name, and connects it to this Columnset.
 ForeignKey createForeignKeyWhereThisIsFkCs(java.lang.String name)
          Creates a ForeignKey.
 PrimaryKey createPrimaryKey(java.lang.String name)
          Creates a PrimaryKey.
 Column getColumn(int index)
          Get a specific column.
 Column getColumn(java.lang.String columnName)
           
 java.util.Collection getColumns()
           
 java.lang.String getCompleteSQLQuery()
          This method returns a complete SQL query, which can be used to get the data as represented by this Columnset.
 java.lang.String getCompleteSQLQuery(java.lang.String rowNumName)
          This method returns a complete SQL query, which can be used to get the data as represented by this Columnset.
 java.util.Collection getConnectableColumns()
          This method returns a collection of Column objects, which represent the columns of the database table or view that is represented by this Columnset.
 java.util.Collection getForeignKeysWhereThisIsFkCs()
          Active getter for the Key objects referencing to this Columnset as their forein key.
 ForeignKey getForeignKeyWhereThisIsFkCs(java.lang.String keyName)
           
 java.lang.String getMsbInfoWithoutAttrib(java.lang.String attributeName)
           
 java.lang.String getMSBranchSelectionValue(java.lang.String attributeName)
          Scans the MultiStepBranch information of the Columnset for attributeName=Value; and returns the corresponding value, null otherwise.
 java.lang.String getMultiStepBranch()
           
 PrimaryKey getPrimaryKey()
           
 Relation getRelation()
          Returns the Relation in which this Columnset realizes the cross table, if there is such a Relation.
 java.lang.String getSchema()
           
 java.lang.String getSchemaPlusName()
           
 java.lang.String getSQLDefinition()
           
 java.util.Collection getStatistics()
          Active getter for the ColumnsetStatistics of this Columnset.
 long getStatisticsAll()
          Getter method.
 int getStatisticsNominal()
          Getter method.
 int getStatisticsOrdinal()
          Getter method.
 int getStatisticsTime()
          Getter method.
 Concept getTheConcept()
           
 java.lang.String getType()
           
 boolean hasColumn(Column col)
           
 java.lang.String readOrComputeCount()
          Reads, or computes and inserts into the statistics table, the number of rows of this ColumnSet and returns it as a string.
 void removeAllColumns()
           
 void removeAllForeignKeys()
          Removes all ForeignKeys from this ColumnSet.
 boolean removeColumn(Column column)
          Remove a column from this Columnsets's columns.
 void removeForeignKeyWhereThisIsFkCs(java.lang.String name)
          Removes the specified ForeignKey for this ColumnSet.
 void removePrimaryKey()
          Removes the specified PrimaryKey for this ColumnSet.
 void setColumn(int index, Column c)
          Set a specific column.
 void setColumns(java.util.Collection theColumns)
          Set all columns of this columnset.
 void setMultiStepBranch(java.lang.String branchDefinition)
          Set the information about the multistep branch.
 void setPrimaryKey(PrimaryKey primaryKey)
           
 void setRelation(Relation newRelation)
          Sets the connection to a Relation.
 void setSchema(java.lang.String s)
          Set the database schema where the table or view that this columnset refers to lives.
 void setSQLDefinition(java.lang.String sqlDefinition)
          Set the sql definition.
 void setStatistics(java.util.Collection theStats)
          Setter method.
 void setStatisticsAll(long sa)
          Setter method.
 void setStatisticsNominal(int sn)
          Setter method.
 void setStatisticsOrdinal(int so)
          Setter method.
 void setStatisticsTime(int st)
          Setter method.
 void setTheConcept(Concept c)
          Set this columnset's concept.
 void setType(java.lang.String t)
          Set the type of this columnset (table or view).
 boolean statisticsExist()
          Checks if any statistics for this columnset have been computed.
 void updateStatistics()
          Executes several SQL procedure queries to calculate statistical information for the given columnset on demand.
 void updateStatisticsBasedOnSample(long sampleSize)
          Similar to updateStatistics, but it uses a sample of the data of this Columnset to determine the statistics.
 
Methods inherited from interface edu.udo.cs.miningmart.m4.M4Data
deleteSoon, getDocumentation, getValidName, isDirty, isWaitingForDelete, setDocumentation
 
Methods inherited from interface edu.udo.cs.miningmart.m4.M4Object
doPrint, doPrint, equals, executeBusinessSingleValueSqlRead, executeBusinessSingleValueSqlReadL, executeBusinessSqlRead, executeBusinessSqlWrite, executeM4SingleValueSqlRead, executeM4SingleValueSqlReadL, executeM4SqlRead, executeM4SqlWrite, getCasePrintObject, getId, getM4Db, getM4ObjectFromCache, getName, getNextM4SequenceValue, isNew, load, print, putM4ObjectToCache, replaceSpacesInName, setId, setName, setNotNew
 

Field Detail

CS_TYPE_TABLE

static final java.lang.String CS_TYPE_TABLE
DB level: String constant used in the DB to indicate that this columnset is a table

See Also:
Constant Field Values

CS_TYPE_VIEW

static final java.lang.String CS_TYPE_VIEW
DB level: String constant used in the DB to indicate that this columnset is a view

See Also:
Constant Field Values

THRESHOLD_FOR_SAMPLING

static final long THRESHOLD_FOR_SAMPLING
A constant threshold to decide if computation of statistics is done on a sample or on the whole columnset.

See Also:
StatisticsDialog, Constant Field Values

TYPE_TABLE

static final java.lang.String TYPE_TABLE
See Also:
Constant Field Values

TYPE_VIEW

static final java.lang.String TYPE_VIEW
See Also:
Constant Field Values

TYPE_SNAPSHOT

static final java.lang.String TYPE_SNAPSHOT
See Also:
Constant Field Values

TYPE_MATERIALIZED_VIEW

static final java.lang.String TYPE_MATERIALIZED_VIEW
See Also:
Constant Field Values
Method Detail

setTheConcept

void setTheConcept(Concept c)
                   throws M4Exception
Set this columnset's concept.

Parameters:
c - the Concept this ColumnSet belongs to
Throws:
M4Exception

getTheConcept

Concept getTheConcept()
Returns:
the Concept this ColumnSet belongs to

setSchema

void setSchema(java.lang.String s)
Set the database schema where the table or view that this columnset refers to lives.

Parameters:
s - the schema name

getSchema

java.lang.String getSchema()
Returns:
the name of the database schema where the table or view that this columnset refers to lives

getSchemaPlusName

java.lang.String getSchemaPlusName()
Returns:
The name only, or "schema"."name" if the "schema" is known.

setType

void setType(java.lang.String t)
             throws M4Exception
Set the type of this columnset (table or view). Use one of the public constants of this class, either CS_TYPE_TABLE or CS_TYPE_VIEW.

Parameters:
t - A String constant, either Columnset.CS_TYPE_TABLE or Columnset.CS_TYPE_VIEW
Throws:
M4Exception

getType

java.lang.String getType()
Returns:
A String constant, either Columnset.CS_TYPE_TABLE or Columnset.CS_TYPE_VIEW

setSQLDefinition

void setSQLDefinition(java.lang.String sqlDefinition)
Set the sql definition.

Parameters:
sqlDefinition - the new definition A value of null indicates that there is no explicit SQL definition, but that the name of the table or view is its defintion at the same time. If the sqlDefinition is null then the method getSQLDefinition() will return getSchemaPlusName().

getSQLDefinition

java.lang.String getSQLDefinition()
Returns:
the sql definition of this columnset, if not set explicitly then getSchemaPlusName(). Never returns null.

getCompleteSQLQuery

java.lang.String getCompleteSQLQuery()
                                     throws M4Exception
This method returns a complete SQL query, which can be used to get the data as represented by this Columnset. In contrast to the method getSQLDefinition() this method does also include virtual columns, which are sometimes not visible at the level of the Columnset's SQL definition.

Returns:
an SQL string like SELECT <SQLDefinition of Column1> <Name of Column1> , ... <SQLDefinition of Columnn> <Name of Columnn> FROM <SQLDefintion of the Columnset>
Throws:
M4Exception

getCompleteSQLQuery

java.lang.String getCompleteSQLQuery(java.lang.String rowNumName)
                                     throws M4Exception
This method returns a complete SQL query, which can be used to get the data as represented by this Columnset. The difference to the same method without the additional parameter is, that this method allows to specify a target attribute name for the internal Oracle attribute ROWNUM

Parameters:
rowNumName - the target attribute name of the ROWNUM attribute
Returns:
an SQL string like SELECT ROWNUM AS <rowNumName>, <SQLDefinition of Column1> <Name of Column1> , ... <SQLDefinition of Columnn> <Name of Columnn> FROM <SQLDefintion of the Columnset>
Throws:
M4Exception
See Also:
Columnset.getCompleteSQLQuery

setMultiStepBranch

void setMultiStepBranch(java.lang.String branchDefinition)
Set the information about the multistep branch.

Parameters:
branchDefinition - The new branch information

getMultiStepBranch

java.lang.String getMultiStepBranch()
Returns:
the information about the multistep branch.

addMultiStepBranchInfo

void addMultiStepBranchInfo(java.lang.String oldDef,
                            java.lang.String attribute,
                            java.lang.String value)
                            throws M4Exception
Adds an attribute-value pair to the MultiStepBranch field if the attribute isn't already present there.

Parameters:
oldDef - The multistep branch information so far
attribute - The attribute
the - value for the attribute
Throws:
M4Exception

addMultiStepBranch

void addMultiStepBranch(java.lang.String branch)
                        throws M4Exception
Parameters:
branch - A complete field CS_MSBRANCH as found in table COLUMNSET_T. It is added to the CS_MSBRANCH of this object via addMultiStepBranchInfo.
Throws:
M4Exception

setColumns

void setColumns(java.util.Collection theColumns)
                throws M4Exception
Set all columns of this columnset.

Parameters:
theColumns - Collection of the new set of column objects
Throws:
M4Exception

hasColumn

boolean hasColumn(Column col)
                  throws M4Exception
Parameters:
col - a Column
Returns:
true if a column with the same ID is already linked to this Columnset
Throws:
M4Exception

getColumns

java.util.Collection getColumns()
                                throws M4Exception
Returns:
all columns of this columnset in a collection
Throws:
M4Exception

getConnectableColumns

java.util.Collection getConnectableColumns()
                                           throws M4Exception
This method returns a collection of Column objects, which represent the columns of the database table or view that is represented by this Columnset. It may thus happen that not all of the returned Columns have a BaseAttribute, but all can be connected to one.

Returns:
a Collection of Column objects representing the columns of the underlying database table or view
Throws:
M4Exception

setColumn

void setColumn(int index,
               Column c)
               throws M4Exception
Set a specific column. This method is to be used with care! At several occasions it is assumed, that each Column is entered just once in a Collection and entering null values might also be problematic!

Parameters:
index - number of the Column
c - Column to be set
Throws:
M4Exception

getColumn

Column getColumn(int index)
                 throws M4Exception
Get a specific column.

Parameters:
index - number of the Column
Returns:
Column at this index
Throws:
M4Exception

getForeignKeysWhereThisIsFkCs

java.util.Collection getForeignKeysWhereThisIsFkCs()
                                                   throws M4Exception
Active getter for the Key objects referencing to this Columnset as their forein key.

Returns:
a Collection of Key objects
Throws:
M4Exception

getStatistics

java.util.Collection getStatistics()
                                   throws M4Exception
Active getter for the ColumnsetStatistics of this Columnset.

Returns:
a Collection of ColumnsetStatistics objects, never null.
Throws:
M4Exception

setStatistics

void setStatistics(java.util.Collection theStats)
                   throws M4Exception
Setter method.

Throws:
M4Exception

setStatisticsAll

void setStatisticsAll(long sa)
                      throws M4Exception
Setter method.

Parameters:
sa - the new value
Throws:
M4Exception

getStatisticsAll

long getStatisticsAll()
                      throws M4Exception
Getter method.

Returns:
the value
Throws:
M4Exception

setStatisticsNominal

void setStatisticsNominal(int sn)
                          throws M4Exception
Setter method.

Parameters:
sn - the new value
Throws:
M4Exception

getStatisticsNominal

int getStatisticsNominal()
                         throws M4Exception
Getter method.

Returns:
the value
Throws:
M4Exception

setStatisticsOrdinal

void setStatisticsOrdinal(int so)
                          throws M4Exception
Setter method.

Parameters:
so - the new value
Throws:
M4Exception

getStatisticsOrdinal

int getStatisticsOrdinal()
                         throws M4Exception
Getter method.

Returns:
the value
Throws:
M4Exception

setStatisticsTime

void setStatisticsTime(int st)
                       throws M4Exception
Setter method.

Parameters:
st - the new value
Throws:
M4Exception

getStatisticsTime

int getStatisticsTime()
                      throws M4Exception
Getter method.

Returns:
the value
Throws:
M4Exception

addColumn

void addColumn(Column c)
               throws M4Exception
Add a column to this columnset's columns.

Parameters:
c - the additional column
Throws:
M4Exception

removeColumn

boolean removeColumn(Column column)
                     throws M4Exception
Remove a column from this Columnsets's columns.

Parameters:
c - The new column.
Returns:
true if removing succeeded
Throws:
M4Exception

removeAllColumns

void removeAllColumns()
                      throws M4Exception
Throws:
M4Exception

getMSBranchSelectionValue

java.lang.String getMSBranchSelectionValue(java.lang.String attributeName)
                                           throws M4Exception
Scans the MultiStepBranch information of the Columnset for attributeName=Value; and returns the corresponding value, null otherwise. The attribute name is compared in a case insensitive way and it is assumed that exactly the format above is used. Each attribute value pair needs to be terminated by a ';', no whitespaces in between! If this assumption does not hold parsing might throw an exception.

Parameters:
attributeName - The name of the BaseAttribute or pseudo-attribute (e.g. (Random)) for which the value should be read from the CS_MSBRANCH field.
Returns:
the value, if found, null otherwise.
Throws:
M4Exception

getMsbInfoWithoutAttrib

java.lang.String getMsbInfoWithoutAttrib(java.lang.String attributeName)
                                         throws M4Exception
Parameters:
attributename - The name of a BaseAttribute or a pseudoattribute which potentially occurs in the MultiStepBranch information attached to the Columnset.
Returns:
the MultiStepBranch-String omitting the equation for the given attribute. If the attribute does not occur, the complete String is returned. Note that an attribute is expected to occur at most once in the MultiStepBranch-String, because multiple occurences are redundant or result in an empty Columnset.
Throws:
M4Exception, - if the attributeName occurs in the String, but the substring is not properly ended by the character ';'.
M4Exception

readOrComputeCount

java.lang.String readOrComputeCount()
                                    throws M4Exception
Reads, or computes and inserts into the statistics table, the number of rows of this ColumnSet and returns it as a string.

Returns:
the number of rows in the columnset as a String
Throws:
M4Exception

updateStatistics

void updateStatistics()
                      throws M4Exception
Executes several SQL procedure queries to calculate statistical information for the given columnset on demand. The result is written to the table CSSTATIST_T and the JAVA cache is updated. Statistics already available are not recomputed. Finally an update for the statistics of all the Columns of this Columnset is performed.

Throws:
M4Exception

updateStatisticsBasedOnSample

void updateStatisticsBasedOnSample(long sampleSize)
                                   throws M4Exception
Similar to updateStatistics, but it uses a sample of the data of this Columnset to determine the statistics. This is done to speed up the computation of statistics, if exact statistics are not needed.

Parameters:
sampleSize - the maximum size of the sample to be used
Throws:
M4Exception

clearStatistics

void clearStatistics()
                     throws M4Exception
If data changes in the database, e.g. a DB Concept is edited, then this method allows to delete the deprecated statistics objects without running a garbage collection.

Throws:
M4Exception

statisticsExist

boolean statisticsExist()
                        throws M4Exception
Checks if any statistics for this columnset have been computed.

Returns:
Throws:
M4Exception

getRelation

Relation getRelation()
                     throws M4Exception
Returns the Relation in which this Columnset realizes the cross table, if there is such a Relation.

Returns:
Relation The Relation or null
Throws:
M4Exception

setRelation

void setRelation(Relation newRelation)
                 throws M4Exception
Sets the connection to a Relation. This can be used if this Columnset realizes the cross table of a Relation.

Parameters:
newRelation - The Relation to set
Throws:
M4Exception

createColumn

Column createColumn(java.lang.String name,
                    java.lang.String datatype)
                    throws M4Exception
Creates a Column that will be connected to this ColumnSet. The name of the Column must be unique for this ColumnSet.

Throws:
CreateException - when an error occurs during creation of the object.
NameExistsException - when the provided name already exists.
M4Exception

createColumnsFromDbObject

void createColumnsFromDbObject(java.lang.String nameOfTableOrView)
                               throws M4Exception
Creates an M4 Column for every column of the table or view with the given name, and connects it to this Columnset.

Parameters:
nameOfTableOrView - name of the table or view
Throws:
M4Exception

getColumn

Column getColumn(java.lang.String columnName)
                 throws M4Exception
Throws:
M4Exception

createForeignKeyWhereThisIsFkCs

ForeignKey createForeignKeyWhereThisIsFkCs(java.lang.String name)
                                           throws M4Exception
Creates a ForeignKey. The name of the Key must be unique within the ColumnSet.

Throws:
M4Exception

getForeignKeyWhereThisIsFkCs

ForeignKey getForeignKeyWhereThisIsFkCs(java.lang.String keyName)
                                        throws M4Exception
Throws:
M4Exception

removeForeignKeyWhereThisIsFkCs

void removeForeignKeyWhereThisIsFkCs(java.lang.String name)
                                     throws M4Exception
Removes the specified ForeignKey for this ColumnSet. It is also removed from the M4 Schema.

Throws:
M4Exception

removeAllForeignKeys

void removeAllForeignKeys()
                          throws M4Exception
Removes all ForeignKeys from this ColumnSet. They are removed from the M4 Schema.

Throws:
M4Exception

createPrimaryKey

PrimaryKey createPrimaryKey(java.lang.String name)
                            throws M4Exception
Creates a PrimaryKey. The name of the Key must be unique within the ColumnSet.

Throws:
CreateException - when an error occurs during creation of the object.
NameExistsException - when the provided name already exists.
M4Exception

setPrimaryKey

void setPrimaryKey(PrimaryKey primaryKey)
                   throws M4Exception
Throws:
M4Exception

removePrimaryKey

void removePrimaryKey()
                      throws M4Exception
Removes the specified PrimaryKey for this ColumnSet. It is also removed from the M4 Schema.

Throws:
M4Exception

copy

Columnset copy(Concept newConcept)
               throws M4Exception
Throws:
M4Exception

getPrimaryKey

PrimaryKey getPrimaryKey()
                         throws M4Exception
Throws:
M4Exception


Copyright © 2001-2005