Presentation is loading. Please wait.

Presentation is loading. Please wait.

XRules An XML Business Rules Language Introduction Copyright © Waleed Abdulla 2003-2004. All rights reserved. August 2004.

Similar presentations


Presentation on theme: "XRules An XML Business Rules Language Introduction Copyright © Waleed Abdulla 2003-2004. All rights reserved. August 2004."— Presentation transcript:

1 XRules An XML Business Rules Language Introduction Copyright © Waleed Abdulla 2003-2004. All rights reserved. August 2004

2 Definition XRules is an XML based language for writing business rules in a platform independent format.  XRules can be used to describe constraints and calculations that apply to an XML business document.  Business rules written in XRules can be processed on any platform where an XRules processor is available.

3 Why XRules?

4 Enterprise Typical Purchase Order Processing System Web User: browser Vendor: desktop application Web Server Backend System Client Side validations and calculations done in JavaScript 1 Client Side validations and calculations done using C++ 2 Incoming Web Service requests validated using XML Schema and VB.NET 4 Server side validations and calculations done using VBScript 3 Incoming purchase orders validated using COBOL. 5 HTTP POST Web Services Backend Native Format Business rules repeated 5 times. Same rules, different methods.

5 Enterprise The XRules Vision Web User: browser Vendor: desktop application Web Server Backend System Client Side validations and calculations done in XRules Client Side validations and calculations done using XRules Incoming Web Service requests validated using XML Schema and XRules Server side validations and calculations done using XRules Incoming purchase orders validated using XRules. HTTP POST Web Services Backend Native Format One XRules document used on different platforms. XRules

6 XRules Benefits Communicate business rules  Just as XML Schema is used to precisely describe the layout of XML documents, XRules expresses the business rules that govern the content of these documents. Avoid Duplicate Efforts  Due to the different ways business rules are used, it’s very common to have to rewrite the same business rules multiple times. For example, a user interface interactively informs the user of invalid values, while a web service returns the details of the errors in a SOAP message. XRules avoids the duplication of efforts by allowing the same rules to be used in different contexts on different platforms. Separate Business Rules from Application Logic  In applications where business rules change often, this is a great way to avoid having to update the application whenever business rules change.

7 What Does XRules Express?

8 Main Categories of Rules Constraints  These are restrictions on the content of an XML Business Document that must be satisfied for the document to be considered valid. Calculations  These are formulas that describe how values of XML nodes (elements and attributes) in the document are derived or calculated from the values of other nodes or other data sources. Properties  XRules properties are native or user-defined values that are attached to XML elements and attributes without affecting the layout or the contents of the XML document.

9 XRules Constraints XRules can express a wide variety of simple and complex constraints. XRules complements XML Schema which can be used to express certain types of simple constraints. XRules constraints can have custom error messages to be returned if the constraint rule fails. Examples of constraints:  Example 1: CreditCardNumber is required only if PaymentType is Credit. Otherwise, it’s optional.  Example 2: DeliveryDate must always be greater than or equal to PurchaseDate.  Example 3: ItemID must be unique for each purchased item.

10 XRules Calculations Calculation rules define how the value of an XML node (element or attribute) is calculated or derived. Calculated nodes can be used in formulas to calculate other nodes. In this case, the XRules processor automatically determines the chain of node dependencies and runs the rules in the correct order. Constants and values from external data sources (databases, web services, other XML documents, …etc) can also be used in calculation formulas. Examples:  Example 1: Tax of a purchase order is equal to SubTotal * StateTaxPercent.  Example 2: StateTaxPercent is 0.08 in CA, 0.06 in NJ, … etc.

11 XRules Properties XRules properties are name-value pairs that are attached to XML elements and attributes without affecting the layout or contents of the XML document. XRules has two types of properties:  Native Properties allow easy access to information exposed by the XRules processor. For example, xr:valid determines if a node is valid, xr:max determines the maximum valid value for a node.  Custom Properties are user-defined properties that are attached to XML nodes to identify or describe them. XRules properties (native and custom) can be accessed by the application through functions exposed by the XRules processor. Examples:  Example 1 (custom property): CreditCardNumber field is marked as ‘disabled’ when PaymentType is not Credit.  Example 2 (native property): when a ‘required’ constraint rule is put on a node, the xr:required property of that nodes returns true.

12 Frequently Asked Questions

13 FAQ Q.How does XRules compare to XML Schema (XSD)? A.While XML Schema focuses on describing the layout of XML documents, XRules focuses on their content. XRules can specify complex constraints that XML Schema is not designed for. And, in addition to that, XRules can define calculations and other relations that specifically address business rules requirements. Q.Can XRules and XML Schema work together? A.Yes. XRules works with XML Schema in many ways:  XRules supports XML Schema data types.  XRules can be embedded in XSD documents. And, vice versa, XSD snippets can be embedded in XRules documents.

14 FAQ, contd. Q.How can I process XRules documents? A.You can use one of the following types of XRules processors:  XRules Validator: This is the simplest type of XRules processors. It validates an XML document and generates an XML error report. Suitable for validating incoming web service messages.  XRules Calculator: In addition to validating an XML document, it updates it by updating the values of ‘calculated nodes’. The output document might be different from the input document. Suitable for executing business rules in a workflow-style applications.  Dynamic DOM: This is an extension of the W3C DOM. It loads an XML document and binds it to an XRules document to produce a dynamic object model of the XML document in memory. The DDOM rejects updates that violate business rules. And, when nodes are updated, the DDOM updates all dependent nodes automatically. Suitable for driving interactive user interfaces.

15 FAQ, contd. Q. What’s the current status of XRules? A. XRules is a work in progress. A draft specs document is available, in addition to two XRules processors (DDOM & XRules Validator) and a few sample applications. Q.Will the XRules specs be available for free? A.That’s the plan. The author is considering available options to have XRules adapted by a standards organization. Until that happens, please contact the author for any questions.

16 FAQ, contd. Q.How can I get more information about XRules? A.The latest specifications and downloads are available online at: www.xrules.org. Q. Can I contribute to XRules? A. Absolutely. All contributions of feedback, comments, ideas, code, documentation, or sponsorship are very welcome. Credit will be given where credit is due. Q. Can I contact you to discuss XRules or if I have questions? A.Sure. My email address is waleed_abdulla@xrules.org.

17 Thank You Thank you for taking the time to review this presentation. Please don’t hesitate to contact me for any questions. Your help and support are welcome. Regards, Waleed Abdulla


Download ppt "XRules An XML Business Rules Language Introduction Copyright © Waleed Abdulla 2003-2004. All rights reserved. August 2004."

Similar presentations


Ads by Google