Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 3 Object Specification Languages Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National Univ.

Similar presentations


Presentation on theme: "Chapter 3 Object Specification Languages Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National Univ."— Presentation transcript:

1 Chapter 3 Object Specification Languages Prof. Hyoung-Joo Kim (hjk@oopsla.snu.ac.kr) OOPSLA Lab. Dept. of Computer Engineering Seoul National Univ.

2 SNU OOPSLA Lab.2 Contents 3.1 Introduction 3.2 Object Definition Language 3.3 Object Interchange Format

3 SNU OOPSLA Lab.3 3.1 Introduction Specification Language –used to represent ODMG-compliant object database management systems –used to define the schema, operations, and state of object database –facilitate the portability of database across ODMG-compliant implementation –provide a step toward the interoperability of ODBMs –ODL : Object Definition Language –OIF : Object Interchange Format

4 SNU OOPSLA Lab.4 3.2 Object Definition Language(ODL)(1) Definition –a specification language of interfaces to object type ODL development principles –all semantic constructs of ODMG model –specification language(not full programming language) –programming language independence –OMG IDL(Interface Definition Language) compatibility –practical & short time implementable

5 SNU OOPSLA Lab.5 3.2 Object Definition Language(ODL)(2) ODL mapping to other languages STEP/ExpressSQL3Other Language-Independent ODL Java C++SQL3SmalltalkOther

6 SNU OOPSLA Lab.6 3.2.1 Specification(1) Type definition –achieve by specifying its interface or by its class in ODL ::= | ::= { [ ] } ::= interface ::= interface [ ] ::= { } ::= class [ extends ] [ ]

7 SNU OOPSLA Lab.7 3.2.1 Specification(2) Type characteristics –supertype information, –extent naming, –specification of keys –simple example for the class definition class Professor ( extent professors ) { properties operations };

8 SNU OOPSLA Lab.8 3.2.1 Specification(3) Instance properties –be specified in attributes and relationships specifications ::= | ::= ; | ;

9 SNU OOPSLA Lab.9 3.2.1 Specification(4) Attributes specification –example class Professor ( extent professors ) { attribute string name; attribute unsigned short faculty_id[6]; attribute long soc_sec_no[10]; attribute set degrees; relationships operations };

10 SNU OOPSLA Lab.10 3.2.1 Specification(5) Relationships –define a traversal path for relationship –include designation of the target type and information about the inverse traversal path class Professor ( extent professors ) { relationship set advises inverse Student::advisor; relationship set teaching_assistants inverse TA::works_for; relationship Department department inverse Department::faculty; operation }

11 SNU OOPSLA Lab.11 3.2.2 An Example in ODL(1) Salary EmployeeCourse TAProfessor Student-IF Student Section Has_ prerequisites Is_prerequisites has_sections is_section_of takes is_taken_by has_TA assists is_taught_by teaches extends is-a many-to-many one-to-many one-to-one Legend :

12 SNU OOPSLA Lab.12 3.2.2 An Example in ODL(2) Course type class Course ( extent courses ) { attribute string name; attribute string number; relationship list has_sections inverse Section::is_section_of; relationship Set has_prerequisites inverse Course::is_prerequisite_for; relationship Set is_prerequisite_for inverse Course::has_prerequisites; boolean offer(in unsigned short semester) raises(already_offered) boolean drop(in unsigned short semester) raises(not_offered) }

13 SNU OOPSLA Lab.13 3.2.2 An Example in ODL(3) Section type class Section ( extent sections ) { attribute string number; relationship Professor is_taught_by inverse Professor::teaches; relationship TA has_TA inverse TA::assists; relationship Course is_section_of inverse Course::has_sections; relationship set is_taken_by inverse Student::takes; };

14 SNU OOPSLA Lab.14 3.3 Object Interchange Format(OIF) Definition –a specification language used to dump and load the current state of an object DB to or from a file or set of files OIF development principles –support all object database state compliant to the ODMG object model –specification language for persistent object and their states –design according to related standards as STEP or ANSI –no keywords

15 SNU OOPSLA Lab.15 3.3.1 Object Database States Items used to characterize the state of all objects –object identifiers –type bindings –attribute values –links to other objects

16 SNU OOPSLA Lab.16 3.3.2 Basic Structure An OIF file contains object definitions Object tag names –specified with object identifier –unique in the OIF files(s) –visible within the entire set of OIF files –no forward declarations –cyclic usage of tag names

17 SNU OOPSLA Lab.17 Simple example Jack Person{} Physical clustering –definition Paul (jack) Engineering{} –meaning create a new persistent instance of the class Engineer “physically near” the object referenced by the identifier Jack “physically near” are implementation dependent tag name 3.3.3 Object Definitions

18 SNU OOPSLA Lab.18 3.3.4 Attribute Value Initialization(1) Simple example interface Person { attribute string Name; attribute unsigned short Age; }; Sally Person{Name “Sally”, Age 11} or Sally Person{Age 11, Name “Sally”} Short initialization format Sally Person{“Sally” 11} Copy initialization McBain(McPerth) Company{McPerth} Boolean literal initialization with boolean literal TRUE or FALSE

19 SNU OOPSLA Lab.19 struct PhoneNumber { unsigned short CountryCode; unsigned short AreaCode; unsigned short PersonCode; }; struct Address { string Street; string City; PhoneNumber Phone; }; interface Person { attribute string Name; attribute Address PersonAddres; }; 3.3.4 Attribute Value Initialization(2) Character literals Integer literals Float literals String literals Initialization of structured type

20 SNU OOPSLA Lab.20 Sarah Person{Name “Sarah”, PersonAddress {Street “Willow Road”, City ‘Palo Alto”, Phone {CountryCode 1, AreaCode 415, PersonCode 1234}}} T1 Sample{Values{450, 23, 270, 22}} T1 Sample{Values{[0] 450, [1] 23, [2] 270, [3] 22}} = 3.3.4 Attribute Value Initialization(3) Initialization of multidimensional attributes interface Sample { attribute unsigned short Values[1000]; }

21 SNU OOPSLA Lab.21 Interface Professor: Person { attribute set Degrees; }; Feynman Professor{Degrees{“Masters”,“PhD”}} Interface PolygonSet{ attribute array polygonRefPoints[10]; }; P2 PolygonSet{PolygonRefPoints{[0]{[0] 9.7, [1] 8.988,..}, …….. [10]{[0] 22.0, [1] 60.1, …}}}; 3.3.4 Attribute Value Initialization(4) Initialization of collections

22 SNU OOPSLA Lab.22 3.3.5 Link Definitions(1) Cardinality “One” relationships interface Person { relationship Company Employer inverse Company::Employees; }; Jack Person{Employer McPerth} Cardinality “Many” relationships interface Company { relationship set Employees inverse Person::Employer; }; McPerth Company{Employees{Jack, Joe, Jim}}

23 SNU OOPSLA Lab.23 Interface Person { relationship Employer inverse Company::Employees; relationship Property inverse Company::Owner; }; Interface Company { relationship set Employees inverse Person::Employer; relationship Person Owner inverse Person::Property; }; Jack Person{Employer McPerth} McPerth Company{Owner Jack} 3.3.5 Link Definitions(2) Cycles

24 SNU OOPSLA Lab.24 interface Node { relationship set Pred inverse Node::Succ; relationship set Succ inverse Node::Pred; }; A Node{Pred {B}} E Node B Node{Pred{E}, Succ{C}} C Node{Pred{A}, Succ{F}} F Node 3.3.6 Data Migration Forward declarations –visible within the entire set of OIF files –appear at arbitrary locations within the files

25 SNU OOPSLA Lab.25 3.3.7 Command Line Utilities Dump database –dump a database –command odbdump Load database –load a database –command odbload ….


Download ppt "Chapter 3 Object Specification Languages Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National Univ."

Similar presentations


Ads by Google