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

Extend transformation nest to multiple sequences

    XMLWordPrintable

    Details

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

      Applied

    • Proposal:
      Hide

      The nest transformation takes a comma-separated list of one or more nest expressions as parameters. A nest expression is a sequence of set transformations followed by a SimpleIdentifier, called an alias (see [OData-CSDL, section 17.2]). This alias MUST NOT collide with names of properties in the input set or with other aliases introduced in the same nest transformation.

      The result set consists of a single entity having one dynamic property per nest expression. The name of the added property is the alias following the as keyword. The value of the property is the result collection of the transformation sequence in the nest expression applied to the input set:

      nest( t_1 as cnp_1, ..., t_N as cnp_N ) returns

      [{ <cnp_1>: [ <result of t_1 applied to input set> ],
        ...
        <cnp_N>: [ <result of t_N applied to input set> ]
      }]
      
      Show
      The nest transformation takes a comma-separated list of one or more nest expressions as parameters. A nest expression is a sequence of set transformations followed by a SimpleIdentifier, called an alias (see [OData-CSDL, section 17.2] ). This alias MUST NOT collide with names of properties in the input set or with other aliases introduced in the same nest transformation. The result set consists of a single entity having one dynamic property per nest expression. The name of the added property is the alias following the as keyword. The value of the property is the result collection of the transformation sequence in the nest expression applied to the input set: nest( t_1 as cnp_1, ..., t_N as cnp_N ) returns [{ <cnp_1>: [ <result of t_1 applied to input set> ], ... <cnp_N>: [ <result of t_N applied to input set> ] }]

      Description

      Currently, nest can be used to create an entity with a single containment navigation property holding the result of a transformation sequence:

      nest( cnp, t ) returns

      [{ <cnp>: [ <result of t applied to input set> ] }]

      There are use cases to generalize this and nest the results of multiple transformation sequences at once. Consider, for example, a request to combine the results of two transformations in a single response. Using transformation concat requires an extra computation of a concat index to relate an entity in the result to the corresponding concat argument (see ODATA-1138):

      GET ~/Sales?$apply=concat(
         filter(<complex expression 1>)
         }}{{/groupby((Customer),aggregate(Amount with sum as Total))/compute(1 as concat_index),
         filter(<complex expression 2>)
         /groupby((Customer),aggregate(Amount with sum as Total))/compute(2 as concat_index))

       

      If it makes sense to keep the results of the two transformations separately, they could be retrieved via an extended syntax of the transformation nest:

      GET ~/Sales?$apply=nest(
         filter(<complex expression 1>)
         /groupby((Customer),aggregate(Amount with sum as Total)) as part_1,
         filter(<complex expression 2>)
         /groupby((Customer),aggregate(Amount with sum as Total)) as part_2)

       

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: