Object Based Database
Object Based Database
Object-Based Database
Object-Based Databases
• Motivation:
– Permit non-atomic domains (atomic ≡ indivisible)
– Example of non-atomic domain: set of integers,or set of tuples
– Allows more intuitive modeling for applications with complex
data
• Intuitive definition:
– allow relations whenever we allow atomic (scalar) values —
relations within relations
– Retains mathematical foundation of relational model
– Violates first normal form.
Example of a Nested Relation
• Example: library information system
• Each book has
– title,
– a set of authors,
– Publisher, and
– a set of keywords
• Non-1NF relation books
4NF Decomposition of Nested Relation
• Relational systems
– simple data types, powerful query languages, high protection.
• Persistent-programming-language-based OODBs
– complex data types, integration with programming language,
high performance.
• Object-relational systems
– complex data types, powerful query languages, high
protection.
• Note: Many real systems blur these boundaries
– E.g. persistent programming language built as a wrapper on a
relational database offers first two benefits, but may have
poor performance.
XML
XML
• Structure of XML Data
• XML Document Schema
• Querying and Transformation
• Application Program Interfaces to XML
• Storage of XML Data
• XML Applications
Introduction
• XML: Extensible Markup Language
• Defined by the WWW Consortium (W3C)
• Derived from SGML (Standard Generalized
Markup Language), but simpler to use than SGML
• Documents have tags giving extra information
about sections of the document
– E.g. <title> XML </title> <slide> Introduction …</slide>
• Extensible, unlike HTML
– Users can add new tags, and separately specify how the
tag should be handled for display
XML Introduction (Cont.)
• The ability to specify new tags, and to create nested tag
structures make XML a great way to exchange data, not
just documents.
– Much of the use of XML has been in data exchange applications, not as
a replacement for HTML
• Tags make data (relatively) self-documenting
– E.g.
<bank>
<account>
<account_number> A-101 </account_number>
<branch_name> Downtown </branch_name>
<balance> 500 </balance>
</account>
<depositor>
<account_number> A-101 </account_number>
<customer_name> Johnson </customer_name>
</depositor>
</bank>
XML: Motivation
• Data interchange is critical in today’s networked world
– Examples:
• Banking: funds transfer
• Order processing (especially inter-company orders)
• Scientific data
– Chemistry: ChemML, …
– Genetics: BSML (Bio-Sequence Markup Language), …
– Paper flow of information between organizations is being
replaced by electronic flow of information
• Each application area has its own set of standards for
representing information
• XML has become the basis for all new generation data
interchange formats
XML Motivation (Cont.)
• Earlier generation formats were based on plain text with line headers
indicating the meaning of fields
– Similar in concept to email headers
– Does not allow for nested structures, no standard “type” language
– Tied too closely to low level document structure (lines, spaces, etc)
• Each XML based standard defines what are valid elements, using
– XML type specification languages to specify the syntax
• DTD (Document Type Descriptors)
• XML Schema
– Plus textual descriptions of the semantics
• XML allows new tags to be defined as required
– However, this may be constrained by DTDs
• A wide variety of tools is available for parsing, browsing and
querying XML documents/data
Comparison with Relational Data
<!DOCTYPE bank [
<!ELEMENT bank ( ( account | customer | depositor)+)>
<!ELEMENT account (account_number branch_name
balance)>
<! ELEMENT customer(customer_name customer_street
customer_city)>
<! ELEMENT depositor (customer_name account_number)>
<! ELEMENT account_number (#PCDATA)>
<! ELEMENT branch_name (#PCDATA)>
<! ELEMENT balance(#PCDATA)>
<! ELEMENT customer_name(#PCDATA)>
<! ELEMENT customer_street(#PCDATA)>
<! ELEMENT customer_city(#PCDATA)>
]>
Attribute Specification in DTD
• Attribute specification : for each attribute
– Name
– Type of attribute
• CDATA
• ID (identifier) or IDREF (ID reference) or IDREFS (multiple IDREFs)
– more on this later
– Whether
• mandatory (#REQUIRED)
• has a default value (value),
• or neither (#IMPLIED)
• Examples
– <!ATTLIST account acct-type CDATA “checking”>
– <!ATTLIST customer
customer_id ID # REQUIRED
accounts IDREFS # REQUIRED >
IDs and IDREFs
<bank-2>
<account account_number=“A-401” owners=“C100
C102”>
<branch_name> Downtown </branch_name>
<balance> 500 </balance>
</account>
<customer customer_id=“C100” accounts=“A-401”>
<customer_name>Joe </customer_name>
<customer_street> Monroe </customer_street>
<customer_city> Madison</customer_city>
</customer>
<customer customer_id=“C102” accounts=“A-401 A-
402”>
<customer_name> Mary </customer_name>
<customer_street> Erin </customer_street>
<customer_city> Newark </customer_city>
</customer>
</bank-2>
XML Schema