Uploaded image for project: 'OASIS Open Data Protocol (OData) TC'
  1. OASIS Open Data Protocol (OData) TC
  2. ODATA-1265

Clarify property paths used in a lambda predicate expression

    XMLWordPrintable

    Details

    • Proposal:
      Hide

      1.

      Revised description for section 5.1.1.12 Lambda Operators (changes enclosed with *)

      OData defines two operators that evaluate a Boolean expression on a collection. Both must be prepended with a navigation path that identifies a collection.

      4.01 Services MUST support case-insensitive lambda operator names. Clients that want to work with 4.0 services MUST use lower case lambda operator names.

      The argument of a lambda operator is a case-sensitive lambda variable name followed by a colon ( : ) and a Boolean expression that uses the lambda variable name to refer to properties of members of the collection identified by the navigation path.

      If the name chosen for the lambda variable matches a property name of the current resource referenced by the resource path, the lambda variable takes precedence. Clients can prefix properties of the current resource referenced by the resource path with $it.

      Other path expressions in the Boolean expression neither prefixed with the lambda variable nor $it are evaluated in the scope of the collection instances at the origin of the navigation path prepended to the lambda operator.

      2.

      To illustrate evaluation of Boolean expressions not starting with a lambda variable or $it, add two examples to section 5.1.1.12.1 and 5.1.1.12.2:

      Example 92’: all employees having an order with a deviating shipping address

      http://host/service/Employees?$filter=Orders/any(o:o/ShipAddress ne Address)

      The Address path expression included in the predicate expression of the any lambda operator is evaluated in the scope of the Employee collection, because they are the origins of the Orders collection path prepended to the any operator.

       

      Example 93’:  all categories along with their products used in some order with a deviating unit price

      http://host/service/Categories?$expand=Products($filter=OrderItems/any(od:od/UnitPrice ne UnitPrice)

      UnitPrice is a path expression included in the predicate expression of the any lambda operator that gets evaluated in the scope of expanded product instances, because these are the origins of the OrderItems collection path prepended to the any operator.

      Show
      1. Revised description for section 5.1.1.12 Lambda Operators (changes enclosed with *) OData defines two operators that evaluate a Boolean expression on a collection. Both must be prepended with a navigation path that identifies a collection. 4.01 Services MUST support case-insensitive lambda operator names. Clients that want to work with 4.0 services MUST use lower case lambda operator names. The argument of a lambda operator is a case-sensitive lambda variable name followed by a colon ( : ) and a Boolean expression that uses the lambda variable name to refer to properties of members of the collection identified by the navigation path . If the name chosen for the lambda variable matches a property name of the current resource referenced by the resource path, the lambda variable takes precedence. Clients can prefix properties of the current resource referenced by the resource path with $it . Other path expressions in the Boolean expression neither prefixed with the lambda variable nor $it are evaluated in the scope of the collection instances at the origin of the navigation path prepended to the lambda operator. 2. To illustrate evaluation of Boolean expressions not starting with a lambda variable or $it, add two examples to section 5.1.1.12.1 and 5.1.1.12.2: Example 92’: all employees having an order with a deviating shipping address http://host/service/Employees?$filter=Orders/any(o:o/ShipAddress ne Address) The Address path expression included in the predicate expression of the any lambda operator is evaluated in the scope of the Employee collection, because they are the origins of the Orders collection path prepended to the any operator.   Example 93’:  all categories along with their products used in some order with a deviating unit price http://host/service/Categories?$expand=Products($filter=OrderItems/any(od:od/UnitPrice ne UnitPrice) UnitPrice is a path expression included in the predicate expression of the any lambda operator that gets evaluated in the scope of expanded product instances, because these are the origins of the OrderItems collection path prepended to the any operator.
    • Resolution:
      Show
      https://www.oasis-open.org/committees/download.php/64646/odata-v4.01-wd06-part2-url-conventions-2019-02-01.docx

      Description

      1. In section 5.1.1.12, para #3, the next to last word must be “navigation path” instead of “resource path”
      2. It should be explicitly noted that the meaning of a property path that does not start with either $it or a lambda variable is undefined within a lambda predicate expression

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              gerald.krause1 Gerald Krause
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: