1 / 23

Type System for an Object-Oriented Database Programming Language

Type System for an Object-Oriented Database Programming Language. Yuri Leontiev yuri@cs.ualberta.ca http://www.cs.ualberta.ca/~yuri University of Alberta Edmonton, Alberta Canada T6G 2H1. Persistent (Database) Programming Languages. Object-Oriented Database Systems.

fadhila
Télécharger la présentation

Type System for an Object-Oriented Database Programming Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Type System for an Object-Oriented Database Programming Language Yuri Leontiev yuri@cs.ualberta.ca http://www.cs.ualberta.ca/~yuri University of Alberta Edmonton, Alberta Canada T6G 2H1

  2. Persistent (Database)Programming Languages Object-OrientedDatabase Systems Object-OrientedProgramming Languages The concept of an OODBPL OODBPLs 2

  3. Requirement Summary • Verifiability • Decidability • Substitutability • Multi-methods • Mutable types • Parametric types 3

  4. Language Comparison Language C++JavaPizzaSatherCecilMini-CecilTransframeMLMLPolyTOILTIGUKAT Theory D/USD/USD/SD/SD/USUD?/SD/USD/SD/SD/SD/S Subst.(5) 34055555555 Multi-m.(5) 0000555n/a505 Mutable(5) 55555553355 Param.(5) 20333542325 Tests(30) 56111816272512161630 4

  5. Behaviors Functions Implementationfunctions Implementationtypes Classes Types 3-Layer Design Functionality Structure 5

  6. T_Shape Subtypes xCenter; yCenter;intersects(T_Shape) T_Rectangle T_Circle height;width; radius; Implements T_Point Extends C_Point C_Rectangle C_Circle _xCenter;_yCenter; _width;_height; _radius Types and Classes 6

  7. Multi-methods T_Shape Subtypes xCenter; yCenterintersects(T_Shape) T_Rectangle T_Circle height; width;intersects(T_Rectangle) :: fRRintersects(T_Circle) :: fRCintersects(T_Point) :: fRP radius;intersects(T_Circle) :: fCCintersects(T_Rectangle) :: fCRintersects(T_Point) :: fCP T_Point intersects(T_Point) :: fPPintersects(T_Rectangle) :: fPRintersects(T_Circle) :: fPC T_Shape s1, s2;s1 := aRectangle1; s2 := aRectangle2; s1.intersects(s2) // fRR s1 := aRectangle; s2 := aCircle; s1.intersects(s2) // fRC s1 := aCircle; s2 := aPoint; s1.intersects(s2) // fCP 7

  8. T_Person C_Person3N age :=: T_Natural; name :=: T_String; T_Natural _age; T_String _firstName, _lastName, _middleName;age implementation _age;name implementation fun() { return _firstName + ‘ ‘ + _lastName + ‘ ‘ + _middleName; }set_name implementation fun(arg) { _firstName := arg.extractToken(2,’ ’); _lastName := arg.extractToken(3,’ ’); _middleName := arg.extractToken(1,’ ’); } Implements C_Person T_Natural _age; T_String _name;age implementation _age;name implementation _name; Attributes T_Person aPerson;aPerson := new C_Person; aPerson.name := “S. John Smith”; aPerson := new C_Person3N; aPerson.name := “S. John Smith”; aPerson.name.print; 8

  9. Parametric Types T_InputStream(covar X) get : X; T_OutputStream(contravar X) Subtypes put(X); T_IOStream(novar X) T_InputStream(T_Person) ip; T_InputStream(T_Student) is;ip.get.age.print; ip := is; ip.get.age.print; is.get.studentId.print; T_Person aPerson; T_Student aStudent;T_OutputStream(T_Person) op; T_OutputStream(T_Student) os;op.put(aPerson); op.put(aStudent); os.put(aStudent); os.put(aPerson) T_IOStream(T_Student) ios;ip := ios; os := ios; ios.get.studentId.print; op := ios; 9

  10. Comparisons T_Ordered(T_Numeric) T_Ordered(contravar X) less(T_Ordered(X)) : T_Boolean;greater (T_Ordered(X)) : T_Boolean implementation fun(arg) { return not arg.less(self); } T_Numeric T_Real T_Ordered(T_Date) T_Integer T_Date (5.0).less(6); 3.less(3.35); ‘2/3/98’.less(‘3/4/97’); ’2/3/98’.less(3); 10

  11. Constrained Types T_Set(covar X) sort() : T_List(X) where (X subtypes T_Ordered(X)); T_Set(T_Integer) iSet;T_List(T_Integer) iList;iList := iSet.sort; // If iSet was {4,3,5}, // iList will be <3,4,5> T_Set(T_Person) pSet; T_List(T_Person) pList;pList := pSet.sort; 11

  12. Functional Types T_Set(covar X) sort() : T_List(X) where (X subtypes T_Ordered(X));genericSort( (X,X):T_Boolean ) : T_List(X); T_Set(T_Integer) iSet;T_List(T_Integer) iList;iList := iSet.genericSort( fun(x,y) { return x.less(y) } ); T_Set(T_Person) pSet; T_List(T_Person) pList;pList := pSet.genericSort( fun(x,y) { return x.age.less(y.age); } ); 12

  13. Typechecking • Local monotonicity • Consistency of the user type graph • Constraint consistency • Global behavior consistency • Functional consistency • Dispatch consistency • coverage • unambiguity • correctness 13

  14. Theory: Types • Model: regular trees •  = T_List() • Ground types • T_Integer, T_List(T_Integer), (T_Real,T_Integer)  T_Integer • Simple constrained types • (  T_Integer).(  ) • Constrained types • glb((  T_Integer).(  ),T_Date  T_Date) 14

  15. Theory: Entailment • Constraint sets • C = { L1  U1, L2  U2,...,Ln  Un} • Entailment of constraint sets • C1[1,…,n] |-- C2[1,…, n,1,... ,n] iff  1,…, n : C1[1,…, n]   1,... ,n : C2[1,…, n,1,... ,n] • (T_Set(1)  T_Set(2)) |-- 1  2 15

  16. Theory: Subtyping • Subtyping of simple constrained types • (C1).A1  (C2).A2 iff C2 |-- C1 & (A1  A2) • ((T_Set(T_Integer)  T_Set(1)).1) T_Integersince |-- T_Set(T_Integer)  T_Set(1) & 1  T_Integer(let 1 = T_Integer) 16

  17. Contributions • Compiled a comprehensive list of OODBPL type system requirements • Designed a type system that satisfies the requirements • Developed decidable typechecking algorithms • Developed a theory capable of expressing all the type system features • Proved decidability and correctness of the resulting system 17

  18. Future Research • Design issues: • Language design • Persistence model • Implementation issues: • Type checker • Compiler • Optimization • Theoretical issues: • Relaxing user type graph constraints 18

  19. Questions? 19

  20. Type System Features • Verifiability • Decidability • Transparency • Extensibility 20

  21. OOPL Requirements • Inheritance: • interface • implementation • Method types • Method uniformity • Reflexivity 21

  22. DBPL Requirements • Persistence independence • User-defined type constructors • Encapsulation • Parametric types • Partial type specification • Incremental type checking • Typability of SQL-like queries • Mutable object types 22

  23. OODB Requirements • Orthogonal type constructors • Extensibility & interoperability • View mechanism • Dynamic schema evolution 23

More Related