FpML Issues Tracker

440: Add an architecture rule that constraints can only be applied on in scope nodes

August 15, 2007

closed

Major

Always

Validation Rules

Admin

sheinrich

Summary

There is a problem today with some of the validation rules - they define a narrow context and then test constraints on elements that are out of scope for that context.

For example, take eqd-1: " Context: EquityAmericanExercise (complex type). commencementDate/adjustableDate/unadjustedDate must be equal to ../../../tradeHeader/tradeDate"

The problem with this is that tradeHeader/tradeDate is out of scope from the context of EquityAmericanExercise.

Generally seeing a path of ../../../ shows how out of scope something is.

The rule should be rewritten as: "Context: Trade (complex type). .//equityAmericanExercise/commencementDate/adjustableDate/unadjustedDate must be equal to .//tradeHeader/tradeDate"

The benefits of this are: 1. Currently the context is not really the context as the rule reaches outside of the context. 2. Accessing ancestor nodes is brittle when the schema is changed. 3. Accessing ancestor nodes is brittle when the schema is extended. For example there might be more than one ../../../tradeHeader/tradeDate in my extended schema. 4. Validation rules can be written in many ways, and given a free choice we should be adopting a method consistent with best practise, as for example defined in UML's OCL and its tools. This will help with FpML convergence and support. 5. Getting the right context makes it easier to manage revisions to the rules following schema changes.

This is just the example. There needs to be a more general rule in the Architecture for Validation. I propose the rule is:

"For the purposes of precision, extensibility, and robustness to change the structure of the Validation Rules is profiled. The rules of the profile are: 1. The context for a validation rule must always be a type. 2. The paths from the context should be node names rather than types wherever posssible. For example "equityAmericanExercise" is preferred to "element(*, EquityAmericanExercise)". 3. The context of the rule must be defined such that incorporates everything referred to in a rule. The rule must not use the ancestor or parent axis, or use them in cojunction with any other axis. For example "../../tradeHeader" is precluded.

Notes:

  • polis

    08/16/07 2:11 pm

    If the context is the ancestor of elements in the rule,
    then the predicate needs to qualify whether it is {there exists} or {for all}.

    Let’s say there was more than one node that matched …/unadjustedDate.

    If the rule is rewritten in the context of Trade as above, would it mean
    a. There exists an …/unadjustedDate that matches the tradeDate
    b. Every …/unadjustedDate must match the tradeDate

  • mgratacos

    08/23/07 1:35 pm

    Agreement in AWG. Validation WG should discuss it.

  • mgratacos

    10/23/07 2:02 pm

    2007-10-23: Agreement in the VWG.

  • iyermakova

    11/19/07 6:51 pm

    Added “Implementations” section within Validation Rules’ “Technical Guidelines” that includes following

    “For the purposes of precision, extensibility, and robustness to change the structure of the Validation Rules is profiled. The rules of the profile are:
    1. The context for a validation rule must always be a type.
    2. The paths from the context should be node names rather than types wherever posssible. For example “equityAmericanExercise” is preferred to “element(*, EquityAmericanExercise)”.
    3. The context of the rule must be defined such that incorporates everything referred to in a rule. The rule must not use the ancestor or parent axis, or use them in cojunction with any other axis. For example “../../tradeHeader” is precluded.

  • iyermakova

    11/19/07 6:54 pm

    This has been committed to the trunk (4.4) and 4.3 branch

  • Leave an update

    You must be logged in to post an update.