Modified Slides from Dr.Peter Buneman 1 XML Constraints Constraints are a fundamental part of the semantics of the data; XML may not come with a DTD/type.

Slides:



Advertisements
Similar presentations
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
Advertisements

XML, XML Schema, Xpath and XQuery Slides collated from various sources, many from Dan Suciu at Univ. of Washington.
1 XML Data Management 2. XML Syntax Werner Nutt. 2 HTML Designed for publishing hypertext on the Web Describes how a browser should arrange text, images,
From Semistructured Data to XML: Migrating The Lore Data Model and Query Language Roy Goldman, Jason McHugh, Jennifer Widom Stanford University
1 Lecture 10 XML Wednesday, October 18, XML Outline XML (4.6, 4.7) –Syntax –Semistructured data –DTDs.
Keys For XML Peter Buneman Susan Davidson Wenfei Fan Carmem Hara Wang Chiew Tan.
Storing and Querying Ordered XML Using Relational Database System Swapna Dhayagude.
1 Relational Model. 2 Relational Database: Definitions  Relational database: a set of relations  Relation: made up of 2 parts: – Instance : a table,
The Relational Model Lecture 3 Book Chapter 3 Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC) From ER to Relational.
1 XML Constraints Wenfei Fan University of Edinburgh and Bell Laboratories.
Semi-structured Data. Facts about the Web Growing fast Popular Semi-structured data –Data is presented for ‘human’-processing –Data is often ‘self-describing’
Storing and Querying Ordered XML Using a Relational Database System By Khang Nguyen Based on the paper of Igor Tatarinov and Statis Viglas.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
1 Keys for XML Peter Buneman, Susan Davidson, Wenfei Fan Carmem Hara, Wang-Chiew Tan Carmem Hara, Wang-Chiew Tan University of Pennsylvania Temple University.
July 14, 2015ICS 424: recap1 Relational Database Design: Recap of ICS 324.
1 Modelling Hachim Haddouti Al Akhawayn University SSE
Documents vs. Databases
1 Advanced Topics XML and Databases. 2 XML u Overview u Structure of XML Data –XML Document Type Definition DTD –Namespaces –XML Schema u Query and Transformation.
4/20/2017.
XML-to-Relational Schema Mapping Algorithm ODTDMap Speaker: Artem Chebotko* Wayne State University Joint work with Mustafa Atay,
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation Document Type Definition.
Relational Data Model, R. Ramakrishnan and J. Gehrke with Dr. Eick’s additions 1 The Relational Model Chapter 3.
Lecture 6 of Advanced Databases XML Schema, Querying & Transformation Instructor: Mr.Ahmed Al Astal.
Concepts and Terminology Introduction to Database.
XMLI Structure of XML Data Structure of XML Data XML Document Schema XML Document Schema XPATH XPATH.
What is XML?  XML stands for EXtensible Markup Language  XML is a markup language much like HTML  XML was designed to carry data, not to display data.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
Processing of structured documents Spring 2002, Part 2 Helena Ahonen-Myka.
Avoid using attributes? Some of the problems using attributes: Attributes cannot contain multiple values (child elements can) Attributes are not easily.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Winter 2006Keller, Ullman, Cushing18–1 Plan 1.Information integration: important new application that motivates what follows. 2.Semistructured data: a.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation Identity Constraints.
Copyright © 2004 Pearson Education, Inc.. Chapter 26 XML and Internet Databases.
1 The Relational Model. 2 Why Study the Relational Model? v Most widely used model. – Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. v “Legacy.
FALL 2004CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Relational Data Model Ch. 7.1 – 7.3 John Ortiz Lecture 3Relational Data Model2 Why Study Relational Model?  Most widely used model.  Vendors: IBM,
University of Crete Department of Computer Science ΗΥ-561 Web Data Management XML Data Archiving Konstantinos Kouratoras.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
Chapter 23 XML. 2 Introduction  XML: eXtensible Markup Language (What is a Markup language?)  Defined by the WWW Consortium (W3C)  Originally intended.
CPT-S Topics in Computer Science Big Data 1 1 Yinghui Wu EME 49.
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation Mapping RDB Schema to.
The Semistructured-Data Model Programming Languages for XML Spring 2011 Instructor: Hassan Khosravi.
CS 157B Database Systems Dr. T Y Lin. Updates 1.Red color denotes updated data (ppt) 2.Class participation will be part of “extra” credits to to “quiz.
Introduction to DTD A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list.
Deriving Relation Keys from XML Keys by Qing Wang, Hongwei Wu, Jianchang Xiao, Aoying Zhou, Junmei Zhou Reviewed by Chris Ying Zhu, Cong Wang, Max Wang,
Working with XML. Markup Languages Text-based languages based on SGML Text-based languages based on SGML SGML = Standard Generalized Markup Language SGML.
XPath --XML Path Language Motivation of XPath Data Model and Data Types Node Types Location Steps Functions XPath 2.0 Additional Functionality and its.
Efficient Discovery of XML Data Redundancies Cong Yu and H. V. Jagadish University of Michigan, Ann Arbor - VLDB 2006, Seoul, Korea September 12 th, 2006.
1 Storing and Maintaining Semistructured Data Efficiently in an Object- Relational Database Mo Yuanying and Ling Tok Wang.
SEMI-STRUCTURED DATA (XML) 1. SEMI-STRUCTURED DATA ER, Relational, ODL data models are all based on schema Structure of data is rigid and known is advance.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
CITA 330 Section 2 DTD. Defining XML Dialects “Well-formedness” is the minimal requirement for an XML document; all XML parsers can check it Any useful.
CS 480: Database Systems Lecture 26 March 18, 2013.
XML: Extensible Markup Language
CS 480: Database Systems Lecture 25 March 15, 2013.
Chapter 2: Intro to Relational Model
Translation of ER-diagram into Relational Schema
A Normal Form for XML Documents
Managing XML and Semistructured Data
The Relational Model Relational Data Model
Relational Databases The Relational Model.
Relational Databases The Relational Model.
XML Data DTDs, IDs & IDREFs.
The Relational Model Textbook /7/2018.
Semi-Structured data (XML Data MODEL)
2/18/2019.
Lecture 9: XML Monday, October 17, 2005.
XML Constraints Constraints are a fundamental part of the semantics of the data; XML may not come with a DTD/type – thus constraints are often the only.
Semi-Structured data (XML)
Presentation transcript:

Modified Slides from Dr.Peter Buneman 1 XML Constraints Constraints are a fundamental part of the semantics of the data; XML may not come with a DTD/type – thus constraints are often the only means to specify the semantics of the data Constraints have proved useful in –semantic specifications: obvious –query optimization: effective –database conversion to an XML encoding: a must –data integration: information preservation –update anomaly prevention: classical –normal forms for XML specifications: “BCNF”, “3NF” –efficient storage/access: indexing, – …

Modified Slides from Dr.Peter Buneman 2 Keys and Foreign Keys Example: school document keys: locating a specific object, an invariant connection from an object in the real world to its representation  student,  course foreign keys: referencing an object from another object   course   student

Modified Slides from Dr.Peter Buneman 3 The limitations of the XML standard (DTD) ID and IDREF attributes in DTD vs. keys and foreign keys in RDBs Scoping: –ID unique within the entire document (like oids), while a key needs only to uniquely identify a tuple within a relation –IDREF untyped: one has no control over what it points to -- you point to something, but you don’t know what it is!

Modified Slides from Dr.Peter Buneman 4 The limitations of the XML standard (DTD) keys need to be multi-valued, while IDs must be single-valued (unary) enroll (sid: string, cid: string, grade:string) a relation may have multiple keys, while an element can have at most one ID (primary) ID/IDREF can only be defined in a DTD, while XML data may not come with a DTD/schema ID/IDREF, even relational keys/foreign keys, fail to capture the semantics of hierarchical data – will be seen shortly

Modified Slides from Dr.Peter Buneman 5 To overcome the limitations Absolute key: (Q, {P 1,..., P k } ) target path Q: to identify a target set [[Q]] of nodes on which the key is defined (vs. relation) a set of key paths {P 1,..., P k }: to provide an identification for nodes in [[Q]] (vs. key attributes) semantics: for any two nodes in [[Q]], if they have all the key paths and agree on them up to value equality, then they must be the same node (value equality and node identity) ( //student, ( //student, {//name}) ( ( //,

Modified Slides from Dr.Peter Buneman 6 Value equality on trees Two nodes are value equal iff either they are text nodes (PCDATA) with the same value; or they are attributes with the same tag and the same value; or they are elements having the same tag and their children are pairwise value equal... db “ ” name firstNamelastName “George” “Bush” name firstNamelastName “George” “Bush” “JohnDoe”

Modified Slides from Dr.Peter Buneman 7 Path expressions Path expression: navigating XML trees A simple yet powerful path language: q ::=  | l | q/q | //  : empty path l: tag q/q: concatenation //: descendants and self – recursively descending downward

Modified Slides from Dr.Peter Buneman 8 New challenges of hierarchical XML data How to identify in a document a book? a chapter? a section? db book titlechapter “XML” chapter section “1”“Bush, a C student,...” “6” numbersection numbertextnumber “10” number “1”number “1” section number “5” titlechapter “SGML” number “1” chapter number “10”

Modified Slides from Dr.Peter Buneman 9 Relative constraints Relative key: (Q, K) path Q identifies a set [[Q]] of nodes, called the context; k = (Q’, {P 1,..., P k } ) is a key on sub-documents rooted at nodes in [[Q]] (relative to Q). Example. (//book, (chapter, {number})) (//book/chapter, (section, {number})) (//book, {title})-- absolute key Analogous to keys for weak entities in a relational database: the key of the parent entity an identification relative to the parent entity

Modified Slides from Dr.Peter Buneman 10 Examples of XML constraints absolute(//book, {title}) relative(//book, (chapter, {number})) relative(//book/chapter, (section, {number})) db book titlechapter “XML” chapter section “1”“Bush, a C student,...” “6” numbersection numbertextnumber “10” number “1”number “1” section number “5” titlechapter “SGML” number “1” chapter number “10”

Modified Slides from Dr.Peter Buneman 11 Absolute vs. relative keys Absolute keys are a special case of relative keys: (Q, K) when Q is the empty path Absolute keys are defined on the entire document, while relative keys are scoped within the context of a sub-document Important for hierarchically structured data: XML, scientific databases, … absolute(//book, {title}) relative(//book, (chapter, {number})) relative(//book/chapter, (section, {number})) XML keys are more complex than relational keys!

Modified Slides from Dr.Peter Buneman 12 Key and Keyref in XML Schema Rules for : must occur after all the element and attribute declarations + primary key rules Example Usage of Rules for : fields in keyref must match in type and position with fields in key Example Usage of