FpML Issues Tracker

941: finish off the conversion to XPath contexts

June 10, 2009

closed

Minor

Have not tried

Validation Rules

Admin

danieldui

Summary

We should complete the current partial conversion of the XPath contexts to XPath.

eqd-4 is a good example: " XPath Description: Context: //element(*, Trade) (complex type) [exists(equityOption/equityExercise/equityAmericanExercise)] equityOption/equityExercise/equityAmericanExercise/expirationDate/adjustableDate/unadjustedDate ge tradeHeader/tradeDate "

The context doesn't need to have "(complex type)" after it, because in XPath it is clear this is a complex type. "complex type" was added to the English Description because there was no way of distinguishing between nodes and node types.

Another eqd example is: " XPath Description: Context: EquityBermudaExercise (complex type) //bermudaExerciseDates/date gt commencementDate/adjustableDate/unadjustedDate "

This should be: " XPath Description: Context: //element(*, EquityBermudaExercise) //bermudaExerciseDates/date gt commencementDate/adjustableDate/unadjustedDate "

Notes:

  • matthewdr

    07/21/09 1:58 pm

    Discussed at the VWG today. Agreed to fix as proposed.

  • lyteck

    07/24/09 9:06 pm

    Removed unecessary “(complex type)” qualifier to context(s) in XPath descriptions.

  • iyermakova

    07/29/09 6:46 pm

    Matthew, as per your description in the issue 941,
    “//” – refers to all descendants of the root node.
    “.//” – refers to all descendants of the context node. We want the latter in our constraint. We need to be more careful in distinguishing between our root node and our context node in our XPath statements.

    Could you please in plain English explain the following:
    – “Context:” – what are the actual “root” note and the “descendants” in this case?
    – Rule description: – What are “bermudaExerciseDates/date” and “commencementDate/adjustableDate/unadjustedDate” being “descendants” of?

    —————————————
    XPath Description:
    Context: //element(*, EquityBermudaExercise)
    //bermudaExerciseDates/date gt commencementDate/adjustableDate/unadjustedDate
    —————————————-

  • matthew

    07/29/09 7:20 pm

    You found an error, and you worked out the correct form.

    The line beginning “Context:” sets the context node.

    “//element(*, EquityBermudaExercise)” is evaluated from the root node, because it is “//”. So from the root node it finds the node we want and makes it the context node.

    “//bermudaExerciseDates/date gt commencementDate/adjustableDate/unadjustedDate” is evaluated from the root node. This is a mistake as we really want to evaluate it from the context node. To do this the correct expression is: “.//bermudaExerciseDates/date gt commencementDate/adjustableDate/unadjustedDate”

    In all cases “//” means from the Root Node, and “.//” means from the Context Node.

    We don’t really state anywhere what “Context: ” means, nor do we state how to combine the Context and the Rule. It never used to matter because languages like XQuery, XSLT, and Schematron just default to our intended behaviour. However this does matter for languages like XSDL 1.1 where the xs:assert defaults to a different behaviour to the one we intended. I raised the issue after rewriting the validation rules as xs:assert statements and realizing the XPath isn’t quite right in isolation.

    So, the correct form is:
    —————————————
    XPath Description:
    Context: //element(*, EquityBermudaExercise)
    .//bermudaExerciseDates/date gt commencementDate/adjustableDate/unadjustedDate
    —————————————-

  • matthew

    07/29/09 7:22 pm

    In summary, our Contexts should always be “//” and our Rules should always contain “.//”, and never the other way around.

  • iyermakova

    07/29/09 8:30 pm

  • matthew

    07/29/09 9:56 pm

    What are cordial Nodes? Are they Nodes close together but not quite siblings? 🙂

    I infer you probably meant “cardinality”. If multiple Nodes match the Context, then each is a separate Context for which the Rule is evaluated (fired). Example 1 would work correctly. And Example 2 would work work correctly.

    Give them a test in XML Spy. It produces the correct results.

  • mgratacos

    08/11/09 1:43 pm

    Val WG: Irina think it’s done. She’ll check it an close it.

  • matthew

    08/11/09 1:45 pm

    Irina says at the VWG this is done but needs checking.

  • iyermakova

    03/16/10 6:48 pm

    Reviewed at the VWG on 03-09-2010. The rule should have been amended, Daniel Dui will check that we have not missed any.

  • danieldui

    03/23/10 4:11 pm

    I checked the rules as published in version 4.7 . None needs to be corrected. This issue can be closed.

  • danieldui

    03/23/10 4:13 pm

    I checked the rules as published in version 4.7 . None needs to be corrected. This issue can be closed.

  • Leave an update

    You must be logged in to post an update.