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

Transformation for nesting the result of another transformation within a single entity

    Details

    • Type: New Feature
    • Status: Closed
    • 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

      An OData representation of a grid-like result spanned by multiple axes could be achieved by a new transformation nest() that allows to embed data of grid cells as a nested collection of entities representing grid rows. 

      Relevant excerpt from section 3 in the referenced document: The nest transformation has two parameters. The first takes the name of a dynamic containment navigation property, the second is a (chain of) $apply transformations. nest( cnp, t ) applies transformation chain t to the input set and creates a result set containing a single entity that only contains the navigation property cnp, which in turn holds the result collection of t applied to the input set:

      { <cnp>: [ <result of t applied to input set> ] }
      
      Show
      An OData representation of a grid-like result spanned by multiple axes could be achieved by a new transformation nest() that allows to embed data of grid cells as a nested collection of entities representing grid rows.  Relevant excerpt from section 3 in the referenced document: The nest transformation has two parameters. The first takes the name of a dynamic containment navigation property, the second is a (chain of) $apply transformations. nest( cnp, t ) applies transformation chain t to the input set and creates a result set containing a single entity that only contains the navigation property cnp , which in turn holds the result collection of t applied to the input set: { <cnp>: [ <result of t applied to input set> ] }

      Description

      This new feature is motivated by a concrete use case. The current version of the Data Aggregation specification already includes an example for a cross-table and describes how to retrieve its data using transformation groupby in combination with rollup. However, this data is returned as linear collection of entities. For working with data in a grid efficiently, it must be possible to access selected sections of the grid. Details are described in the document “Grid-Like Access to Aggregated Data”, sections 2 and 3: https://www.oasis-open.org/committees/document.php?document_id=62593&wg_abbrev=odata

        Attachments

          Activity

          Hide
          gerald.krause1 Gerald Krause added a comment - - edited

          Some examples to illustrate the transpose transformation applied to the data model in the data aggregation extension specification:

          1. Rolodex: Retrieve index cards for customers

          GET Customers?$apply = compute( substring( Name, 0, 1 ) as FirstLetter )
          / groupby( (FirstLetter), transpose( Customers, identity ) )

          returns

          [ { “FirstLetter”: “J”, “Customers”: [ { “ID”: “C1”, … } ] },
            { “FirstLetter”: “S”, “Customers”: [ { “ID”: “C2”, … }, 
                                                 { “ID”: “C3”, … } ] }
          ]
          

          2. Retrieve customers per product category

          GET Sales?$apply = groupby( (Product/Category/ID),
          transpose( Customers, groupby( (Customer/ID) ) )

          returns

          [ { “Product”: { “Category”: { “ID”: “PG1”} }, 
              “Customers”: [ { “Customer”: { “ID”: “C1”} }, 
                             { “Customer”: { “ID”: “C2” } }, 
                             { “Customer”: { "ID": “C3” } } ] },
          { “Product”: { “Category”: { “ID”: “PG2”} }, 
              “Customers”: [ { “Customer”: { “ID”: “C1”} }, 
                             { “Customer”: { “ID”: “C2” } }, 
                             { “Customer”: { "ID": “C3” } } ] }
          ]
          
          Show
          gerald.krause1 Gerald Krause added a comment - - edited Some examples to illustrate the transpose transformation applied to the data model in the data aggregation extension specification: 1. Rolodex: Retrieve index cards for customers GET Customers?$apply = compute( substring( Name, 0, 1 ) as FirstLetter ) / groupby( (FirstLetter), transpose( Customers, identity ) ) returns [ { “FirstLetter”: “J”, “Customers”: [ { “ID”: “C1”, … } ] }, { “FirstLetter”: “S”, “Customers”: [ { “ID”: “C2”, … }, { “ID”: “C3”, … } ] } ] 2. Retrieve customers per product category GET Sales?$apply = groupby( (Product/Category/ID), transpose( Customers, groupby( (Customer/ID) ) ) returns [ { “Product”: { “Category”: { “ID”: “PG1”} }, “Customers”: [ { “Customer”: { “ID”: “C1”} }, { “Customer”: { “ID”: “C2” } }, { “Customer”: { "ID": “C3” } } ] }, { “Product”: { “Category”: { “ID”: “PG2”} }, “Customers”: [ { “Customer”: { “ID”: “C1”} }, { “Customer”: { “ID”: “C2” } }, { “Customer”: { "ID": “C3” } } ] } ]
          Hide
          mikep Michael Pizzo (Inactive) added a comment -

          Discussed in 2018-5-24.  Agreed to change the name to "nest"

          Show
          mikep Michael Pizzo (Inactive) added a comment - Discussed in 2018-5-24.  Agreed to change the name to "nest"
          Hide
          handl Ralf Handl added a comment -

          Resolved 2018-05-24

          Show
          handl Ralf Handl added a comment - Resolved 2018-05-24

            People

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

              Dates

              • Created:
                Updated:
                Resolved: