Modelling - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Modelling

Description:

( SGML, simple, compact, easily readable, no XML Syntax) XML Schema ... xs:element name='car' !-- begin local element-- xs:complexType ... – PowerPoint PPT presentation

Number of Views:14
Avg rating:3.0/5.0
Slides: 20
Provided by: mei3
Category:
Tags: modelling

less

Transcript and Presenter's Notes

Title: Modelling


1
Modelling
  • Hachim Haddouti
  • Al Akhawayn University
  • SSE
  • H.Haddouti_at_alakhawayn.ma
  • http//mail.alakhawayn.ma/H.Haddouti

2
TOC
  • Intro
  • DTD, XML Schmea
  • Derivation of Schemainformationen from XML
    Documents
  • Metrics
  • Recommendations

3
Schema for XML Documents
  • DTDs
  • ( SGML, simple, compact, easily readable, no XML
    Syntax)
  • XML Schema
  • (more presentation possibilties, Data types,
    exact cardinalities, ...)

4
Document Type Definitions
  • See slides of first chapter

5
XML Schema /2
  • In May 2001, XML Schema officially
  • More presentation possibilities,
  • Simpler schema language
  • More built-in datatypes
  • Ability to define own datatypes
  • Ability to restrict datatype values,
  • Syntax closer to that of XML
  • more complexity than DTD

6
Built-in Types
www.w3.org/TR/2001/REC-xmlschema-2-20010502
7
Extensibility of XML schemas
  • Namespace a collection of type definitions and
    element declarations.
  • Can be shared between different schema to aid in
    the reuse of types and constructs.
  • Expand more on you own (Namespace Qualification,
    target namespaces, importing/inlcuding/redefining
    namespaces

8
Definition von Integrity Check
  • Integrity Conditions to be met in XML Documents
  • uniqueness
  • key
  • Referential integrity (keyref).  
  • Definition of Elements and Attributes using Xpath
    expression.

9
Referential integrity
  • Recall ID, IDREF
  • can these serve as primary/foreign keys?

10
Referential integrity
  • 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
Relationship constraints, cont.
  • 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
  • Compare ID in DTD to key in XML Schema? Global
    Uniqueness?

12
Example
  • ltxskey name"Hotel_key"gt
  • ltxsselector xpath"/Hotelinformationen/Hotel"
    /gt
  • ltxsfield xpath"_at_HotelID/"/
  • lt/xskeygt
  •  
  • ltxskeyref name"Hotel_directory_keyref"
    refer"Hotel_keygt
  • ltxsselector xpath"/ Hotel_directory
    /Location/Hotels"/gt
  • ltxsfield xpath"_at_HotelID"/gt
  • lt/xskeyrefgt
  • selector indicate a node set, that has to be
    unique.
  • With field you specify exactly, which element
    value or Attribut should be unique.

13
Key, Keyref Defining a combined key
ltxselement name"vehicle"gt ltxscomplexTypegtlt!--
begin anonymous type--gt . . . ltxsattribute
name"plateNumber" type"xsinteger"/gt
ltxsattribute name"state" type"twoLetterCode"/gt
lt/xscomplexTypegt lt/xselementgt
14
Key, Keyref Defining a combined key
ltxselement name"person"gtlt!--new global
element--gt ltxscomplexTypegt ltxssequencegt .
. . ltxselement name"car"gtlt!-- begin local
element--gt ltxscomplexTypegt
ltxsattribute name"regState" type"twoLetterCode"
/gt ltxsattribute name"regPlate"
type"xsinteger"/gt lt/xscomplexTypegt
lt/xselementgt lt/xssequencegt
lt/xscomplexTypegt lt/xselementgt
15
Key, Keyref Defining a combined key
ltxskey name"regKey"gt lt!-- vehicles are keyed
by a pair of state and plate --gt ltxsselector
xpath".//vehicle"/gt lt!--node group -gt scope --gt
ltxsfield xpath"_at_state"/gt ltxsfield
xpath"_at_plateNumber"/gt lt!-- combination must
be unique--gt lt/xskeygt ltxskeyref
name"carRef" refer"regKey"gt ltxsselector
xpath".//car"/gt ltxsfield xpath"_at_regState"/gtlt!
-- order and type important --gt ltxsfield
xpath"_at_regPlate"/gt lt/xskeyrefgt
16
Tradeoffs
  • DTDs
  • 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
  • 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
XML Schema vs. DTD
  • XML Schema contains all modelling abilities of
    DTD, except Entities.
  • Conversion DTD in XML Schema lossless, Entities
    will be expanded.
  • Conversion XML Schema in DTDs with loss

18
Usage of XML Schema
  • Data centric Applications
  • Import in and Export from DBs
  • Use data types and integrity checks
  • XML Databases SQL/XML

19
Tools
  • Editors
  • XMLSpy (www.xmlspy.com)
  • XML Authority (www.extensibility.com/xml_resources
    /modeling.htm)
  • XML Writer
  • XML-Prozessors
  • XML Schema Quality Checker of IBM alphaworks
    (www.alphaworks.ibm.com/tech/xmlsqc)
  • XML Schema Validator of Oracle (technet.oracle.com
    /tech/xml/)
Write a Comment
User Comments (0)
About PowerShow.com