SMWP - Fragment Class |
||
Introduction |
4.8 Create Fragment Class4.8.1 Create Primary Fragment ClassSyntax "CREATE PRIMARY FRAGMENT CLASS" className A primary fragment class is defined upon a fragment base class. The primary fragment class inherits all parameters introduced by the fragment base class and allows the primary fragment class to introduce one new parameter. Selection predicates allow to narrow the set of fragments taken over from the fragment base class. The FRAGMENT SELECTION PREDICATE limits the fragments inserted into the fragmentation relation. It is specified as SQL expression and refers only parameters of the primary fragment class. The TUPLE SELECTION PREDICATE limits the set of tuples in fragments that are taken over. Specified as SQL expression it refers only tuple attributes which are not used as parameters. Preconditions
![]() Figure 8: Create primary fragment class - Schema The publication information provided by the "PUBLISH FRAGMENT AS ..." part of the create statement is used to transform the fragments of the primary fragment class into an XML document. The whole fragment is inserted as XML-Element by the name fragmentName. The tuples of the fragments are inserted as XML elements named tupleName. In order to provide qualified element names the Namespace ns_uri is used (see 4.16 Structure of generated XML ). Example 10 CREATE PRIMARY FRAGMENT CLASS wineries<region>
Figure 9: Primary Fragment Class introducing Value Parameter If the created fragment class is being mapped to a page class its publication information is being used. The fragment class wil be inserted into the xml document using the element name all_wineries_by_region in the namespace http://dke.uni-linz.ac.at/smwp/winery. The fragment class tuples are inserted by the element name winery. The generated fragment class element from the XML document displays itself in the following way:
Table 4: XML-Element for Fragment Class The resulting XML documents are discussed in 4.16 Structure of generated XML . Example 11 CREATE PRIMARY FRAGMENT CLASS rankings<rcateg> Creates primary fragment class rankings<rcateg> which introduces
the predicate based parameter rcateg (see 4.4.3 Create Predicate Parameter).
Following relations will be created for the new primary fragment class:
FR_RANKINGS_RCATEG (fragmentation relation) and RANKINGS_RCATEG (fragment
class relation). The fragment class relation obtains a new column RCATEG.
Every tuple of the fragment base class relation is tested against the
predicateValue of the predicate parameter. If it matches, the tuple will
be inserted into the primary fragment class relation containing the predicateLabel
as value for attribute rCateg. Figure 10: Primary Fragment Class introducing Predicate Parameter 4.8.2 Create Derived Fragment ClassSyntax "CREATE DERIVED FRAGMENT CLASS" className
A derived fragment class is defined upon a fragment base class and a derivation base class. The tuples are taken from fragment base class and are further partitioned according to the fragmentation parameters of the derivation base class. The fragment base class may be fragmented by several parameters or may be unfragmented as well. The derivation base class must possess exactly one parameter (which is a limitation of this prototype). The create statement for a derived fragment class provides alias names for fragment base class and derivation base class which are used in the JOIN BY part of the statement. Preconditions:
Example 12 CREATE DERIVED FRAGMENT CLASS wines<region> The derived fragment class wines<region> is being created upon fragment base class wines<> and derivation base class wineries<region>. The root fragment class wines<> will be further parameterized usind the parameter provided by wineries<region>. The derived fragment class comprises several fragments, each containg wines that were produced in the resepctive region by a winery (e.g., wines<chia> contains wines that were produced in Chianti). Figure 11: Create Derived Fragment Class 4.9 Edit Fragment ClassSyntax "ALTER FRAGMENT CLASS" className Editing fragment classes is only available for adding, modifying and deleting xml publishing information. If it is necessary to modify a fragment class simply delete and re-create it. Fragment classes can not be published as XML document without publication specification. Fragment classes without publication information can be mapped to page classes, but they will not be displayed in the resulting XML documents. Adding, modifying or deleting the publication spezification from an fragment class mapped to a page class results in regeneration of all XML documents whose source is a page class the fragment class is mapped to. Example 13 ALTER FRAGMENT CLASS wineries<region> Adds publication information to the fragment class wineries<region>. If the fragment class is already equiped with publication specification, the specification will be changed. Example 14 ALTER FRAGMENT CLASS wineries<region> Removes all publication specification from the fragment class wineries<region>. 4.10 Delete Fragment ClassSyntax "DROP FRAGMENT CLASS" className";" Deletes the fragment class designated by className. This statement deletes the fragment class relation and its corresponding fragmentation relation. If the fragment class is a root fragment class its fragmentation relation (which is also an application relation) will not be deleted. Root fragment classes also do not contain fragmentation relations. Preconditions
Example 15 DROP FRAGMENT CLASS wineries<region>; Deletes the fragment class wineries<region> which is not mapped to a page class and not used as fragment base class by another fragment class. The fragment class relation wineries_region and its corresponding fragmentation relation fr_wineries_region will be deleted. 4.11 Display Fragment ClassSyntax "SHOW FRAGMENT CLASS" (className | * ) ";" Using this statement works for two options. Either displaying a list of all generated fragment classes, or displaying information about one specific fragment class. The list of all created fragment classes shows their names, their types (either primary, derived or root fragment class) and if they contain publication specifications. The detail information about one fragment class contains its base classes, selection predicates, publication specifications and its parameters. Example 16 SHOW FRAGMENT CLASS *; Displays the names of all created fragment classes including their type (primary fragment class, derived fragment class or root fragment class) and their publication information. Information is shown if the fragment class is mapped to any page class.
Example 17 SHOW FRAGMENT CLASS wineries<region>; Displays all metadata gathered about the given fragment class. The information shows that wineries<region> is a primary fragment class defined upon fragment base class wineries<>. The fragment class contains publishing information and is being used as foundation fragment class for page class wines<region>. |