Modeling XML
XML Schema Languages DTD, XML Schema, Relax NG Specification of structure of XML documents What elements and attributes can be used Problems Complexity Too technical for non-technical people Absence of semantics
XML Schema Languages Real applications Different groups of users viewing problem domain from different viewpoints various types of XML documents ("XML views") in system
XML Schema Languages Data Data > PurchaseRequest > PurchaseResponse > Catalogue > SalesReport
XML Schema Languages One real-world concept (e.g. customer or product) represented in various types of XML documents in different ways Description distributed across various XML schemas redundancy & incompleteness Lack of complete & non-redundant description
XML Schema Languages HL7 exchanging medical records UBL exchanging business data ISO20022 exchanging financial data common charasteristics: Hundreds of XML schemas
XML Schema Visualization XML Spy, Stylus Studio, Oxygen XML Editor, … Visualization of each construct of particular XML schema language Usually XML Schema
XML Schema Visualization
Easier to understand XML schemas Just visualization – does not provide complete & non-redundant description
Model-Driven Architecture IDEA: describe data at various levels of abstraction PIM (Platform-Independent Model) Description of data independent of any data model and particular user view PSM (Platform-Specific Model) Description of data from particular user view Description of implementation in particular data model (relational, xml)
PIM Diagram
PSM Diagram – Relational Schema
Model-Driven Architecture Can be naturally applied on designing XML as well PSM = UML class model extended with set of stereotypes for modeling constructs of particular XML schema language Enterprise Architect PSM for XML Schema
PSM Diagram
PSM Diagram – Relational DB
Model-Driven Architecture Allows describing problem domain independently of XML Complete and non-redundant description No or weak binding between PIM and PSM level in recent tools
A Tool for XML Data Modeling
XCase Software Project ‘XSEM - Proof of concept’ project at MFF UK March – December 2008 Supervisor: Martin Nečaský, PhD Team members: Jakub Klímek, Lukáš Kopenec, Lucie Kučerová, Jakub Malý, Kateřina Opočenská Official website: Download & sources: Almost 4000 downloads so far! Presented at ITAT 2008
XCase Overview XCase implements XSEM, a conceptual model for XML data XSEM is based on MDA (Model-Driven Architecture) Platform Independent Model (PIM): UML class diagram XML-independent conceptual description of problem domain Platform-Specific Model (PSM): Extended UML class diagram Introduced new constructs for modeling XML hierarchy
XCase Design Process
XCase PIM Level Support of all well-known UML class diagram constructs: Classes Class attributes Class operations Associations Binary associations, n-ary associations Aggregations, compositions Association classes Generalizations
XCase PSM Level New constructs to UML class diagram: Attribute container Models attributes that should be expressed as XML elements instead of XML attributes Content choice Models variants in the content of PSM class Content container Models XML element that has no semantic equivalent at the PIM level (i.e. no equivalent PIM class) Class union Models a mixture (union) of instances of two or more PSM classes.
Ensuring PIM – PSM Consistency Dynamic propagation of changes: 1] from PIM diagrams to corresponding PSM diagrams New PIM association added → new child available in PSM Association cannot be removed from PIM if corresponding association is still present in PSM New attribute added in PIM → available in PSM Attribute removed from PIM → warning about removing from PSM Attribute changes in PIM propagated to corresponding attribute in PSM Automatic propagation: name, data type, default value User asked for confirmation: multiplicity 2] from PSM diagrams to corresponding PIM diagrams User can propagate free PSM attribute to PIM
XML Schema Derivation 1 XML Schema document derived from 1 PSM diagram Automatic derivation Starts in root PSM classes and proceeds recursively to their descendants Each PSM construct is translated to appropriate XML Schema construct Derived schemas are not saved within XCase project Can be derived, edited and saved anytime again
Live show begins …