oasis-tcs / odata-abnf

OASIS OData TC: Supporting an ABNF for OData URLs, headers, and literal data values
https://github.com/oasis-tcs/odata-abnf
Other
11 stars 5 forks source link

$hierarchy #87

Closed HeikoTheissen closed 1 year ago

HeikoTheissen commented 1 year ago

To simplify the syntax of hierarchical transformations, remove the first three parameters $H,Q,I$ of the hierarchical transformations ancestors, descendants, traverse and of rolluprecursive and introduce a new system query option $hierarchy=$H,Q,I$. The third parameter $I$ can be omitted if it equals the @Aggregation.RecursiveHierarchy#Q/NodeProperty.

Without the redundancy, it seems justifiable to allow full-blown hierarchical transformations as optional parameters of rolluprecursive (#86):

SalesOrganizations?$apply=
descendants(filter(ID eq 'US'), keep start)
/groupby(
  (rolluprecursive(ancestors(filter(contains(Name, 'New York')), keep start))),
  aggregate(...)
)&$hierarchy=$root/SalesOrganizations,SalesOrgHierarchy

If the requested entity set is Sales instead of SalesOrganizations, however, the hierarchical transformations nested in rolluprecursive always use the node property path specified in the RecursiveHierarchy annotation, regardless of what is specified in the third parameter of the $hierarchy option.

Sales?$apply=
descendants(filter(SalesOrganization/ID eq 'US'), keep start)
/groupby(
  (rolluprecursive(ancestors(filter(contains(Name, 'New York')), keep start))),
  aggregate(...)
)&$hierarchy=$root/SalesOrganizations,SalesOrgHierarchy,SalesOrganization/ID

A similar switch in the node property path happens in connection with transformnested.

As an alternative to the system query option $hierarchy, we could introduce a transformation hierarchy$(H,Q,I,T)$ where $T$ is a transformation sequence.