XML Schema Languages
DTD, XML Schema, Relax NG Specification of structure of XML
documentsWhat elements and attributes can be
used Problems
ComplexityToo technical for non-technical peopleAbsence of semantics
XML Schema Languages
Real applicationsDifferent groups of users viewing
problem domain from different viewpoints various types of XML documents ("XML views") in system
XML Schema Languages
Data
Data
<<XML schema>>
PurchaseRequest
<<XML schema>>
PurchaseResponse
<<XML schema>>
Catalogue
<<XML schema>>
SalesReport
XML Schema Languages
One real-world concept (e.g. customer or product) represented in various types of XML documents in different waysDescription distributed across various
XML schemasredundancy & incompleteness
Lack of complete & non-redundant description
XML Schema Languages
HL7exchanging medical records
UBLexchanging business data
ISO20022exchanging 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 languageUsually 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 abstractionPIM (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)
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 ArchitectPSM for XML Schema
Model-Driven Architecture
Allows describing problem domain independently of XMLComplete and non-redundant description
No or weak binding between PIM and PSM level in recent tools
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: http://www.ksi.mff.cuni.cz/~necasky/xcase/
Download & sources: http://www.codeplex.com/xcase
• 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 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 ConsistencyDynamic 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