La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

Object Definition Language

Presentaciones similares


Presentación del tema: "Object Definition Language"— Transcripción de la presentación:

1 Object Definition Language
CORBA ODMG ODL (design OQL (queries Relational design ODL OODMBS input

2 ODL Declaraciones de Clase Declaracion de Elementos Ejemplo
interface < name > {elements = attributes, relationships, methods } Declaracion de Elementos attribute < type > < name > ; relationship < rangetype > < name > ; Ejemplo float gpa(in: Student) raises(noGrades) float = return type. in: indica que el argumento Student es sólo lectura. Other options: out, inout. noGrades excepción determinada por gpa.

3 Ejemplo 1 Claves: ss#, loanid, branchid
name amount loandid address type borrower customer loans Belongs-to Customer-of branch branchid location Claves: ss#, loanid, branchid Cardinalidad: cada prestamo perteneces a una cuenta.

4 Ejemplo (II) interface Customer { attribute string name; attribute integer ss#; attribute Struct Addr {string street, string city, int zip} address; relationship Set<Loans> borrowed inverse Loans::borrower; relationship Set<Branch> has-account-at inverse Branch:patrons; key(ss#) } Tipos estructurados tienen nombres y están en llaves de claves pares. Relaciones tiene inversas. Un elemento de otra clase se indica por < class > :: Conjuntos Set<type>.

5 Ejemplo (III) interface loans { attribute real amount;
attribute int loanid; attribute Enum loanType {house, car, general} type; relationship Branch belongs-to inverse Branch::loans-granted; relationship Set<Customer> borrower inverse Customer::borrowed; key(loanid) } Tipos enumerados tienen nombres y lista en llaves

6 Ejemplo (IV) interface Branch { attribute integer branchid; attribute Struct Customer::Addr location; relationship Set<Loans> loans-granted inverse Loans::belongs-to; relationship Set<Customer> patrons inverse Customer::has-account-at; key(branchid); } Reutilización del tipo Addr.

7 ODL Tipos de Datos Tipos básicos: int, real/ float, string, tipos enumerados, y clases. Tipos constructor: Estructura para estructuras tipo de coleccion: Set, Bag, List, y Array.

8 Limitaciones de Anidamiento
Relación class colección Attributo Basico, sin clase structura colección

9 ER versus ODL E/R: flecha apunta a “one”.
ODL: no usa una colección de tipos en la clase “many“. E/R: flecha en ambas direcciones. ODL: omite tipos de colecciones en ambas direcciones ODL solo soporta relaciones binarias. Convierte relaciones multi-way a binary.

10 Roles en ODL manager worker
interface employee { attribute string name; relationship Set<Employee> manager inverse Employee::worker; relationship Set<Employee> worker inverse Employee::manager } manager works for employee worker

11 Subclases in ODL Subclass = special case = fewer entities/objects = más propiedades. Ejemplo: Facultad y Personal(Staff) don subclases de empleado. Facultad tiene año academico (9 salarios mes) pero staff tiene (12 salarios mes).

12 ODL Subclases interface Faculty:Employee { attribute real academic-year-salary; } Adquiere todos los atributos y métodos de la clase.

13 Claves ODL Identificados con keys(s) siguiendo el nombre de la clase y los atributos de la clave (key(a1; a2; : : : ; an )) = “one key consisting of all n attributes." (key a1; a2; : : : ; an ) =“each ai is a key by itself.


Descargar ppt "Object Definition Language"

Presentaciones similares


Anuncios Google