XSD, Schematron, and the Real World
Kurt Cagle, proven author of several books about XML, XSL, SVG, and XQuery, blogged about XML and Modeling by means of the marriage of XSD and Schematron within the Schema Modeling Language (SML). As a demonstration he provides a SML schema example that refers to the current date of processing time (contract valid within given time boundaries) and a dynamic list of supported currencies (residing in an external document). Undoubtedly, SML enables the schema editor to express dynamic value constraints as part of the schema which otherwise would have been left to the application logics. However, should XSD be considered a modelling language at all?
The intention of XSD rather is "to define and describe a class of XML documents", and don't forget that the "M" in XML stands for markup not for modeling. This moderate approach may be one of the secrets of success: leaving out everything the audience might not agree upon and providing a stable solution for the consensus only. This led to a huge step forward towards global interoperability in the first decade of XML and XSD which today is mostly just taken for granted.
How will today's XSD aware installation base behave when XSD comes along with Schematron enhancements? Most probably they will simply ignore the add-on, as it wisely appears within the well known annotation/appinfo element, which allows for non-breaking migration.
Who will talk SML? SML 1.0 has been submitted to the W3C about a year ago by a respectable consortium of big players (namely BEA, CA, Cisco, EMC, HP, IBM, Intel, Microsoft and Sun), and turned into a current Working Draft 1.1 without any dramatic changes, so it looks rather stable.
How does it align with the upcoming XSD 1.1 upgrade? While the SML Working Group is hosted by the W3C XML Activity along with the XML Schema Working Group, SML refers to XML Schema Part 1: Structures Second Edition (2004) without even mentioning the XSD 1.1 Draft 2007-08 . XSD 1.1 addresses "versioning of XML languages" as well as "support for co-occurrence constraints, that is constraints which make the presence of an attribute or element, or the values allowable for it, depend on the value or presence of other attributes or elements."
Finally, are there any competing approaches? The Web Service Modeling Language WSML - similar at least in name - belongs to one of four submissions which finally led to another W3C Recommendation: Semantic Annotations for WSDL and XML Schema SAWSDL in 2007. SAWSDL has been designed to support Semantic Service Interoperability, but it generally opens XSD and WSDL towards the powerful ontology-based modeling capabilities of the Semantic Web .
How can the three appraches come together? Kurt himself highlighted semantics among other trends in a previous entry about Where's XML Going:
If I was entering IT as a newly managed IT college graduate, I'd be looking at semantic systems and knowledge management as the hot fields to be getting into.Why only pass this to the young generation? While the SML/Schematron approach may be a reasonable enhancement of expressiveness for XSD constraints, just adding a "feather duster for the corners of your schema" (Rick Jelliffe himself) does not make a Service Modeling Language deserving such a challenging label. Surely a schema is kind of a model, but a model is more than a schema (even one with brushed corners). What makes a modeling language? Again Kurt provides the key requirement from the viewpoint of an application developer:
Before you write a single line of code, you should have a reasonably deep understanding of what particular piece of the real world you are attempting to model in that code.A full model is not only about structure and constraints; it needs to be linked to concepts that describe the relevant facets of the real world. And this exactly is what semantics will bring in.
Shane Hastie on Distributed Agile Teams, Product Ownership and the Agile Manifesto Translation Program
Shane Hastie Apr 17, 2015