1 Modelling Hachim Haddouti Al Akhawayn University SSE
2 Hachim Haddouti 2 TOC n Intro n DTD, XML Schmea n Derivation of Schemainformationen from XML Documents n Metrics n Recommendations
3 Hachim Haddouti 3 Schema for XML Documents n DTDs –( SGML, simple, compact, easily readable, no XML Syntax) n XML Schema –(more presentation possibilties, Data types, exact cardinalities,...)
4 Hachim Haddouti 4 Document Type Definitions See slides of first chapter
5 Hachim Haddouti 5 XML Schema /2 In May 2001, XML Schema officially n More presentation possibilities, n Simpler schema language n More built-in datatypes n Ability to define own datatypes n Ability to restrict datatype values, n Syntax closer to that of XML n more complexity than DTD
6 Hachim Haddouti 6 Built-in Types
7 Hachim Haddouti 7 Extensibility of XML schemas n Namespace: a collection of type definitions and element declarations. n Can be shared between different schema to aid in the reuse of types and constructs. n Expand more on you own (Namespace Qualification, target namespaces, importing/inlcuding/redefining” namespaces
8 Hachim Haddouti 8 Definition von „Integrity Check“ Integrity Conditions to be met in XML Documents n uniqueness n key n Referential integrity (keyref). Definition of Elements and Attributes using Xpath expression.
9 Hachim Haddouti 9 Referential integrity n Recall ID, IDREF –can these serve as primary/foreign keys?
10 Hachim Haddouti 10 Referential integrity n Uniqueness –XML Schema enables us to indicate that any attribute or element value must be unique within a certain scope –Fields defined as unique cannot contain null values –Still not a candidate for primary/foreign key
11 Hachim Haddouti 11 Relationship constraints, cont. n KEY, KEYREF –like unique, key must be unique within a certain scope –key can be based on multiple fields –key can be referenced –analogous to primary/foreign key n Compare ID in DTD to key in XML Schema? Global Uniqueness?
12 Hachim Haddouti 12 Example <xs:field n selector indicate a node set, that has to be unique. n With field you specify exactly, which element value or Attribut should be unique.
13 Hachim Haddouti 13 Key, Keyref: Defining a combined key...
14 Hachim Haddouti 14 Key, Keyref: Defining a combined key...
15 Hachim Haddouti 15 Key, Keyref: Defining a combined key <!-- vehicles are keyed by a pair of state and plate --> scope --> <!-- combination must be unique-->
16 Hachim Haddouti 16 Tradeoffs n DTD’s –Large Amount of Tool Support –Established –Non-XML Syntax –No typing of values –Difficult to specify unordered sets of subelements –For high speed validation, DTDs may outperform Schema n XML Schema –More control over scope of elements and where they can be used –XML syntax –Datatypes –Namespaces –Able to specify sets more precisely –Less Tool Support –More complicated language
17 Hachim Haddouti 17 XML Schema vs. DTD n XML Schema contains all modelling abilities of DTD, except Entities. n Conversion: DTD in XML Schema lossless, Entities will be expanded. n Conversion: XML Schema in DTDs with loss
18 Hachim Haddouti 18 Usage of XML Schema n Data centric Applications n Import in and Export from DBs n Use data types and integrity checks n XML Databases: SQL/XML
19 Hachim Haddouti 19 Tools Editors XMLSpy ( ) XML Authority ( n XML Writer XML-Prozessors XML Schema Quality Checker of IBM alphaworks ( XML Schema Validator of Oracle (technet.oracle.com/tech/xml/).oracle.com/tech/xml/