1
Applications of ORA-SS:Applications of ORA-SS:
An Object-Relationship-Attribute Model for Semistructured DataAn Object-Relationship-Attribute Model for Semistructured Data
Tok Wang Ling1
Mong Li Lee1
Gillian Dobbie2
1Department of Computer Science, National University of Singapore2Department of Computer Science, The University of Auckland, NZ
2
ContentContent Part I ORA-SS: An Object-Relationship-Attribute
Model for Semistructured Data– Object class– Relationship Type– Attribute– Semistructured data instance– Functional dependencies and other constraints– Inheritance hierarchy
Part II Research Topics using ORA-SS Model– Normal form ORA-SS schema diagram– Storage schema for ORA-SS/XML databases– ORA-SS/XML views– Evaluating XML queries on ORA-SS databases– Translating relational schema into ORA-SS schema– Integration of XML documents
3
MotivationMotivation
(a) OEM Diagram
Figure 1: Sample instance demonstrating OEM and dataguide
(B) Dataguide
▼♦ department
▼♦ student
▼♦ course
♦ name ♦ number
♦ student number ♦ name ♦ grade
♦ number ♦ name
department
cs
student
number name
computer science
&3
&1
course course
number
&20
name
&21 &22
number
grade
1234 B.Y.Smith 70 1235 C.U. Brown 60
cs4221 Database
&26
&7
student
&4
&2
name
&5
student
&6
student number
&23
name
&24
grade
&25
studentnumber
name
&27 &28
4
Motivation (cont.)Motivation (cont.)
Student
Figure 2: ORA-SS instance diagram
Figure 3: ORA-SS schema diagram
Name: Computer
Science course course
Number: CS
department
Number:CS4221
Name:Database
student
Studentnumber:1234
Name:B.Y. Smith
Grade:70
student
Studentnumber:1235
Name:C.U. Brown
Grade:60
NumberName
studentnumber
department
course2, 1:n, 1:1
studentnumber name
name grade
cs
number namecs
5
ORA-SSORA-SS
The Data ModelThe Data Model Object class
– attributes of object class– ordering on object class
Relationship Type– attributes of relationship type– degree of n-ary relationship type– participation of objects in relationship type– disjunctive relationship type– recursive relationship type– symmetric relationship type
6
ORA-SSORA-SS
The Data Model (cont.)The Data Model (cont.) Attribute
– key attribute– degree of n-ary relationship type– composite attribute– disjunctive attribute– attributes with unknown structure– ordering on attribute– fixed and default values of attribute– derived attribute
Semistructured data instance
Functional dependencies and other constraints
Inheritance hierarchy
7
The data model of ORA-SSThe data model of ORA-SS
Object ClassObject Class
student
number first name last nameFigure 4: Object class student with attributes
in an ORA-SS schema diagram
–attributes of object class
–ordering on object class
8
The data model of ORA-SSThe data model of ORA-SS Relationship TypeRelationship Type– attributes of relationship type– degree of n-ary relationship type– participation of objects in relationship type– disjunctive relationship type– recursive relationship type– symmetric relationship typeproject
id namemember
name job title publication
number title
2, +, +
2, *, +
(a) ORA-SS Schema Diagram (b) Instance Relationship
♦ number ▼♦ publication
▼♦ project
▼♦ member ♦ name
♦ title
♦ job title
♦ name ♦ id
(c) Dataguide
Figure 5: Representing binary relationship type
p1
p2
p3
m1
m2
pub1
pub2
pub3
project member publication
9
The data model of ORA-SSThe data model of ORA-SS
Relationship Type (cont.)Relationship Type (cont.)
project
id namemember
name job title publication
number title
2, +, +
3, *, +
(a) ORA-SS Schema Diagram
(b) Instance Relationship
(c) Dataguide
Figure 6: Representing ternary relationship type
p1
p2
p3
m1
m2
pub1
pub2
pub3
project member publication
♦ number ▼♦ publication
▼♦ project
▼♦ member ♦ name
♦ title
♦ job title
♦ name ♦ id
10
The data model of ORA-SSThe data model of ORA-SS AttributeAttribute– key attribute– degree of n-ary relationship type– composite attribute– disjunctive attribute– attribute with unknown structure– ordering on attribute– fixed and default values of attribute– derived attribute
hobby
course
student*codetitle ANY
dept prefixD: comp
number *studentnumber
firstname
lastname
mark grade
cs cs
cs2, 4:n, 3:8
Figure 7: Object classes with relationship type and attributes in an ORA-SS schema diagram
11
The data model of ORA-SSThe data model of ORA-SS OrderingOrdering
– the instances of an object class can be ordered,– the values of an attribute can be ordered, and– the set of attributes of an object class can be ordered
book
* content
chapter
paragraph
title author
preface toc
text
2, 1:1, 1:1<
<cc,3, 1:n, 1:1
4, 1:n, 1:1
Figure 8: Ordered object classes and attributes in an ORA-SS schema diagram
<
<
12
The data model of ORA-SSThe data model of ORA-SS DisjunctionDisjunction
– disjunctive object class, and– disjunctive attribute.
Figure 9: Disjunctive attribute and relationship type in an ORA-SS schema diagram
code
numberstreetname
course
title
examvenue
lecture theatre laboratorystudent
hostel home
studentnumber
name grade
name
cs,2, 4:n, 3:8
address, 2, ?, +
cs
13
The data model of ORA-SSThe data model of ORA-SS ReferencesReferences
Figure 10: Referencing an object class in an ORA-SS Schema Diagram
course
studentcode title
grade
student
faculty
facultyname
fs,2, 1:n, 1:n
*fs,
facultygradehistory
hostel home
cs,2, 4:n, 3:8
streetnumber
coursecode
student number
grade
name
cs
14
The data model of ORA-SSThe data model of ORA-SS References (cont.)References (cont.)
course
code title course
2, 0:5, 1:n
Figure 11: Example of a recursive relationship type in an ORA-SS Schema Diagram
cs
course
studentcoursenumber
numberof students
cs,2, +, +
student
coursestudentnumber
name
2, +, +
grade
Figure 12: Symmetric relationship types in an ORA-SS schema diagram
15
The data model of ORA-SSThe data model of ORA-SS Reference (cont.)Reference (cont.)
Figure 13: ORA-SS schema diagram
sct
student
name course
sc,2, 3:8, 4:n
code title grade
sc
tutor
sct,3, 1:1, 1:n
name office feedback
hostel home
name number street
tutor
ct,2, +, +
ct
hours
building room
16
The data model of ORA-SSThe data model of ORA-SS Reference (cont.)Reference (cont.)
Figure 14: ER diagram of schema in Figure 13.
student sc course
ctfeedback sct hours
tutor
name office
building room
hostel home
name number street
name grade code title
3:8 4:n
1:11:n
1:n1:n
UNION
addressta
17
The data model of ORA-SSThe data model of ORA-SS Functional DependenciesFunctional Dependencies
student, course tutor
tutor course
1/n
n/1n/_student course
tutor
sct
Figure 15: Functional dependencies diagram
18
The data model of ORA-SSThe data model of ORA-SS Inheritance HierarchyInheritance Hierarchy
staffnumber
studentnumber
3,+,+3,+,+gradetitle
sc,2,+,+student
number
course
student
faculty tutor
ssn ssn payratedegree
(a) ORA-SS Schema Diagram
staffnumber
person
payratedegree
student
tutor
ssn
studentnumber
faculty
(b) Inheritance Diagram
Figure 16: ORA-SS schema diagram and inheritance diagram
ssn
Studentnumber
19
The data model of ORA-SSThe data model of ORA-SS ConstraintsConstraints Inclusion dependency Semantic dependencies
(a) Date of employee joined company (b) Date of employee joined department
Figure 17: Modeling join date (jdate) ORA-SS schema diagram
ed,2,1:1,1:n
jdatenamessn
department
employee
?
departmentnumber
ed
name2,1:1,1:n
jdatenamessn
department
employee
?
departmentnumber
name
20
Research Topics for ORA-SS ModelResearch Topics for ORA-SS Model Normal form ORA-SS schema diagram
– remove redundant data– resolve class hierarchy conflicts
Storage schema for ORA-SS/XML databases– use Object Relational Model
ORA-SS/XML Views– derived information from references and class hierarchy– defining views– materialized view maintenance– view updates
Evaluating XML queries on ORA-SS databases– XML schema to ORA-SS Schema– XML document to ORA-SS database
Translating relational schema into ORA-SS schema Integration of XML documents
21
Research Topics for ORA-SS ModelResearch Topics for ORA-SS Model Normal Form ORA-SS Schema DiagramNormal Form ORA-SS Schema Diagram Schema may have a lot of redundant data Update anomalies Normal Form schema is needed
titleauthorISBN
2
2
professor
textbook
staff#name
course
C.Code title
+
22
Research Topics for ORA-SS ModelResearch Topics for ORA-SS Model NF ORA-SS Schema Diagram (cont.)NF ORA-SS Schema Diagram (cont.) Some better solutions: Redundancies are removed, in normal form
staff#
ISBNtitle
titleauthor
professor
textbookstaff# name
course
C.Code
course textbook
+
C.Code titleISBN titleauthor
professor
textbookname
professor
course textbook
+
23
Research Topics for ORA-SS ModelResearch Topics for ORA-SS Model Storage Schema for ORA-SS/XML DatabasesStorage Schema for ORA-SS/XML Databases
Main Rules– Each object class together with its attributes form a nested
relation (object relation)– Each relationship type together with its attribute form a
nested relation (relationship relation)
Nested relations can be handled by Object Relational model, e.g. ORACLE 8i.
24
Research Topics for ORA-SS ModelResearch Topics for ORA-SS Model Storage Schema for ORA-SS/XML DatabasesStorage Schema for ORA-SS/XML Databases
Object Relations
Supplier (S#, Name, (City))
Part (P#, Name, color)
Project(J#, Name, Loc)
Relationship relations
SP (S#, P#, price)
SPJ (S#, P#, J#, Qty)
Constraint:
SPJ[S#, P#] SP[S#, P#]
PriceSP
SPJ3
Loc
City
NameJ#
SP2
Supplier
Project
Name
Part
Name
+
Color
Qty
SPJ
S#
P#
25
Research Topics for ORA-SS ModelResearch Topics for ORA-SS Model ViewsViews What information can be directly derived from
references and class hierarchy
code
facultygradehistory
fs
grade
cs
fs,2,1:n,1:nfaculty
nametitle
cs,2,4:n,3:8
course
student
studentnumber
grade*
faculty
student
coursecode
number streetname
hostel home
|
Referencing an object class in an ORA-SS schema diagram
streetnumbername
cstitle
course
codestudent
grade |
hostel home
studentnumber
cs
26
Research Topics for ORA-SS ModelResearch Topics for ORA-SS Model Views (cont.)Views (cont.) Valid views of an ORA-SS schema Operations: selection, projection, join, up/down
Qty Qty
total_qty
32
3price
2
Supplier
Project
Part
3
2
price
2
Part
Project
Supplier
3price
Project
Supplier
Part
Qty
Project
Part
223
3
2
2
View 2 View 3View 1
27
Research Topics for ORA-SS ModelResearch Topics for ORA-SS Model Views (cont.)Views (cont.) Views from ORA-SS storage schema
Main Rules– The order of the object classes in a relationship relation can be
changed.– Object classes can be dropped from a relationship relation. In
this case, the attributes of the relationships will have different cardinalities or change to some aggregate functions such as sum, max/min, average, etc.
Other Topics on Views– materialized views and maintenance– view update problem
28
Research Topics for ORA-SS ModelResearch Topics for ORA-SS Model Evaluating XML queries on ORA-SS DatabasesEvaluating XML queries on ORA-SS Databases
Map XML schema to ORA-SS schema– Extra information is needed
Map ORA-SS schema to storage schema (OR model) Map XML documents to ORA-SS databases
(using object relational model DBMS) Map XML queries to queries on the ORA-SS
databases– Need to handle recursions and wildcard such as *(any), |(or), !
(not), etc.
Result construction, i.e. to XML documents
Related issues:
29
Research Topics for ORA-SS ModelResearch Topics for ORA-SS Model Translating Relational Schema into ORA-SS SchemaTranslating Relational Schema into ORA-SS Schema
Extra information needed:• FDs and keys
• Inclusion dependencies
• Semantic dependencies
Main steps:• Identify object classes and their attributes from object
relations
• Identify relationship classes and their attributes from relationship relations
• Identify class hierarchy
• Identify non key constraint functional dependencies
• Generate ORA-SS/XML Views for applications.
• Similar to translating relational schema to OO schema
30
Applications of ORA-SSApplications of ORA-SS SummarySummary Introduced ORA-SS model Briefly discussed research topics using
ORA-SS Model– Normal form ORA-SS schema diagram– Storage schema for ORA-SS/XML databases– ORA-SS/XML views– Evaluating XML queries on ORA-SS databases– Translating relational schema into ORA-SS
schema