Download presentation
Presentation is loading. Please wait.
Published byLorena Stanley Modified over 9 years ago
1
Company LOGO OODB and XML Database Management Systems – Fall 2012 Matthew Moccaro
2
Outline 1. OODB 2. OODB AND SQL 3. XML 4. XML Queries
3
Object Databases
4
A History First arrived in the 1980s and 1990s Use objects to represent data with a set of attributes. Developed due to certain limitations of the very popular relational model. Let’s take a look at an example of one of these limitations.
5
Limitations Example: Part 1 SSNNamePhoneNChild 111-22-3333Joe Public516-123-4567222-33-4444 111-22-3333Joe Public516-345-6789222-33-4444 111-22-3333Joe Public516-123-4567333-44-5555 111-22-3333Joe Public516-345-6789333-44-5555 222-33-4444Bob Public212-987-6543444-55-6666 222-33-4444Bob Public212-987-1111555-66-7777 222-33-4444Bob Public212-987-6543555-66-7777 222-33-4444Bob Public212-987-1111444-55-6666
6
Limitations Example: Part 2 SSNNamePhoneNChild 111-22-3333Joe Public516-123-4567222-33-4444 111-22-3333Joe Public516-345-6789222-33-4444 111-22-3333Joe Public516-123-4567333-44-5555 111-22-3333Joe Public516-345-6789333-44-5555 222-33-4444Bob Public212-987-6543444-55-6666 222-33-4444Bob Public212-987-1111555-66-7777 222-33-4444Bob Public212-987-6543555-66-7777 222-33-4444Bob Public212-987-1111444-55-6666
7
Limitations Example: Part 3 Explanation There are several ways around this problem, however, they normally lead to more difficulties. More tables, more complex queries. Our solution can be an OODB. To help explain an object database, let’s compare it to something we are familiar with, the relational model.
8
Object Vs. Relational: Part 1 Object Database Relational Database Contains Classes which are: Sets of Objects Contains Relations which are: Sets of Tuples
9
Object Vs. Relational: Part 2 Object Database Relational Database Components of an object can be complex types. Sets, Tuples, Objects….. Components of a tuple must be primitive types. Strings, Integers…
10
Object Vs. Relational: Part 3 Object Database Relational Database Objects can have inheritance. Objects can have methods. Can be all in the same language. N/A
11
OODB TEXT The Conceptual Object Data Model Helps us to understand OODB. Let’s take a better look at: Objects Classes Types
12
The Conceptual Object Data Model TEXT Objects In this model, each object has an individual ID. Called an “oid” Different from a Primary Key Cannot change for an object Values Can Change Can be complex
13
The Conceptual Object Data Model TEXT Classes Organizes similar objects Class called Person contains objects with information regarding each person. Classes Have: Type Method Signatures Extent
14
The Conceptual Object Data Model TEXT Types Types could be: Basic Reference Tuple Set Subtype and Supertype
15
Object-Relational Database Object Relational Database Combination of Object and Relational Databases Top Level Classes which contain tuples. These classes are called “relations.” Tuples are “tuple objects.” Top level structure is always a tuple. Can have complex values.
16
Object Databases Object Databases and SQL
17
Object Databases A History First added to SQL in SQL:1999 Created with backwards compatibility in mind. SQL-92 Remained in SQL:2003, SQL:2008, and SQL:2011.
18
Row Type A New Type To create a tuple type in SQL, we can now use the row keyword: CREATE TABLE Person( Name CHAR(20), Address ROW(Number INTEGER, STREET CHAR(20), ZIP CHAR(5))) To insert new values: INSERT INTO Person(Name, Address) VALUES (‘John Doe’, ROW(666, ‘Hollow Rd.’, ‘66666’))
19
Creating Objects Creating A Type To create an object in SQL, we need to go through a few steps. 1.First we can define a type. CREATE TYPE StudentType AS( Address ROW(Number INTEGER, STREET CHAR(20), ZIP CHAR(5))) Id INTEGER, Status CHAR(2));
20
Creating Objects Creating A Table 2.Next, we can create a new table from our type. CREATE TABLE Student OF StudentType; SQL regards the rows of a table declared in this way as objects. The book introduces many other new concepts in this area.
21
XML XMLXML
22
A History XML was first developed in the late 1990s and came into popularity soon after. EXtensible Markup Language HTML displays data, XML carries data File Extension is.xml Let’s create a file….
23
XML Example File First, we can start by making an XML declaration…..
24
XML Example File Comments are done as
25
XML Example File All elements must have an open and close tag. Close tags have a “/” Let’s make a menu. So we’ll declare some menu tags. This is called the root element.
26
XML Example File Now let’s put an entrée section.
27
XML Example File Sunburnt Chicken Let’s add some details. How about a name?
28
XML Example File Sunburnt Chicken 23 And a detail about this entrée.
29
XML Example File Sunburnt Chicken 23 Gusto Spaghetti 55 Let’s add an entirely new entrée.
30
XML Example File Sunburnt Chicken 23 Gusto Spaghetti 55 Attributes can help make things more clear. We could do this….
31
XML Example File Sunburnt Chicken 23 Gusto Spaghetti 55 But you can also add attributes within a tag.
32
XML Can be formatted in several ways. CSS XSLT Documents can be validated by: XML Schemas DTDs Let’s take a look at some XML queries….
33
XML Queries
34
XML Schema DTD XSLT XQuery XPath XML
35
XML Query Languages XPathXSLT XQuery Solutions for XML Queries
36
XPath XML Query Language which views XML documents as trees. Things such as comments and elements are nodes of these trees. Allows us to traverse the tree and find a “path” to what we need. Gives us an easy to understand language for querying XML Documents.
37
XSLT XSL Transformation Files usually called stylesheets. Can be used to query and to format XML Includes conditional instructions…. More powerful query language which can utilize parts of XPath. Certain queries such as joins can still be difficult in XSLT.
38
XQuery Built by taking the best parts of two other query languages, XQL and XML-QL. Still uses XPath as a syntax for its expressions. More similar to SQL: FOR (variable declarations) WHERE (condition) RETURN (result)
39
SQL/XML Slowly becoming part of the SQL standard. Allows us to work directly with XML documents from SQL. Many vendors such as Oracle, MS SQL Server, MySQL, and PostgreSQL already have much functionality built-in.
40
Summary 1. OODB 2. OODB AND SQL 3. XML 4. XML Queries Object Databases help us to excel where the relational model may be cumbersome. Allow us to integrate objects into our databases while still utilizing SQL. A highly customizable language which helps us to represent data almost universally. Gives us many different languages to use XML to its full potential.
41
The End Thank You!
42
References: Wagner, Richard and Richard Mansfield. XML for Dummies For Dummies. 2003. Kifer, Michael and Arthur Bernstein, and Philip M. Lewis Database Systems Boston: Pearson Education, 2006 XML Tutorial. W3 Schools. 2012 Web. Nov. 2012 http://www.w3schools.com/xml/ SQL/XML. Wikipedia. 2012 Web. Nov. 2012 http://en.wikipedia.org/wiki/SQL/XML
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.