Business Rules, OCL, XML and Schemas

Note: this entry has moved.

DonXML is proposing extensions to OCL to express business rules that can be used at code-gen time and at run-time.
He mentions my Schematron implementation called Schematron.NET, which allows many business rules to be expressed simply in terms of standard XPath expressions. I believe such an XPath-based language is good enough to express almost every business rule.

Udi Dahan commented as an example, a rule "only a bank manager can authorize a loan above X" which he said couldn't be expressed with Don's idea. It could, indeed, with something along these lines (XPath-like):

<assert test="sec:principal-role('BankManager') and po:Loan/@Amount < 1000">
  Only a BankManager can place a loan of more than $1000.

Note that XPath extensibility allows for more domain-specific extensions to be active, which can even check against databases, etc. For example, something like this:

<assert test="crm:customer-id(po:CustomerId)" />

in this case, the application would map the "crm" prefix to the business objects that contain the logic, and register the "customer-id" extension function to ensure the Id is a valid one. This way, you can change business rules based on a (well documented) set of extensions, and you can let managers handle them, instead of programmers.
These schemas are easy enough for an advanced user to edit.
In Schematron.NET, I'm implementing quite a few extensions, including XSLT-specific ones, and adding the full EXSLT for .NET implemented by Dare Obasanjo. It's not impossible to think about a set of domain-specific standard specs (like EXSLT itself) that would aid in business rules expression.


  • From what I read about Xen, it's about integrating XML constructions to the language, nothing more. Therefore I don't think there's room for the kind of rules validation we're thinking about.

    An I certainly doubt MS will take such a risky road with regads to the Xen language as a whole... even though it may remain an experimental option just like F# is right now...

  • I like the technique. I'm still puzzling over the strategy. From a SOA approach, where does this go ?

    What makes it different/better than any other rules engine ? You've given me something to think about. Thank you.

Comments have been disabled for this content.