160 likes | 307 Views
P11. 30 October 2013. CS4221 - Database Design Course Project Comparison on XML Schema L anguages. A0117525J Venkatesan Periasamy Ramasamy Sreeelango A0117546A Swagata Das A0117320X Lucie Coute A0117965U Mahsa Paknezhad. XML schema Definition.
E N D
P11 30 October 2013 CS4221 - Database Design Course Project Comparison on XML Schema Languages A0117525J VenkatesanPeriasamyRamasamySreeelango A0117546A SwagataDas A0117320X Lucie Coute A0117965U MahsaPaknezhad
XML schema Definition • XML: a markup language for documents containing semi-structured information • XML schema: describes the structure of an XML document • XML schema language: language used to describe an XML schema
XML schema Comparison Grammar-based Languages Rule-based Language • A set of Markup declarations • Formal syntax • Which elements/references • The element’s attribute/contents Document Type Definition (DTD) XML SchemaDefinition (XSD) Regular LAnguage for XML Next Generation (Relax NG) Schematron Uses Xpath assertions Uses non-XML syntax • A rules-based validation • Make assertions about patterns • A structural schema language • Elements and Xpath patterns • An XML-based alternative • Constraints on the structure/content • beyond basic syntactical constraints • A replacement for DTD • extensible to future additions • More powerful than DTD • Supports datatypes/namespaces • Merging Relax and TREX • Simple • Expressive • Uses XML datatypes • Permits user-defines datatypes • Supports namespaces • Specifies a pattern Uses XML syntax
XML schema Comparison Element: Character-ref Element: library DTD Element: author Element: author-ref Element: book Element: character Attribute: id IDREF Attribute: id ID Element: name Element: nickname Element: born Element: dead Element: book+ Element: author* Element: character* Attribute: id ID Attribute: id IDREF Attribute: id ID Element: ISBN Element: title Element: author-ref* Element: character-ref* Attribute: id ID Element: name Element: since Element: qualification
XML schema Comparison XML Library Max: unbounded Attribute: id ID book ISBN title author-ref character-ref Min:0 Max: unbounded Attribute: id ID Min:0 Max: unbounded Attribute: id ID name reference author Min:0 Max: unbounded Attribute: id ID nickname born dead character Min:0 Max: unbounded Attribute: id ID name reference since qualification name
XML schema Comparison character id-attribute ISBN name nickname qualification since title Relax NG ref: library author book ref: id-attribute ref: name ref: since ref: qualification ref: book one or more ref: author zero or more ref : character zero or more Attribute: id ID name nickname born dead Attribute: id ID Attribute: id IDREF ref: id-attribute ref: ISBN ref: title author-ref zero or more character-ref zero or more Attribute: id IDREF
XML schema Comparison <sch:rule context="/library/book"> <sch:assert test="not(following-sibling::book/@id=@id)"> Duplicated ID for this book. </sch:assert> <sch:assert test="@id=concat('-', isbn)"> The id should be derived from the ISBN. </sch:assert> </sch:rule> <sch:rule context="/library/*"> <sch:assert test="name()='book' or name( )='author' or name( )='character'"> This element shouldn't be here... </sch:assert> </sch:rule> </sch:pattern> </sch:schema> Schematron <sch:schemaxmlns:sch="http://www.ascc.net/xml/schematron"> <sch:title> SchematronSchema for library </sch:title> <sch:pattern> <sch:rule context="/"> <sch:assert test="library"> The document element should be "library". </sch:assert> </sch:rule> <sch:rule context="/library"> <sch:assert test="book"> There should be at least a book! </sch:assert> <sch:assert test="not(@*)"> No attribute for library, please! </sch:assert> </sch:rule>
XML schema Example: Flight XML Document Flight Aircraft Vertical Obstruction Type Altitude unit reference Type Elevation unit Height unit Localisation Localisation Latitude Longitude Latitude Longitude
XML schema Example: Flight XML Document • Check that the Flight element contains one child Aircraft element: DTD Relax NG XML Schema Schematron • Check that the value of each Latitude element is a decimal: DTD Relax NG XML Schema Schematron • Check that the Aircraft Altitude is at least 500 feet higher than the top of all VerticalObstructions: DTD Relax NG XML Schema Schematron The rule-based language Schematron is more powerful to express constraints
Conceptual model for XML Definition • What is a Conceptual Model? • usable for abstractions of real-world entities • facilitates communicating about these abstractions • provides help for implementing software systems • What is a Conceptual Model for XML? • it is not a new schema language • maps well to XML-like structures (hierarchical/referential/mixed) • has features to control XML-specifics (element vs. attribute) • conveys the essential information about XML-oriented models
Conceptual model for XML Definition PlateformIndependant Model Platform Specific Model ER Model XML Conceptual Model UML XML schemalanguage SQL BPEL Script Language Output XML doc XML storage Application Document Processing Database Design Software engineering
Conceptual model for XML Comparison Some of the conceptual models introduced during the last 13 years: 2006: XUML H.X. Liu, Y.S. Lu, Q. Yang HuaZong, China 2004: ERex M. Mani Toronto 2003: XER A. Sengupta, S. Mohan, B. Doshi 2002: Semantic Network L. Feng, E. Chang, T. Dillon Australia 2000: ORA-SS G. Dobbie, X. Wu, T.W. Ling, M.L. Lee National University of Singapore 2003: X-Entity B. F. Lósio , A. C. Salgado, L. do Rêgo Galvão Universidade Federal de Pernambuco, Brasil
Conceptual model for XML Comparison ER-based UML-based Hierarchical ORA-SS ERex X-Entity XER XUML Semantic Network Objects Attributes Relationship Cardinality Ordering Connectivity Aggregation Association XML Schema DTD XML Schema XML documents DTD XML Schema XML Schema DTD Mapping XML Schema
Conceptual model for XML Example X-Entity XUML ORA-SS
Conclusion • Some XML Schema languages are more powerful than others in terms of constraints • Some XML Schema can be used together • There exist no perfect conceptual model for XML, that support all the features of an XML document • Some features of a XML document are not supported by any conceptual model for now: • Namespace • Metadata redundancy • Web semantic technologies
Conclusion Thank you for listening! Any Questions?