[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Separate data from rules ... is the XML Schema 1.1 <assert> elementa ste

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "'xml-dev@lists.xml.org'" <xml-dev@lists.xml.org>
  • Date: Mon, 15 Jun 2009 17:10:52 -0400

Separate data from rules ... is the XML Schema 1.1 <assert> elementa ste

Hi Folks,

In the book Business Rules Applied, Barbara von Halle presents the Business Rules Methodology, which fundamentally is about separating rules from data: [1]

    A business rules methodology specifically
    removes rule considerations from the data
    and process tracks.

    The data and process tracks are reduced in
    content because they are devoid of rule
    details.

    You deliver a data structure with minimal
    rules in it.


WHAT IS A BUSINESS RULE?

Consider this XML document:

    <?xml version="1.0"?>
    <Document classification="secret">
        <Para classification="unclassified">
          One if by land, two if by sea;
        </Para>
        <Para classification="confidential">
          And I on the opposite shore will be, 
          Ready to ride and spread the alarm
        </Para>
        <Para classification="unclassified">
          Ready to ride and spread the alarm
          Through every Middlesex, village and farm,
        </Para>
        <Para classification="secret">
          For the country folk to be up and to arm.
        </Para>
   </Document>

Here's an example of a business rule:

    Security Classification Rule: No paragraph 
    may have a classification higher than the 
    overall document's classification. 


THE XML SCHEMA 1.1 <assert> ELEMENT

XML Schema 1.1 introduces a new element: the <assert> element. It may be used to express business rules. 

The Security Classification Rule may be expressed like this:

    <element name="Document">
        <complexType>
            <sequence>
                <element name="Para" type="ParaType" maxOccurs="unbounded">
                </element>
            </xs:sequence>
            <attribute name="classification" type="classificationLevels" 
                       use="required"/>
            <assert test="if (@classification eq 'top-secret') then 
                             not(Para/@classification != 'top-secret') else 
                          if (@classification eq 'secret') then 
                             not(Para/@classification = 'top-secret') else
                          if (@classification eq 'confidential') then 
                             not(Para/@classification = 'top-secret') and 
                             not(Para/@classification = 'secret') else
                          if (@classification eq 'unclassified') then 
                             not(Para/@classification = 'top-secret') and 
                             not(Para/@classification = 'secret') and 
                             not(Para/@classification = 'confidential') else
                          true()" />
        </complexType>
    </element>

Notice the use of the <assert> element to express the security classification business rule.

This example illustrates the co-mingling of data and rules. According to the Business Rules Methodology this is not advisable (it hinders the ability of a business to make changes).

Up till this moment in XML's history the separation of data and rules have been enforced by the technologies:    
   
   - Data structure and vocabulary was 
     expressed and managed using XML Schema 
     or RELAX NG, and 

   - Rules were expressed and managed using 
     Schematron. 

The <assert> element changes things. Rather than technology enforcing the separation of data and rules, it is incumbent on developer discipline to enforce the separation.

Is the XML Schema 1.1 <assert> element a step backwards? 


/Roger


[1] Business Rules Applied by Barbara von Halle, p. 66-67. For more information on the Business Rules Methodology see:

  - Business Rules and Information Systems by Tony Morgan
  - Principles of the Business Rules Approach by Ronald G. Ross
  - Wikipedia: http://en.wikipedia.org/wiki/Business_rules_approach


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.