FpML Issues Tracker

647: ird-46 doesn’t account for optionality

March 7, 2008

closed

Minor

Always

Validation Rules

Admin

None

Summary

The validation rule ird-46 doesn't take account of the optionality of elements.

The current rule is: " Context: OptionalEarlyTermination (complex type) ird-46 (Mandatory) In cashSettlement/cashSettlementValuationDate/dateRelativeTo, the @href attribute must point to the @id attribute of cashSettlement/cashSettlementPaymentDate. "

A good example is valid-ird-46-01.xml. In this example, supposedly valid for this rule, the path //element(*, OptionalEarlyTermination)/cashSettlement/cashSettlementPaymentDate/relativeDate/dateRelativeTo/@href does not exist.

CashSettlementPaymentDate has a choice, and this choice is not taken into account.

A type defining the cash settlement payment date(s) as either a set of explicit dates, together with applicable adjustments, or as a date relative to some other (anchor) date, or as any date in a range of contiguous business days. A series of dates that shall be subject to adjustment if they would otherwise fall on a day that is not a business day in the specified business centers, together with the convention for adjusting the date. A date specified as some offset to another date (the anchor date). A range of contiguous business days.

Notes:

  • matthewdr

    03/07/08 2:48 pm

    The same issue also applies to ird-47.

    The rule today is:

    ird-47 (Mandatory)
    In cashSettlement/cashSettlementPaymentDate/relativeDate/dateRelativeTo, the @href attribute must point to the @id attribute of americanExercise, bermudaExercise or europeanExercise, whichever one exists.

  • mgratacos

    03/25/08 2:32 pm

    Val WG:

    If cashSettlement/cashSettlementPaymentDate/relativeDate/dateRelativeTo is present, cashSettlement/cashSettlementPaymentDate/relativeDate/dateRelativeTo/@href attribute must point to the @id attribute of americanExercise, bermudaExercise or europeanExercise, whichever one exists.

  • mgratacos

    04/07/08 3:46 pm

    This has been committed to the trunk and 5.0 branch.

    ird-46 (Mandatory)
    If cashSettlement/cashSettlementValuationDate/relativeDate/dateRelativeTo is present, cashSettlement/cashSettlementValuationDate/dateRelativeTo/@href attribute must point to the @id attribute of cashSettlement/cashSettlementPaymentDate.

    ird-47 (Mandatory)
    If cashSettlement/cashSettlementPaymentDate/relativeDate/dateRelativeTo is present, cashSettlement/cashSettlementPaymentDate/relativeDate/dateRelativeTo/@href attribute must point to the @id attribute of americanExercise, bermudaExercise or europeanExercise, whichever one exists.

  • matthewdr

    05/12/08 5:08 pm

    There are significant problems with the resolution for ird-46.

  • matthewdr

    05/12/08 5:17 pm

    The ‘fix’ applied had errors. The fix was:


    Context: OptionalEarlyTermination (complex type)
    ird-46 (Mandatory)
    If cashSettlement/cashSettlementValuationDate/relativeDate/dateRelativeTo is present, cashSettlement/cashSettlementValuationDate/dateRelativeTo/@href attribute must point to the @id attribute of cashSettlement/cashSettlementPaymentDate.

    The problems are:
    1. The path in the first clause is: “cashSettlement/cashSettlementValuationDate/dateRelativeTo”. There is no “relativeDate” element in the path in the FpML schema.
    2. The test of “is present” needs to be changed to “exists”. This is to come into accordance with the principle of the VWG previously established to test for existence rather than prescence for reasons of consistency, compatibility with XPath, and to be intuitive in the face of default nodes.
    3. The “If” has no “else” clause. Every “If” should have an “else” clause. In this case the “If” should not be part of the body of the rule, but part of a condition to the rule being fired.
    4. The correct XPath for “the @id attribute of cashSettlement/cashSettlementPaymentDate” is “cashSettlement/cashSettlementPaymentDate/@id”. This is correct in the second XPath, but not the third.
    5. “point to” should be replaced with “equals” for reasons of consistency and simplicity.

    Rewriting the rule correctly produces:


    Context: OptionalEarlyTermination (complex type)[cashSettlement/cashSettlementValuationDate/dateRelativeTo]
    ird-46 (Mandatory)
    cashSettlement/cashSettlementValuationDate/dateRelativeTo/@href attribute equals cashSettlement/cashSettlementPaymentDate/@id attribute.

    The fixed rule is much simpler.

  • matthewdr

    05/21/08 6:16 pm

    As dateRelativeTo is mandatory, this makes:


    Context: OptionalEarlyTermination (complex type)[cashSettlement/cashSettlementValuationDate]
    ird-46 (Mandatory)
    If exists(cashSettlement/cashSettlementPaymentDate) then cashSettlement/cashSettlementValuationDate/dateRelativeTo/@href attribute equals cashSettlement/cashSettlementPaymentDate/@id attribute, else false().


    Context: OptionalEarlyTermination (complex type)[exists(cashSettlement/cashSettlementPaymentDate/relativeDate)]
    ird-47 (Mandatory)
    cashSettlement/cashSettlementPaymentDate/relativeDate/dateRelativeTo/@href attribute equals americanExercise/@id, bermudaExercise/@id or europeanExercise/@id, whichever one exists.

  • iyermakova

    05/24/08 3:54 am

    – As per Val WG agreement, the rules ird-46 and ird-47 were corrected as proposed above, but in the current style.
    The change was committed to trunk and branchesFpML-5-0

    “Context: OptionalEarlyTermination (complex type)
    ird-46 (Mandatory)
    If cashSettlement/cashSettlementValuationDate exists, the cashSettlement/cashSettlementValuationDate/dateRelativeTo/@href attribute must point to the cashSettlement/cashSettlementPaymentDate/@id attribute.”

    “Context: OptionalEarlyTermination (complex type)
    ird-47 (Mandatory)
    If cashSettlement/cashSettlementPaymentDate exists, the cashSettlement/cashSettlementPaymentDate/relativeDate/dateRelativeTo/@href attribute must point to the americanExercise/@id, bermudaExercise/@id or europeanExercise/@id, whichever one exists.”

  • Leave an update

    You must be logged in to post an update.