SMWP - Parameter |
|||
Introduction |
4.4 Create ParameterThere are three types of parameters which can be defined.
4.4.1 Create Value Parameter (creating a Reference Relation)Syntax "CREATE VALUE BASED PARAMETER" paramName
Creates a reference relation with the name "RV_" className "_" paramName. containing one column paramName. The created reference relation provides the parameter domain for the resulting fragments. It gets the values for from column paramName from the corresponding column of the application relation. Preconditions
SNYC-POLICY defines the way the created reference relation is mapped to its corresponding fragment class relation. expansive states, that the parameter values of the fragment class relation are a subset of the parameter values within the reference relation. All parameter values contained in fragment class relation must also exist in its reference relation. Inserted new parameter values into the root fragment class relation are automatically inserted in the corresponding reference relation. synchronized signals that all parameter values of the fragment class relation must match the parameter values in its reference relation and vice versa.
CREATE VALUE BASED PARAMETER region Creates the parameter region upon root fragment class wineries<>.
The name of the root fragment class wineries<>
must match the name of the corresponding application relation wineries.
The reference relation rv_wineries_region contains
the column region which is filled with distinct values from its dependent
root fragment class relation. The parameter expansive signals that all values contained by column region in fragment class relation wineries<> have to be a subset of the created reference relation. New parameter values in the fragment class relation are automatically being inserted into the reference relation. Deleted parameter values persist within the reference relation. 4.4.2 Create Value Parameter (use existing Relation as Reference Relation)Syntax "CREATE VALUE BASED PARAMETER" paramName An existing relation is being used as reference relation. No new relation is being created. The column columnName of relation relationName will be used as parameter domain. This mapped column columnName is used as parameter paramName which is defined upon root fragment class className. Preconditions
Example 2 CREATE VALUE BASED PARAMETER region The column id of relation regions is defined as parameter region for
fragment class wineries<>. The fragment
class relation must have a column named region, which uses the same data
type like the column id of reference relation regions. 4.4.3 Create Predicate Parameter Syntax "CREATE PREDICATE BASED PARAMETER" paramName Creates a reference relation for the parameter paramName with the name "RV_" className "_" paramName and the columns paramName and predicate. The predicate parameter is a special form of the value parameter. Every value parameter can be transformed into a predicate parameter. A value parameter contains all valid parameter values in its reference relation. Predicate parameters detect valid tuples by using SQL-expressions named labelValue. Every labelValue is mapped with a labelName which is used, for tuples of the fragment class relation which comply with the labelValue. Fragment class relations which introduce predicate parameters are used the same way as fragment class relations with value parameters. Example 3 CREATE PREDICATE BASED PARAMETER rCateg Creates the reference relation rv_rankings_rcateg which contains the
columns rcateg and predicate.
Label names ('Top10', 'Top25',
...) are stored in column rCateg, while their
label predicates SQL-statements (e.g. 'rank<=10')
are stored in column predicate. 4.5 Modify ParameterModifying parameters is not intended by the SMWP approach. In order to
modify a parameter it has to be deleted (see 4.6 Delete
Parameter) an newly created (see 4.4 Create Parameter). 4.6 Delete ParameterSyntax "DROP PARAMETER" paramName "DEFINED UPON" className ";" Deleting parameter works the same way for all types of parameters. Parameters which are being used by fragment classes can not be deleted. Deleting a parameter also deletes its reference relation. If the parameter uses an existing relation as reference relation (see 4.4.2 Create Value Parameter (use existing Relation) it will not be deleted. Example 4 DROP PARAMETER region DEFINED UPON wineries<>; Deletes the parameter named region which is defined upon root fragment class wineries<>. 4.7 Display ParametersSyntax "SHOW PARAMETER" (paramName | "*") ["DEFINED UPON" className ]; Displays generated parameter. The displayed parameters are filtered by providing parameter name and or fragment class name. Thereby is it possible to display:
These options are visualized by the following examples. A single parameter displays itself using following example:
"PARAMETER NAME" and "defined upon Fragment Class" show parameter name and fragment class. The fragment class is a root fragment class. "Parameter Type" shows if the parameter is a value or a predicate parameter. (see 4.3.1 Parameter) Example 4 SHOW PARAMETER *; Displays all defined parameters in a list.
Example 5 SHOW PARAMETER * DEFINED UPON wineries<>; Shows all parameter which are defined upon root fragment class wineries<>. Example 6 SHOW PARAMETER * DEFINED UPON wineries<region>; Shows all parameter which are used in fragment class wineries<region>. Example 7 SHOW PARAMETER region; Shows all defined parameter which use the parameter name region. Example 8 SHOW PARAMETER region DEFINED UPON wineries<>; Displays one specific parameter, which is designated by name region and defined upon root fragment class wineries<>. Example 9 SHOW PARAMETER region DEFINED UPON wineries<region>; Displays one specific parameter, which is designated by name region and is being used by fragment class wineries<region>. |