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

Clarify treatment of duplicates in OData-Aggr example 7

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_CS02
    • Fix Version/s: V4.0_CSD04
    • Component/s: Data Aggregation
    • Labels:
      None
    • Environment:

      Applied

    • Proposal:
      Hide

      Modify the relevant part of the specification as follows (deletions are striked out, insertions are in italics or indented). To be discussed whether the fifth alternative (the green text) can be abolished and remove example 7. TC agrees to abolish it on 2021-06-10.

      The aggregate transformation takes a comma-separated list of one or more aggregate expressions as parameters and returns a result set with a single instance, representing the aggregated value for all instances in the input set.

      In the following, P is a path made up of navigation properties, complex properties, and complex collection properties.

      An aggregate expression may be:

      • an aggregatable expression on the input set with a specified aggregation method,
      • an aggregatable property that can be reached via a path P consisting of a sequence of navigation properties, complex properties and complex collection properties, with a specified aggregation method,
      • a custom aggregate that can be reached via a path P consisting of a sequence of navigation properties, complex properties and complex collection properties,
      • any of the above, followed by a from expression,
      • any of the above, enclosed in parentheses and prefixed with a navigation path to related entities, which serve as input set for the enclosed aggregate expression,
      • $count, which is a shortcut for the expression 1 with sum

      If P is present, it must be well-defined for all instances in the input set. Let Q be the portion of P up to and including the last navigation property, if any, and let R be the remainder, if any, of P that contains no navigation properties, such that P equals the concatenated path Q/R. The aggregate transformation considers each entity reached via the path Q exactly once. To this end

      • if Q is non-empty, let E be the set of distinct entities reached via Q starting from the input set
      • if Q is empty, let E be the input set (which may contain multiple instances with the same value).

      Then, if R is empty, the aggregated value is computed for all instances in E, otherwise the aggregated value is computed for all instances addressed via R starting from E.

      If no paths are present, the aggregated value is computed for all instances in the input set.

      Any aggregate expression that specifies an aggregation method MUST define an alias for the resulting aggregated value. The resulting instance contains one dynamic property per parameter representing the aggregated value across all instances within the input set. If paths are present, the corresponding navigation properties are implicitly expanded to make the properties part of the result representation.

      The properties of P do not appear in the result (cf. example 59, with P = Q = Sales and R = empty).

      Show
      Modify the relevant part of the specification as follows (deletions are striked out, insertions are in italics or indented). To be discussed whether the fifth alternative (the green text) can be abolished and remove example 7. TC agrees to abolish it on 2021-06-10. The aggregate transformation takes a comma-separated list of one or more aggregate expressions as parameters and returns a result set with a single instance, representing the aggregated value for all instances in the input set. In the following, P is a path made up of navigation properties, complex properties, and complex collection properties. An aggregate expression may be: an aggregatable expression on the input set with a specified aggregation method, an aggregatable property that can be reached via a path P   consisting of a sequence of navigation properties, complex properties and complex collection properties, with a specified aggregation method, a custom aggregate that can be reached via a path P   consisting of a sequence of navigation properties, complex properties and complex collection properties, any of the above, followed by a from expression, any of the above, enclosed in parentheses and prefixed with a navigation path to related entities, which serve as input set for the enclosed aggregate expression, $count, which is a shortcut for the expression 1 with sum If P is present, it must be well-defined for all instances in the input set. Let Q be the portion of P up to and including the last navigation property, if any, and let R be the remainder, if any, of P that contains no navigation properties, such that P equals the concatenated path Q/R. The aggregate transformation considers each entity reached via the path Q exactly once. To this end if Q is non-empty, let E be the set of distinct entities reached via Q starting from the input set if Q is empty, let E be the input set (which may contain multiple instances with the same value). Then, if R is empty, the aggregated value is computed for all instances in E, otherwise the aggregated value is computed for all instances addressed via R starting from E. If no paths are present, the aggregated value is computed for all instances in the input set. Any aggregate expression that specifies an aggregation method MUST define an alias for the resulting aggregated value. The resulting instance contains one dynamic property per parameter representing the aggregated value across all instances within the input set . If paths are present, the corresponding navigation properties are implicitly expanded to make the properties part of the result representation. The properties of P do not appear in the result (cf. example 59, with P = Q = Sales and R = empty).
    • Resolution:
      Hide

      https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69078/odata-data-aggregation-ext-v4.0-wd05.docx

      Resolution edited on 2022-01-21: Path P may not only contain navigation and complex properties, but also entity- or complex-valued instance annotations. The ABNF already supports that. See https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69525/odata-data-aggregation-ext-v4.0-wd05.docx

      Show
      https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69078/odata-data-aggregation-ext-v4.0-wd05.docx Resolution edited on 2022-01-21: Path P may not only contain navigation and complex properties, but also entity- or complex-valued instance annotations. The ABNF already supports that. See  https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69525/odata-data-aggregation-ext-v4.0-wd05.docx

      Description

      Example 7 in the aggregate ... as specification leaves unclear whether entities that are reachable via more than one instance path are considered once during aggregation or as often as they are reachable.

      Does

      GET CainAndAbel?$apply=aggregate(Parents($count as c))
      

      count Adam and Eve once or twice (https://www.bibleserver.com/KJV/Genesis4)? Is the result

      "Parents": [{"c": 2}]
      

      or 4?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              heiko.theissen Heiko Theissen
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: