Presentation is loading. Please wait.

Presentation is loading. Please wait.

IS432 Semi-Structured Data Lecture 3: XSchema Dr. Gamal Al-Shorbagy.

Similar presentations


Presentation on theme: "IS432 Semi-Structured Data Lecture 3: XSchema Dr. Gamal Al-Shorbagy."— Presentation transcript:

1 IS432 Semi-Structured Data Lecture 3: XSchema Dr. Gamal Al-Shorbagy

2 In this lecture XML Schemas Elements v. Types Regular expressions Expressive power Resources W3C Draft: www.w3.org/TR/2001/REC-xmlschema-1-20010502

3 XML Schemas http://www.w3.org/TR/xmlschema-1/10/2000 generalizes DTDs uses XML syntax two documents: structure and datatypes –http://www.w3.org/TR/xmlschema-1 –http://www.w3.org/TR/xmlschema-2 XML-Schema is very complex –often criticized –some alternative proposals

4 XML Schema Requirements Structural –namespaces –primitive types & structural schema integration –inheritance Data type –integers, dates, … (like in languages) –user-defined (constrain some properties) Conformance –processors, validity

5 Design Principles More expressive than DTDs Expressed in XML Self-describing Usable by various XML applications Simple enough

6 XML Schemas DTD:

7 Elements v.s. Types in XML Schema DTD:

8 Types: –Simple types (integers, strings,...) –Complex types (regular expressions, like in DTDs) Element-type-element alternation: –Root element has a complex type –That type is a regular expression of elements –Those elements have their complex types... –... –On the leaves we have simple types Elements v.s. Types in XML Schema

9 Local and Global Types in XML Schema Local type: [define locally the person’s type] Global type: [define here the type ttt] Global types: can be reused in other elements

10 Local v.s. Global Elements in XML Schema Local element:... Global element:... Global elements: like in DTDs

11 Regular Expressions in XML Schema Recall the element-type-element alternation: [regular expression on elements] Regular expressions: A B C = A B C A B C = A | B | C A B C = (A B C).. = (...)*.. = (...)?

12 Local Names in XML-Schema............................ name has different meanings in person and in product

13 Subtle Use of Local Names Arbitrary deep binary tree with A elements, and a single B element

14 Attributes in XML Schema............ Attributes are associated to the type, not to the element Only to complex types; more trouble if we want to add attributes to simple types.

15 “Mixed” Content, “Any” Type Better than in DTDs: can still enforce the type, but now may have text between any elements Means anything is permitted there....

16 “All” Group A restricted form of & in SGML Restrictions: –Only at top level –Has only elements –Each element occurs at most once E.g. “comment” occurs 0 or 1 times

17 Derived Types by Extensions Corresponds to inheritance

18 Derived Types by Restrictions (*): may restrict cardinalities, e.g. (0,infty) to (1,1); may restrict choices; other restrictions… … [rewrite the entire content, with restrictions]... Corresponds to set inclusion

19 Simple Types String Token Byte unsignedByte Integer positiveInteger Int (larger than integer) unsignedInt Long Short... Time dateTime Duration Date ID IDREF IDREFS

20 Facets of Simple Types Examples length minLength maxLength pattern enumeration whiteSpace maxInclusive maxExclusive minInclusive minExclusive totalDigits fractionDigits Facets = additional properties restricting a simple type 15 facets defined by XML Schema

21 Facets of Simple Types Can further restrict a simple type by changing some facets Restriction = subset

22 Not so Simple Types List types: Union types Restriction types 20003 15037 95977 95945

23 An Example Document (1/2) Matthias Hauswirth 4500 Brookfield Dr. Boulder CO 80303 Brian Temple 1234 Strasse Boulder CO 80302...

24 An Example Document (2/2) Brian pays Porsche 1 129400.00 Need a new one Ferrari 2 189000.25 1999-05-21

25 An Example Schema (1/3)...

26 An Example Schema (2/3) <xsd:attribute name=“country” type=“xsd:NMTOKEN” use=“fixed” value=“US”/>...

27 An Example Schema (3/3)

28 XSchema-Tools XML Schema-aware Parser –Xerces-J –Oracle XML Schema Processor XML Schema Validator (XSV, online) DTD to Schema Conversion Tools XML Schema Editor –Extensibility’s XML Authority XML Schema-aware Instance Editor –Extensibility’s XMLInstance –ChannelPoint’s Merlot (maybe in future)

29 Summary of XML Schema Formal Expressive Power: –Can express precisely the regular tree languages (over unranked trees) Lots of other stuff –Some form of inheritance –A “null” value –Large collection of data types


Download ppt "IS432 Semi-Structured Data Lecture 3: XSchema Dr. Gamal Al-Shorbagy."

Similar presentations


Ads by Google