Applications of ORA-SS: An Object-Relationship-Attribute Model for Semistructured Data Tok Wang Ling

advertisement
Applications of ORA-SS:
An Object-Relationship-Attribute Model for Semistructured Data
Tok Wang Ling1
Mong Li Lee1
Gillian Dobbie2
1Department
of Computer Science, National University of Singapore
2Department of Computer Science, The University of Auckland, NZ
1
Content

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
2
▼♦ department
♦ number
♦ name
▼♦ course
♦ number
♦ name
▼♦ student
♦ student number
♦ name
♦ grade
(B) Dataguide
Motivation
department
&1
number
cs
name
course
course
computer science
&3
&2
number name student
&4
&5
cs4221 Database
&6
number name student
student
&7
&20
&21
&22
student name grade
student number name grade number
&23
1234
&24
&25 &26
&27
&28
B.Y.Smith 70 1235 C.U. Brown 60
(a) OEM Diagram
Figure 1: Sample instance demonstrating OEM and dataguide
3
Motivation (cont.)
department
Number: CS
Name:
Computer
Science
student
course
course
student
NumberName Student
Number: Name:
CS4221 Database
department
2, 1:n, 1:1
Grade: number name course cs
Student Name:
Grade: Student Name:
number: C.U. Brown 60
number: B.Y. Smith 70
student
1235
1234
number name
cs
Figure 2: ORA-SS instance diagram
student name grade
number
Figure 3: ORA-SS schema diagram
4
ORA-SS
The 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
5
ORA-SS
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
6
The data model of ORA-SS
Object Class
–attributes of object class
–ordering on object class
student
number first name last name
Figure 4: Object class student with attributes
in an ORA-SS schema diagram
7
The data model of ORA-SS
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
project
2, +, +
id
name
project member publication
member
p1
2, *, +
name job title
publication
m1
pub2
p2
p3
pub1
m2
pub3
▼♦ project
♦ id
♦ name
▼♦ member
♦ name
♦ job title
▼♦ publication
♦ number
♦ title
number title
(a) ORA-SS Schema Diagram
(b) Instance Relationship
(c) Dataguide
Figure 5: Representing binary relationship type
8
The data model of ORA-SS
Relationship Type (cont.)
project
project
id
name
member
p1
2, +, +
p2
member
p3
m1
publication
pub1
pub2
m2
pub3
3, *, +
name job title
publication
(b) Instance Relationship
▼♦ project
number title
(a) ORA-SS Schema Diagram
♦ id
♦ name
▼♦ member
♦ name
♦ job title
▼♦ publication
♦ number
♦ title
(c) Dataguide
Figure 6: Representing ternary relationship type
9
The data model of ORA-SS
Attribute
–
–
–
–
–
–
–
–
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
course
code
title
*
ANY
cs
2, 4:n, 3:8
student
cs
dept prefix number
D: comp
cs
*
student first last mark grade hobby
number name name
Figure 7: Object classes with relationship type and attributes
in an ORA-SS schema diagram
10
The data model of ORA-SS
Ordering
– 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
2, 1:1, 1:1
<
*
title
author
content <
cc,
3, 1:n, 1:1
chapter <
preface toc
4, 1:n, 1:1
paragraph <
text
Figure 8: Ordered object classes and attributes
in an ORA-SS schema diagram
11
The data model of ORA-SS
Disjunction
– disjunctive object class, and
– disjunctive attribute.
course
code
title
exam
venue
cs,
2, 4:n, 3:8
student
lecture theatre
address, 2, ?, +
laboratory
cs
student
number
name
grade
hostel
name
home
number
Figure 9: Disjunctive attribute and relationship type
in an ORA-SS schema diagram
street
name
12
The data model of ORA-SS
References
faculty
course
cs,
2, 4:n, 3:8
code title
student
cs
grade
fs,
2, 1:n, 1:n
faculty
name
student
student
number
course
code
fs,
*
faculty
grade
history
home
hostel
grade
name
number
street
Figure 10: Referencing an object class in an ORA-SS Schema Diagram
13
The data model of ORA-SS
References (cont.)
course
2, 0:5, 1:n
code
title
course
Figure 11: Example of a recursive relationship type
in an ORA-SS Schema Diagram
student
course
2, +, +
cs,
2, +, +
course
number
student
number
of students
cs
student
number
name
course
grade
Figure 12: Symmetric relationship types in an ORA-SS schema diagram
14
The data model of ORA-SS
Reference (cont.)
student
sc,
2, 3:8, 4:n
name
course
sc
sct,
3, 1:1, 1:n
code title grade
ct,
2, +, +
tutor
ct
tutor
sct
hours
name
office feedback
hostel
building
home
room
name
number street
Figure 13: ORA-SS schema diagram
15
The data model of ORA-SS
Reference (cont.)
grade
name
student
3:8
code
4:n
sc
title
course
1:n
1:1
feedback
1:n
hours
ct
sct
1:n
address
ta
tutor
UNION
name
office
hostel
building
home
room
name
number
Figure 14: ER diagram of schema in Figure 13.
street
16
The data model of ORA-SS
Functional Dependencies
student, course  tutor
tutor  course
student
n/_
sct
n/1
course
1/n
tutor
Figure 15: Functional dependencies diagram
17
The data model of ORA-SS
Inheritance Hierarchy
person
student
ssn
student
number
sc,
2,+,+
ssn
student
faculty
tutor
staff
number
course
3,+,+
Student title grade
number
faculty
3,+,+
student
number
tutor
degree payrate
ssn
staff
ssn student degree payrate
number
number
(b) Inheritance Diagram
(a) ORA-SS Schema Diagram
Figure 16: ORA-SS schema diagram and inheritance diagram
18
The data model of ORA-SS
Constraints
Inclusion dependency
 Semantic dependencies

department
department
ed,
2,1:1,1:n
2,1:1,1:n
department
number
name
employee
department
number
name
employee
ed
ssn name
?
jdate
(a) Date of employee joined company
ssn name
?
jdate
(b) Date of employee joined department
Figure 17: Modeling join date (jdate) ORA-SS schema diagram
19
Research 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
20
Research Topics for ORA-SS Model
Normal Form ORA-SS Schema Diagram



Schema may have a lot of redundant data
Update anomalies
Normal Form schema is needed
professor
staff#
2
name
course
2
C.Code
title
textbook
+
ISBN
author
title
21
Research Topics for ORA-SS Model
NF ORA-SS Schema Diagram (cont.)

Some better solutions:
 Redundancies are removed, in normal form
professor
staff# name
course
C.Code
course
professor
staff#
textbook
title
textbook
+
ISBN author title
course
C.Code title
name
professor
textbook
+
textbook
ISBN author
title
22
Research Topics for ORA-SS Model
Storage 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.
23
Research Topics for ORA-SS Model
Storage Schema for ORA-SS/XML Databases
Object Relations
Supplier
+
S#
Name City
Color
Part (P#, Name, color)
SP
Part
P# Name
Supplier (S#, Name, (City))
SP
2
Price
SPJ
3
Relationship relations
SP (S#, P#, price)
Project
SPJ
J# Name Loc
Project(J#, Name, Loc)
Qty
SPJ (S#, P#, J#, Qty)
Constraint:
SPJ[S#, P#]  SP[S#, P#]
24
Research Topics for ORA-SS Model
Views

What information can be directly derived from
references and class hierarchy
code
title
course
faculty
course
cs,
2,4:n,3:8
student
fs,
faculty 2,1:n,1:n
name
student
cs
code
student
cs
fs
cs
grade student
number
|
* faculty
grade
history
course grade
code
title
|
hostel
grade student
number
home
name number street
hostel
name
home
number street
Referencing an object class in an ORA-SS schema diagram
25
Research Topics for ORA-SS Model
Views (cont.)


Valid views of an ORA-SS schema
Operations: selection, projection, join, up/down
Part
2
Supplier
2
3
price
price
Project
2
2
2
3
Project
Project
Part
Supplier
Project
Part
Part
2
2
3
Supplier
2
3
3
total_qty
3
price
Qty
Qty
Qty
View 1
View 2
View 3
26
Research Topics for ORA-SS Model
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
27
Research Topics for ORA-SS Model
Evaluating XML queries on ORA-SS Databases
Related issues:

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
28
Research Topics for ORA-SS Model
Translating 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
29
Applications of ORA-SS
Summary
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
30
Download