CATEGORII DOCUMENTE |
Bulgara | Ceha slovaca | Croata | Engleza | Estona | Finlandeza | Franceza |
Germana | Italiana | Letona | Lituaniana | Maghiara | Olandeza | Poloneza |
Sarba | Slovena | Spaniola | Suedeza | Turca | Ucraineana |
Rational Rose/Oracle8
Mapping Document Version 1.0
Overview
This mapping describes the relationship between UML and Oracle8 constructs as implemented in version 1.0 of the Rose/Oracle8 product.
The supported Use Cases for the Rose/Oracle8 product are:
Reverse Engineer Relational Schema to a Rose Model to aid the evolution to Oracle8 ORDBMS schema
Incremental Forward Engineering Oracle8 Object Relational Schemas from Rose Models
Incremental Reverse Engineer Oracle8 Object Relational Schemas into a Rose Model
Forward and Reverse Engineer Oracle8 with the assumption that one class in Rose represents one Oracle abstraction (ObjectType, Table, View, etc).
Creation of Object Relational constructs to enrich an existing Oracle8 database
Visualization of existing relational databases and facilitation of the discovery and composition of existing business objects
The basis of the Rose/Oracle8 product is the mapping of Rose modeling components to Oracle8 object extensions. As a result, this section focuses on the definition of the requirements pertaining to the mapping of Rose components to Oracle8 schema elements.
Rose Construct |
Oracle Construct |
Description |
Class |
Object Type |
Stereotype = ObjectType |
Class |
RelationalTable |
Stereotype = RelationalTable |
Class |
ObjectTable |
Stereotype = ObjectTable |
Class |
ObjectView |
Stereotype = ObjectView |
Class |
VARRAY |
Stereotype = VARRAY |
Class |
NestedTable |
Stereotype = NestedTable |
Class |
RelationalView |
Stereotype = RelationalView |
Class |
Sequence |
Stereotype = Sequence |
Attribute |
Column Name for Table |
The scalar type of the column is defined using two properties one for the scalar type and a second for the length or size of the column (if applicable). |
Attribute |
Attribute for an Object Type |
Scalar or an Object Type. |
Attribute |
RelationalTable Index |
The attribute Name is equal to the index name and the initial value of the attribute is a comma delimited set of column names for the index. The IsIndex property is set to True and if this Index is a PrimaryKey index the IsPrimaryKey property is also set to True. |
Attribute |
Object or Relational View Column |
The attribute name is equal to the view column name or the view column alias if an alias is provided. If an alias is provided the initial value of the attribute is set equal to the fully qualified column name. |
Operation |
Object Type Function (has a return type) |
Note: Overloading is Supported. |
Operation |
Object Type Procedure (no return type) | |
Operation |
Trigger |
The export control for these operations will be set to implementation to signify that these types of class methods are Triggers. |
Uni-directional Association Role |
Many See Figure 4 - Association Mapping | |
Inheritance |
Many See Figure 5 - Inheritance Mapping | |
Stereotype of VARRAY on the Association between two Object Types, with the cardinality of the TO role corresponding to the size of the VARRAY. |
VARRAY |
CREATE TYPE nn as VARRAY (10) of some_other_type. |
Component (Subprogram Specification) |
Schema |
StereoType = Schema |
Physical Package |
Database Domain |
StereroType = DatabaseDomain |
Logical Package |
User Defined | |
Association Role Key |
Indexes |
See current DDL mapping. |
Figure -High Level Rose to Oracle8 Mapping
A Class will map to one of the following Oracle8 constructs Object Type (formally Abstract Data Type), ObjectView,RelationalView,ObjectTable or RelationalTable which will be shown as a stereotype on the class.
The Oracle8 DDL will be generated if the Class specification has a stereotype set to one of the valid Oracle8 DDL stereotypes. (Note: the persistent value will be set automatically during code generation, syntax checking and reverse engineering for classes with these stereotypes)
The Attributes of a Class will map to either attributes of an Object Type or to a column in Tables and Views.
The type can be a scalar data type or an Object Type. The Object Type must be included in the model in the form of a Class if complete DDL is to be generated. Additionally the attribute containment (by value or by reference) can be set in the attribute specification in order to specify REF Object Types or Columns.
Note: During reverse engineering the assumption is that an Association will be created between classes unless the attribute type is a scalar data type.
Scalar Type |
Modifier |
CHAR NCHAR |
(size) |
VARCHAR |
(size) |
VARCHAR2 NVARCHAR2 |
(size) |
NUMBER |
blank or (p) or (p, scale) |
DATE | |
LONG | |
RAW |
(size) |
LONG RAW | |
ROWSID | |
MLSLABEL | |
CLOB NCLOB | |
BLOB | |
BFILE |
Figure -Scalar Data Types
Object Type Attribute Types |
Modifier |
CHAR |
(size) |
VARCHAR2 |
(size) |
NUMBER |
(p,s) |
DECIMAL |
(p,s) |
INTEGER | |
SMALLINT | |
FLOAT |
(p) |
REAL | |
DOUBLE PRECISION | |
RAW | |
BLOB | |
CLOB | |
DATE | |
TABLE | |
REF |
Figure -Datatypes for Object Types
The Operations of a Class will map to either Member functions or Member procedures of an Object Type and the access control can be set to either public or private.
The parameter name and type map to the current parameter and type for operations within Rose.
Target |
Supplier |
Description |
RelationalTable |
RelationalTable |
An intermediate table to break up a many to many relation (No aggregation). A relation to a table that needs to be DELETE CASCADE. Link Classes = Same As 1 Note : If the Primary Key on the target table is not equal to the Foreign Key of the target table an association is drawn to the Table referenced within the Foreign Key. |
Object Type |
NA |
|
ObjectView or RelationalView |
NA |
|
ObjectTable |
NA |
|
Object Type |
Object Type |
Aggregate Type By Value Aggregate Type By Reference |
ObjectTable or RelationalTable |
NA |
|
ObjectView or RelationalView |
NA |
Figure - Association Mapping
Child |
Parent |
Description |
RelationalTable |
RelationalTable |
Formal subtype. Note: If the Primary Key on the target table is equal to the Foreign Key of the target table and inheritance relation is drawn to the Table referenced within the Foreign Key. |
Object Type |
NA |
|
View |
NA |
|
Object Type |
Object Type |
NA. Feature of Next Release.. |
Table |
NA |
|
View |
NA |
|
View |
View |
NA |
Table |
NA |
|
Object Type |
NA |
Figure - Inheritance Mapping
Target |
Supplier |
Description |
RelationalView |
RelationalView |
Supplier based on FROM clause. |
|
RelationalTable |
Supplier based on FROM clause. |
ObjectView |
RelationalTable |
Supplier based on FROM clause. |
|
ObjectType |
Supplier Type of ObjectView. |
ObjectTable |
SomeObjectType |
Type of Object Table. |
VARRAY |
SomeObjectType |
Type of VARRAY |
NestedTable |
SomeObjectType |
Type of Nested Table |
ObjectView |
SomeObjectType |
Type of ObjectView. |
Figure -Dependency Relation Mapping
Each ObjectType, View or Table can be assigned to one or more database schemas where a schema is represented as a Component within Rose with the stereotype of Schema.
Each database schema belongs to a database domain where the database domain is represented as a Physical Package with a stereotype of DatabaseDomain.
Item |
Stereotype |
Notes |
|
Class |
ObjectType | ||
ObjectView | |||
ObjectTable |
|
||
|
NestedTable | ||
RelationalTable | |||
RelationalView | |||
VARRAY | |||
Association |
FK |
ForeignKey |
|
Component |
Schema |
Figure Oracle8 Stereotypes
Schema Generation Properties
Design-level properties (also called project properties) control aspects of code generation that apply to an entire model.
In addition, various model elements have their own unique sets of schema generation properties. For example, class properties control aspects of schema generation for class elements that have stereotypes such as object type, relational table, object view, etc.
Schema Generation Properties for Rose/Oracle8 Projects
Model (or design-level) properties affect the entire Rose model. The following table describes the schema generation properties, as well as any defined default values, for Rose/Oracle8 models.
Property |
Type |
Description |
DDLScriptFilename |
string |
The name of the default DDL script file that is created when you generate a schema from a Rose model. |
DropClause |
Boolean |
If true, generates a DROP statement before each appropriate schema object |
PrimaryKeyColumnName |
string |
Suffix added to generated primary keys. Initial value is _ID. |
PrimaryKeyColumnType |
string |
Defines the type and length of generated primary keys. The initial value is NUMBER(5,0) |
SchemaNamePrefix |
string |
An optional naming standard that is added to the beginning of a component name for each generated schema. If blank, no prefix is added. Default is blank. Recommended value is S_ |
SchemaNameSuffix |
string |
An optional naming standard that is appended to the end of the component name for each generated schema. If blank, no suffix is appended. Default is blank. Recommended value is _S. |
TableNamePrefix |
string |
An optional naming standard that is added to the beginning of the class name for each generated table. If blank, no prefix is added. The default prefix is blank. Recommended value is T_. |
TableNameSuffix |
string |
An optional naming standard that is appended to the end of the class name for each generated table. If blank, no suffix is appended. The default prefix is blank. Recommended value is _T. |
TypeNamePrefix |
string |
An optional naming standard that is added to the beginning of the class name for each generated object type. If blank, no prefix is added. The default is blank. Recommended value is O_. |
TypeNameSuffix |
string |
An optional naming standard that is appended to the end of the class name for each generated object type. If blank, no suffix is appended. The default is blank. Recommended value is _O. |
ViewNamePrefix |
string |
An optional naming standard that is added to the beginning of the class name for all generated object and relational views. If blank, no prefix is added. The default is blank. Recommended value is V_. |
ViewNameSuffix |
string |
An optional naming standard that is appended to the end of the class name for all generated object and relational views. If blank, no suffix is appended. The default is blank. Recommended value is _V. |
VarrayNamePrefix |
string |
An optional naming standard that is added to the beginning of the class name for each generated Varray. If blank, no prefix is added. The default is blank. Recommended value is VA_. |
VarrayNameSuffix |
string |
An optional naming standard that is appended to the end of the class name for each generated Varray. If blank, no suffix is appended. The default is blank. Recommended value is _VA. |
NestedTableNamePrefix |
string |
An optional naming standard that is added to the beginning of the class name for each generated nested table. If blank, no prefix is added. The default is blank. Recommended value is NT_. |
NestedTableNameSuffixq |
string |
An optional naming standard that is appended to the end of the class name for each generated nested table. If blank, no suffix is appended. The default is blank. Recommended value is _NT. |
ObjectTableNamePrefix |
string |
An optional naming standard that is added to the beginning of the class name for each generated object table. If blank, no prefix is added. The default is blank. Recommended value is OT_. |
ObjectTableNameSuffix |
string |
An optional naming standard that is appended to the end of the class name for each generated object table. If blank, no suffix is appended. The default is blank. Recommended value is _OT. |
IndexNamePrefix |
string |
An optional naming standard that is added to the beginning of the class name for each generated index. If blank, no prefix is added. The default is blank. Recommended value is I_. |
AttributeNamePrefix |
string |
An optional naming standard that is added to the beginning of the attribute name for each generated attribute within an object type. If blank, no prefix is added. The default is blank. Recommended value is A_. |
AttributeNameSuffix |
string |
An optional naming standard that is appended to the end of the attribute name for each generated attribute within an object type. If blank, no suffix is added. The default is blank. Recommended value is _A. |
MemberNamePrefix |
string |
An optional naming standard that is added to the beginning of the operation name for each generated member within an object type. If blank, no prefix is added. The default is blank. Recommended value is M_. |
MemberNameSuffix |
string |
An optional naming standard that is appended to the end of the operation name for each generated member within an object type. If blank, no suffix is added. The default is blank. Recommended value is _M. |
Figure Schema Generation Properties for Rose/Oracle8 Projects
Schema Generation Properties for an Oracle8 Class
The following table describes the schema generation property for an Oracle8 class:
Property |
Type |
Description | |
OID |
string |
The Object ID of the Object View. |
|
WhereClause |
string |
Used by object views and relational views. |
|
CheckConstraint |
string |
Used to indicate a CHECK constraint. |
|
CollectionTypeLength |
string |
Used by Varrays of Scalar type. |
|
CollectionTypePrecision |
string |
Used by Varrays of Scalar type |
|
CollectionTypeScale |
string |
Used by Varrays of Scalar type |
Figure Schema Generation Properties for an Oracle8 Class
Schema Generation Properties for Oracle8 Operations
The following table describes the schema generation property for Oracle8 operations:
Property |
Type |
Description | ||
MethodKind |
Enumerated |
Can be Function, Procedure, Operator, Constructor, Destructor, Trigger, MapMethod, OrderMethod, Calculated Column Order Number if Calculated View Column. Initial value is Function. |
||
OverloadID |
String |
Supported for Functions. |
||
OrderNumber |
String |
The column order, if a calculated View column. |
||
IsReadNoDataState |
Boolean |
Initial setting is False. |
||
IsReadNoProcessState |
Boolean |
Initial setting is False. |
||
IsWriteNoDataState |
Boolean |
Initial setting is False. |
||
IsWriteNoProcessState |
Boolean |
Initial setting is False. |
||
IsSelfish |
Boolean |
Initial setting is False. |
||
TriggerType |
Enumerated |
Can be AFTER, BEFORE, INSTEAD OF. |
||
TriggerEvent |
Enumerated |
Can be INSERT, UPDATE, DELETE, INSERT OR UPDATE, INSERT OR DELETE, UPDATE OR DELETE, INSERT OR UPDATE OR DELETE. |
||
TriggerText |
String |
Part of trigger definition. |
||
TriggerRefererencingNames |
String |
Used for the trigger Referencing option. |
||
TriggerForEach |
Enumerated |
Can be ROW, STATEMENT |
||
TriggerWhenClause |
String |
Parameter for a trigger. |
||
Figure Schema Generation Properties for Oracle8 Operations
Schema Generation Properties for Oracle8 Class Attributes
The following table describes the schema generation properties for Oracle8 attributes:
Property |
Type |
Description | |
OrderNumber |
String |
Column order for tables. |
|
IsUnique |
Boolean |
If set to False (the default), the attribute is not required to be unique. |
|
NullsAllowed |
Boolean |
If set to True (the default) attribute is required to have a value. A value is required for NOT NULL settings. |
|
Length |
string |
Used for scalar datatypes such as CHAR, VARCHAR, etc. |
|
Precision |
string |
Used by NUMBER scalar datatype. |
|
Scale |
string |
Used by NUMBER scalar datatype. |
|
IsIndex |
Boolean |
Identifies whether the attribute is part of an index. Default is FALSE. |
|
IsPrimaryKey |
Boolean |
Marks the attribute as the Primary Key or part of the Primary Key. The attribute must be a scalar type. If more than one Primary Key attribute is identified, a concatenated primary key is generated. Default is False. |
|
CompositeUnique |
Boolean |
Identifies if attribute is part of a composite. The default is False. |
|
CheckConstraint |
string |
Used to indicate a CHECK constraint. |
Figure Schema Generation Properties for Oracle8 Class Attributes
Schema Generation Properties for Oracle8 Roles
The following is the schema generation property for an Oracle8 role:
Property |
Type |
Description | |
OrderNumber |
string |
Order of the table column. |
Figure Schema Generation Properties for Oracle8 Roles
Schema Generation Properties for Oracle8 Module Specifications
Property |
Type |
Description | |
IsSchema |
Boolean |
Identifies if the component is a schema. |
Figure Schema Generation Properties for Oracle8 Modules
Object Types
An object type is a user-defined datatype that enables you to capture a complex, real-world entity as a single structured data unit that can be queried, updated, and stored in an Oracle8 database. The object types you create can be used the same way you use built-in relational datatypes.
By creating object types in your schema you are able to:
Package and store data together with its associated application logic.
Enable multiple applications to access the data without having to generate the code needed to use it.
Create a bridge between an existing relational database and an object-based application.
How Object Types are structured
An object type has:
Attributes that capture the structure and state of the entity the object type is modeling. For example, a CUSTOMER object type may have attributes such as NAME, ADDRESS, CUSTOMER-ID, etc.
Methods, such as procedures, functions, and map or order comparison methods.
Attributes
When you create an attribute for an object type, you provide the attributes datatype, which can be:
Scalar, using built in types such as CHAR, NUMBER, VARCHAR, DATE, etc. For example, the CUSTOMER object type may have a NAME attribute whose datatype is VARCHAR2.
Another object type. For example, an attribute for the CUSTOMER object type may be a PURCHASE_ORDER object type. This association can be made by creating a reference (REF) to PURCHASE_ORDER or it can be by value.
A collection type--either a VARRAY or a nested table. VARRAYs and nested tables are structured collections of data. For example, the CUSTOMER object type may have a CUSTOMER_CONTACTS attribute whose datatype is a VARRAY of five names.
Methods
By defining methods with an object, you are able to package application logic with your data, enabling object-based applications to use the data without requiring additional code. The methods you can define for an object type include:
Stored functions and procedures
Triggers
Map or Order Comparison methods
Constructor method (the method for creating the object itself)
How Rose/Oracle8 Models Object Types
Rose/Oracle8 models an object type as a Class with a Stereotype of Object Type. For example, the following is a sample CUSTOMER object type:
Attributes
Attributes are modeled in Rose as Attributes.
Nested Object Types
Rose models an attribute whose datatype is another object type (a nested object type) as an association between the two object types. For example, if the object type CUSTOMER has an attribute whose datatype is the PURCHASE_ORDER object type, the attribute is modeled as follows:
In this case, the association is by value. If you create a REF (a pointer or reference similar to a foreign key in a relational table), Rose/Oracle8 models it as an aggregate association. In this case, CUSTOMER is the Client (Role B in the associations Rose specification) and PURCHASE_ORDER is the Supplier (Role A in the associations Rose specification):
|
In some databases, the order of the attributes may be significant. Use the Ordering Wizard from the Tools - Oracle8 menu to display how attributes are ordered in an object type, relational table, or relational view. This is particularly useful if an attribute has a non-scalar attribute (such as another datatype or REF) since these are modeled as associations with other schema objects. |
NULL and NOT NULL Constraints
Rose/Oracle8 models the NULL constraint as a model property associated with an attribute. By default, the NullsAllowed property is set to True.
Unique Constraint
Rose/Oracle8 models the Unique constraint as a model property for an attribute. By default, the IsUnique property is set to False.
Methods
Methods are modeled as Operations in a Rose model. These can include:
Triggers. These use the Implementation setting for Export Control to distinguish them from other methods.
Stored functions. These are methods with a return type. Modeled as operations of a Rose Class Utility that bears the same name as the schema.
Map or Order comparisons
Object constructor/destructor
Calculation for deriving the value of an attribute
The type of method is captured by the MethodKind model property.
Rules for Using Object Types
All Oracle8 rules for creating Object Types also apply in Rose/Oracle8. Please note these specific rules:
An object type can have one MAP method or one ORDER method, but not both.
An object type cannot have an attribute with a datatype of ROWID, LONG, LONG RAW, NCLOB, NCHAR, or NCHAR VARYING.
You must use PRAGMAs to indicate the access level of member functions.
You cannot define an INDEX on an object type or an object types attributes unless it has a scalar datatype.
Object Views
An object view is a virtual object table. Its significant features include your ability to:
Objectify the data currently stored in relational tables. By creating these object containers for existing relational data, your client applications can begin using object technology without the need to immediately change the underlying structure of your data.
Begin to introduce objects into a relational database.
Customize access to data.
Improve overall performance. (When stored as a row in an object view, relational data is retrieved as a single unit.)
Rose/Oracle8 greatly simplifies introducing object views to your schemas. Specifically, you can:
Reverse engineer an existing relational schema into Rose.
Use Rose/Oracle8s Data Type Creation Wizard to build the object types and object views that will front-end your relational data with object-relational constructs.
Forward engineer (generate schema) from your Rose model and update your schema with the new object views and types.
To create an object view (whether youre using Rose/Oracle8 or generating the SQL yourself), you first need to create an object type that encapsulates the data from one or more relational tables. This object type serves as the bridge between the object view and relational data.
You also need to designate one or more of the object views attributes as an object identifier that the view will use to enable REFs to point to objects (rows) in the view. (An object identifier can be a composite of more than one attribute.)
Since it generates the constructs you need, use Rose/Oracle8s Data Type Creation Wizard to create both the object types and object views that will extend your relational database.
How Rose/Oracle8 Models Object Views
Rose/Oracle8 models an object view as a Class with an Object View Stereotype. It represents the link between the underlying object types and relational tables as Dependencies.
For example:
The Object Views attribute(s) that you selected as the Object Identifier is captured as a model property. For example:
Rules for Using Object Views
All Oracle8 rules for creating and using object views also apply in Rose/Oracle8. In addition, note that you cannot specify an alias when creating an object view.
Object Tables
An object table enables you to place an object type in a relational construct. The columns in the object table correspond to the attributes in the underlying object type. Each row in the object table contains an object.
For example, consider a simple NEW CUSTOMER object type that has a NAME attribute and a CUSTOMER_ID attribute. Conceptually, an object table created from this object type would look like this:
By packaging an object type in an object table, you can access the objects in a typically relational way. Note that another alternative for creating object packages that can be used in a relational world, is to create Object Views.
How Rose/Oracle8 Models Object Tables
Rose/Oracle8 models an object table as a Class with a Stereotype of Object Table. Since object tables are built from underlying object types, Rose/Oracle8 models this relationship as a Dependency.
For example:
Rules for Using Object Tables
All Oracle8 rules for creating and using object tables also apply in Rose/Oracle8.
VARRAYs
A VARRAY is a datatype you create to define an ordered collection of data elements.
All of the elements in a VARRAY must have the same datatype. The size of a VARRAY determines how many elements it can contain. Since a VARRAY defines an ordered collection, you can use it where the order of the elements is significant. (Each element in a VARRAY has an index that is based on the elements position in the array.) This is in contrast to a nested table which is an unordered collection type.. VARRAYs are stored in a single column; they allow you to retrieve a collection as a whole.
You can use a VARRAY to define the datatype for:
An attribute in an object type
A column in a relational table
For example, in a CUSTOMER object type, you can use a CONTACT_NAME VARRAY to define the datatype for a CUSTOMER_CONTACTS attribute. If the size of the CONTACT_NAME VARRAY is five, up to five names an be in the array.
Since VARRAYs can be used to define the datatype of a column in a relational table, you are able to introduce this object construct into your existing relational schema.
How Rose/Oracle8 Models VARRAYs
Rose/Oracle8 models a VARRAY as a Class with a Stereotype of VARRAY. When you create a VARRAY in Rose/Oracle8, it can have a scalar datatype or it can be based on an object type.
If based on another object type, Rose/Oracle8 models this as a dependency between the object type and the VARRAY:
Rules for Using VARRAYs
All Oracle8 rules for creating VARRAYs also apply in Rose/Oracle8. Please note these specific rules:
A VARRAY cannot have a datatype (directly or indirectly by nested object types) of BLOB, CLOB, NCLOB, NCHAR, or NCHAR VARYING. Note that this rule does not apply to object types that are included by reference.
A VARRAY cannot have a nested table as a datatype, either directly or indirectly.
A VARRAY does not support an index.
About Nested Tables
A nested table is a table of unordered data elements that is embedded as a column in another table. You can perform the same operations on a nested table that you can perform on other tables. All of the elements in a nested table must have the same datatype.
You can use a nested table to define the datatype for:
An attribute in an object type
A column in a relational table
How Rose/Oracle8 Models Nested Tables
Rose/Oracle8 models a nested table as a Class with a Stereotype of NestedTable. When you create a nested table in Rose/Oracle8, it is based on an object type. Rose models the association between the nested table and its underlying object type as a dependency. For example:
When you use a nested table as the datatype for an object type attribute or a column in a relational table, Rose models the nested table attribute as an association between the nested table schema object and the object type or relational table. For example:
Rules for Using Nested Tables
All Oracle8 rules for creating nested tables also apply in Rose/Oracle8. In addition, note that a nested table cannot be based on a scalar type of NCLOB, NCHAR, or NCHAR VARYING.
Relational Tables
Relational tables have been the fundamental schema structure for relational databases. With the introduction of object technology and Oracle8, conventional relational tables can also support:
Using an object type, VARRAY, or nested table as the datatype for a column.
Building object views that extend a relational database by packaging data as virtual objects.
Rose/Oracle8 smoothes the transition to object-relational environments by:
Enabling you to reverse engineer your current schemas into Rose models.
Create new schema objects, such as object views, as well as modify existing relational constructs
Create and execute DDL scripts based on the Rose model.
How Rose/Oracle8 Models Relational Tables
Rose/Oracle8 models a relational table as a Class with a Stereotype of RelationalTable. For example, the following is a sample CUSTOMER relational table:
Table Columns
Rose/Oracle models table columns as attributes of the RelationalTable class.
Nested Datatypes for Columns
Rose models a column whose datatype is a user-defined datatype (i.e., an object type, VARRAY, or nested table) as an association between the table and the datatype. For example, if the CUSTOMER relational table has a CONTACTS column whose datatype is a CONTACT_LIST VARRAY, it would be modeled as:
|
In some databases, the order of the columns (attributes) may be significant. Use the Ordering Wizard from the Tools - Oracle8 menu to display how attributes/columns are ordered in an object type, relational table, or relational view. This is particularly useful if an attribute has a non-scalar attribute (such as another datatype or REF) since these are modeled as associations with other schema objects. |
REFs
A REF is similar to a foreign key in that it serves as a reference to another entity, in this case, an object type. REFs enable you to derive the content of a column by pointing to an object type in the schema.
Rose/Oracle8 models a REF as an aggregate association. For example, if the CUSTOMER table has an INVOICE column that uses a REF to an INVOICE object type, it would be modeled as:
Foreign Keys
Rose/Oracle8 models foreign keys as associations. For example, if the CUSTOMER table has a foreign key to a DEPARMENT_ID in another table, it would be modeled as:
NULL and NOT NULL Constraints
Rose/Oracle8 models the NULL constraint as a model property associated with an attribute (column). By default, the NullsAllowed property is set to True.
Unique Constraint
Rose/Oracle8 models the Unique constraint as a model property for an attribute (column). By default, the IsUnique property is set to False.
Index
Rose/Oracle8 models an index as a model property and lists it with the other attributes (columns) associated with the table. In the table icon, the index attribute is shown with a T.
Rules For Using Relational Tables
All Oracle8 rules for creating and using relational tables also apply in Rose/Oracle8.
Relational Views
A relational view is a standard Oracle construct for creating a virtual table based on one or more existing relational tables.
How Rose/Oracle8 Models Relational Views
Rose/Oracle8 models a relational view as a class with a stereotype of RelationalView. The columns of the view are modeled as attributes of the class. The views ties to underlying tables are modeled as dependencies.
For example, consider a relational view that creates a virtual table based on the ITEM and PRICE relational tables:
|
In some databases, the order of the columns (attributes) may be significant. Use the Ordering Wizard from the Tools - Oracle8 menu to display how attributes/columns are ordered in an object type, relational table, or relational view. This is particularly useful if an attribute has a non-scalar attribute (such as another datatype or REF) since these are modeled as associations with other schema objects. |
Rules For Using Relational Views
All Oracle8 rules for creating and using relational tables also apply in Rose/Oracle8.
Oracle8 to Rose Mapping Quick Reference
The following table provides a quick reference for Oracle8 to Rose mapping.
Oracle Concept |
Model Item |
Description |
Object Type |
Class |
Rose models an Object Type as a class with an Object Type stereotype. The Object Types attributes are modeled as class attributes; its methods are modeled as operations. |
Relational Table |
Class |
Rose models a Relational Table as a class with a Relational Table stereotype. Table columns are modeled as class attributes. |
Object Table |
Class |
Rose models an Object Table as a class with an Object Table stereotype. It models the tables relationship with its underlying Object Type as a dependency. |
Object View |
Class |
Rose models an Object View as a class with an Object View stereotype. View columns are modeled as attributes; methods are modeled as operations. The relationships between the Object View and its underlying object type(s) and relational table(s) are modeled as dependencies. |
VARRAY |
Class |
Rose models a VARRAY as a class with a VARRAY stereotype. The relationship between the VARRAY and an underlying type is modeled as a dependency. |
Nested Table |
Class |
Rose models a Nested Table as a class with a Nested Table stereotype. The relationship between the Nested Table and the underlying type is modeled as a dependency. |
Relational View |
Class |
Rose models a Relational View as a class with a Relational View stereotype. View columns are modeled as class attributes. Rose uses dependencies to model relationships between the view and its underlying tables. |
Column Name for Table or View |
Attribute |
The scalar type of the column is defined by using two model properties; one for the scalar type and a second for the length or size of the column (if applicable). |
Attribute for an Object Type |
Attribute |
Scalar or another Object Type. |
Object Identifier |
Attribute |
Rose uses a model property to model the object identifier for an Object View. |
Index |
Attribute |
The attribute name is equal to the index name and the initial value of the attribute is a comma delimited set of column names for the index. The IsIndex property is set to True and if this Index is a Primary Key index, the IsPrimaryKey property is also set to True. |
REF |
Association |
Rose models a REF as an aggregate relationship between objects. |
Foreign Key |
Association |
Rose models a foreign key as an association relationship between two tables. |
NULL and UNIQUE Constraints |
Attribute |
These constraints are determined by property settings for an attribute or table column, specifically, IsUnique and NullsAllowed. . |
Object or Relational View Column |
Attribute |
The attribute name is equal to the view column name or the view column alias, if an alias is provided. Where an alias is provided, the initial value of the attribute is set to the fully qualified column name. |
Object Type Function (has a return type) |
Operation |
Rose models methods as operations. |
Object Type Procedure (no return type) |
Operation |
Rose models methods as operations. |
Trigger |
Operation |
The export control for these operations is set to implementation to signify that these types of class methods are triggers. |
Schema |
Component (Subprogram specification) |
The stereotype is set to Schema. |
Database Domain |
Physical Package |
The stereotype is set to Database Domain. |
Figure Oracle8 to Rose Mapping Quick Reference
Politica de confidentialitate | Termeni si conditii de utilizare |
Vizualizari: 1682
Importanta:
Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved