1 / 33

CAMV rules validation engine for XML

XML Validation Framework. CAMV rules validation engine for XML. David Webber, Information Architect, Oracle Public Sector.

gent
Télécharger la présentation

CAMV rules validation engine for XML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML Validation Framework CAMV rules validation engine for XML David Webber, Information Architect, Oracle Public Sector

  2. The following is intended to outline Oracle general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. DisclaimerNotice

  3. Agenda • Concepts and Technology • Rules Primer with XPath • Advanced Rules Techniques • Code table and SQL lookups • Apache ANT test suite automation tool • Test, Evaluation, And Measurement (TEAM) • Summary and Resources

  4. Concepts and Overview Running CAMV interactively CAMV batch test suites Use Cases Concepts AND Technology

  5. Conceptual OverviewXML Validation Framework Design Test Deploy Data Delivery Application CAM Editor DB XML XML FMW SQL / XML CAMV CAMV RULES • Device • Browser • Server Web • Generate Data • Validate Data • Send Data • Visual Editor • SQL Browser • Dictionaries • Drag and Drop • CAMV • Web Services • FMW / BPM

  6. XML Validation Framework Benefits • CAMV component designed to deliver flexible and context aware XML validation services • Accelerates information sharing adoption and deployment (compatible with the NIEM approach) • Supports extended communities and XML diversity • Allows reference / conformance test suite development • Uses XML configuration templates + code-less methods • Integrates into Oracle Fusion Middleware foundation • Uses OASIS Content Assembly Mechanism (CAM) open public standard for validation templates and rules

  7. CAM Validation Components

  8. CAMV Validation Engine • Standalone XML validator using XPath rules • Context aware and declarative rules approach • External and local parameter definitions • Integrated with CAM editor menus for interactive testing • External code list and SQL table lookup support • Configurable error levels – error, warning • Java error results object returned • Embedded validation results attributes in XML results • Can use XSLT for post-validation result handling • Callable via Spring framework or Java API

  9. CAMV – Template Controlled Processing Information Exchange Application Services Control template contains information of the exchange structure design and rules of data handling and value ranges Input XML Template Agile Deploy Structure CAMV Rules Configuration Annotations Parameters Process Valid XML

  10. Running Validation Rules Tests • Fault tolerant validation engine allows testing of XML instances against actual exchange rules. • Critical to ensure that the exchange validates actual live production example scenarios correctly • Allows deployed solution to directly match documented exchange details (e.g. NIEM IEPD) – no coding delta • Errors can be reviewed interactively in exchange visual interface • Post-processing of validation results allows unit regression tests to be created with reporting of errors, warnings and information level notes

  11. Editor Interactive Rule Validation Information Exchange Application Template and XML Sample CAM Editor 3 Content Rules 1 Interactive Validation 2 Validation Results

  12. CAMV • CAM Editor • XSLT CAM Editor / CAMV Environment XML Test Instance Reports XML Validation Result CAM Editor CAM template

  13. Reviewing Validation Results HTML Results of XSLT error script applied to sample validation output

  14. CAMV Batch Run Example Quick guide and jump start kit available for ANT processing

  15. Quick Syntax Primer Controlling Scope, Context, Evaluation Dynamic Structure Components CAM Editor Rule Wizards XPath Rules Techniques

  16. XPath Syntax Primer • XPath is a simple assertion language where expressions reference components hierarchically within an XML instance structure – e.g. • /animals/canines/domestic/dogs/poodle[1] • /animals/canines/domestic/* • /animals/canines/domestic/ancestor::breed/@type • CAMV uses the XPath v2.0 Java library • In CAM templates XPath is used to express usage rules and content details of the XML structure and its components • (e.g. optional, repeatable, date, number, Boolean, decimal and so on)

  17. XPath Functions

  18. CAM XPath Extensions (most used)

  19. CAM templates and XPath expressions • Within a CAM template XPath expressions are found in the <as:BusinessUseContext>section of the template.

  20. Default Structure Handling By default all structure components are required and string content Content Masks Structure control

  21. Controlling Scope and Context Condition controls if and when the content rule action applies Condition can control structure as well; optional, mandatory, exclude Condition can reference different component(s) for contextual rule actions

  22. Expressing Business Rules Examples Business Rule: Items with color attributes don't need a tray number—the color is sufficient for picking the item: <as:constraintcondition="exists(//Item/@color)" action="makeOptional(//Item/TrayNumber)" /> Business Rule: If order weight exceeds 25 kg, purchase order must specify a freight carrier: <as:constraintcondition="//Item/@weight > 25" action="makeMandatory(//Item/FreightHandler)"> Using XPath axis referencing (when things are not adjacent in hierarchy): <as:constraintcondition="exists(ancestor::Item/@color)" action="makeOptional(//Item/TrayNumber)" /> • * Excerpted from Michael Sorens DEVX CAM article examples -http://www.devx.com/xml/Article/41150

  23. Example Cross Component Rules Business Rule: Providing warning if PurgeDate is earlier than PurgeReviewDate <as:constraintcondition="//sbl:PrivacyDetails/sbl:PrivacyPurgeDate < //sbl:PrivacyDetails/sbl:PrivacyPurgeReviewDate" action="printMessage(//sbl:PrivacyDetails/sbl:PrivacyPurgeReviewDate,Warning: Review date not before purge date)"><as:annotation/></as:constraint> Business Rule: Location must contain an address or a highway or coordinate set <as:constraintcondition="not(./nc:LocationAddress) and(not(./nc:LocationHighway)) and(not(./nc:LocationTwoDimensionalGeographicCoordinate))" action="printMessage(//j:TargetLocation/sbl:Location,Missing Location information)"><as:annotation><as:documentationtype="documentation">Example of advanced rule</as:documentation></as:annotation></as:constraint>

  24. CAM Editor rule XPath entry wizard 1 restrictValues() XPath reference 2 Allowed values

  25. CAM Editor New Rule XPath entry wizard XPath rule scope check boxes Allowed values entry

  26. Introduction to CAM code lists Advantages Tools and Hints Code lists and sql lookup

  27. Code lists • CAM lookup() function allows referencing to external XML lists of values • Can replace use of restrictValues() static lists • CAM lookup() function can reference SQL table for dynamic value checking • Where to get code lists? • Import XSD enumeration schema into CAM lookup lists • Convert UBL Genericode into CAM lookup lists • Dump from database into lookup list XML format (cool use for SQL to XML feature of CAM database designer)

  28. CAM Code list XML format Code list name Code value Textual value

  29. Code lists examples • Load lookup list XML into CAM editor • Assign lookup() rule to XML component • For SQL lookups – need to define connectivity to database and the SQL query to perform • (example SQL lookup available from http://www.cameditor.org)

  30. Combining Rules and Code lists • Real power of code lists and CAM – ability to select code list values based on XPath rule criteria to handle different partner configurations, versioning and cross-table validations • e.g. Ford / Mustang | Chevy / Corvette • Message version id = 1.6 – use code list XYZ-1-6

  31. Code Lists Summary • Lookups can be to external XML file instances • Simple XML format for optimized performance and readability • Dynamic runtime control via XPath rules to select lists to be applied • Lookup can reference SQL statement for database content checking • e.g. part numbers, customer id, order number

  32. CAMV Java Validation Engine (OneJar) Java API and Spring API support Integration with JAX-WS Templates provide flexible rule validation Codelists and SQL lookups ANT batch test suites CAMV Summary

  33. CAM Project Resource Site • SNAPSHOT OF PROJECT ACTIVITIES50,000 CAMeditor.org page visits in one year • 130+ countries have downloaded tools; • 30% of visitors are from U.S. • 450+ downloads weekly • 20,000 yearly downloads • 1,000 Macintosh • 1,000 Linux • 100 student views of online video training resources weekly • 6 languages now available www.cameditor.org ‹#›

More Related