-
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:
-
Resolution:
The current specification of the aggregate function (ODATA-1244) leaves undefined what the "input collection" is in cases like
$filter=Sales/any(p:aggregate(p/Amount mul TaxRate with sum) gt 5)
that include property paths with and without lambda variable.
Field | Original Value | New Value |
---|---|---|
Description |
The current specification of the {{aggregate}} function leaves undefined what the "input collection" is in cases like
{code:java} $filter=Sales/any(p:aggregate(p/Amount mul TaxRate with sum) gt 5) {code} that include property paths with and without lambda variable. Suggestion to rephrase the definitions: * All common expressions are evaluated in a context (i, c) that contains a _context instance_ i and a _context collection_ c. * The common expression {{any(j:commonExpr)}} evaluated in context (i, c) yields true if c contains an instance j for which commonExpr evaluated in context (i, c) yields true. * The common expression {{all(j:commonExpr)}} evaluated in context (i, c) yields true unless c contains an instance j for which commonExpr evaluated in context (i, c) does not yield true. * The common expression {{aggregate(aggregatable expression)}} evaluated in context (i, c) loops over c, evaluates for each instance j the aggregatable expression in context (j, c) and returns the aggregation of the resulting primitive values. * The common expression {{path/A}} (where A = any, all or aggregate) evaluated in context (i, c) evaluates to A evaluated in context (i, i/path). * Unless otherwise stated, other common expressions made up of sub-expressions (like {{e1 add e2}}) pass their context to their sub-expressions. * Query options like {{$filter}} and {{$compute}} take a common expression. They loop over the resource addressed by the resource path [OData-URL, section 4] and evaluate for each instance j the common expression in context (j, addressed resource). If the addressed resource is a singleton, it is treated like a one-element collection in this context. * {{$apply}} transformations like {{filter}} and {{compute}} have a common expression as parameter. They loop over their input set and evaluate for each instance j the common expression in context (j, input set). This is compatible with the current specification, but additionally allows expressions like {{path/aggregate(…)}}. It also allows {{filter(any(…))}}, if we want to continue forbidding that (for compatibility of the core spec), we need an additional rule: * The lambda operators {{any}} and {{all}} MUST occur after a {{path/}}. If we also want to forbid nestings like {{path/any(p:aggregate(p/Amount) …)}}, we could change the text as follows: * In the second and third bullet point, each instance j is evaluated in context (i, undefined). * A common expression that depends on the context collection MUST NOT encounter an undefined value. (In the {{path/any(p:aggregate(p/Amount) …)}} example, {{any}} would set an undefined context collection and {{aggregate}} would encounter that.) |
The current specification of the {{aggregate}} function ( {code:java} $filter=Sales/any(p:aggregate(p/Amount mul TaxRate with sum) gt 5) {code} that include property paths with and without lambda variable. Suggestion to rephrase the definitions: * All common expressions are evaluated in a context (i, c) that contains a _context instance_ i and a _context collection_ c. * The common expression {{any(j:commonExpr)}} evaluated in context (i, c) yields true if c contains an instance j for which commonExpr evaluated in context (i, c) yields true. * The common expression {{all(j:commonExpr)}} evaluated in context (i, c) yields true unless c contains an instance j for which commonExpr evaluated in context (i, c) does not yield true. * The common expression {{aggregate(aggregatable expression or property)}} evaluated in context (i, c) loops over c, evaluates for each instance j the aggregatable expression or property in context (j, c) and returns the aggregation of the resulting primitive values. * The common expression {{aggregate(custom aggregate)}} evaluated in context (i, c) yields the value of the custom aggregate applied to the collection c. * The common expression {{path/A}} (where A = any, all or aggregate) evaluated in context (i, c) evaluates to A evaluated in context (i, i/path). * Unless otherwise stated, other common expressions made up of sub-expressions (like {{e1 add e2}}) pass their context to their sub-expressions. * Query options like {{$filter}} and {{$compute}} take a common expression. They loop over the resource addressed by the resource path [OData-URL, section 4] and evaluate for each instance j the common expression in context (j, addressed resource). If the addressed resource is a singleton, it is treated like a one-element collection in this context. * {{$apply}} transformations like {{filter}} and {{compute}} have a common expression as parameter. They loop over their input set and evaluate for each instance j the common expression in context (j, input set). This is compatible with the current specification, but additionally allows expressions like {{path/aggregate(…)}}. It also allows {{filter(any(…))}}, if we want to continue forbidding that (for compatibility of the core spec), we need an additional rule: * The lambda operators {{any}} and {{all}} MUST occur after a {{path/}}. If we also want to forbid nestings like {{path/any(p:aggregate(p/Amount) …)}}, we could change the text as follows: * In the second and third bullet point, each instance j is evaluated in context (i, undefined). * A common expression that depends on the context collection MUST NOT encounter an undefined value. (In the {{path/any(p:aggregate(p/Amount) …)}} example, {{any}} would set an undefined context collection and {{aggregate}} would encounter that.) |
Description |
The current specification of the {{aggregate}} function ( {code:java} $filter=Sales/any(p:aggregate(p/Amount mul TaxRate with sum) gt 5) {code} that include property paths with and without lambda variable. Suggestion to rephrase the definitions: * All common expressions are evaluated in a context (i, c) that contains a _context instance_ i and a _context collection_ c. * The common expression {{any(j:commonExpr)}} evaluated in context (i, c) yields true if c contains an instance j for which commonExpr evaluated in context (i, c) yields true. * The common expression {{all(j:commonExpr)}} evaluated in context (i, c) yields true unless c contains an instance j for which commonExpr evaluated in context (i, c) does not yield true. * The common expression {{aggregate(aggregatable expression or property)}} evaluated in context (i, c) loops over c, evaluates for each instance j the aggregatable expression or property in context (j, c) and returns the aggregation of the resulting primitive values. * The common expression {{aggregate(custom aggregate)}} evaluated in context (i, c) yields the value of the custom aggregate applied to the collection c. * The common expression {{path/A}} (where A = any, all or aggregate) evaluated in context (i, c) evaluates to A evaluated in context (i, i/path). * Unless otherwise stated, other common expressions made up of sub-expressions (like {{e1 add e2}}) pass their context to their sub-expressions. * Query options like {{$filter}} and {{$compute}} take a common expression. They loop over the resource addressed by the resource path [OData-URL, section 4] and evaluate for each instance j the common expression in context (j, addressed resource). If the addressed resource is a singleton, it is treated like a one-element collection in this context. * {{$apply}} transformations like {{filter}} and {{compute}} have a common expression as parameter. They loop over their input set and evaluate for each instance j the common expression in context (j, input set). This is compatible with the current specification, but additionally allows expressions like {{path/aggregate(…)}}. It also allows {{filter(any(…))}}, if we want to continue forbidding that (for compatibility of the core spec), we need an additional rule: * The lambda operators {{any}} and {{all}} MUST occur after a {{path/}}. If we also want to forbid nestings like {{path/any(p:aggregate(p/Amount) …)}}, we could change the text as follows: * In the second and third bullet point, each instance j is evaluated in context (i, undefined). * A common expression that depends on the context collection MUST NOT encounter an undefined value. (In the {{path/any(p:aggregate(p/Amount) …)}} example, {{any}} would set an undefined context collection and {{aggregate}} would encounter that.) |
The current specification of the {{aggregate}} function ( {code:java} $filter=Sales/any(p:aggregate(p/Amount mul TaxRate with sum) gt 5) {code} that include property paths with and without lambda variable. Suggestion to rephrase the definitions: * All common expressions are evaluated in a context (i, c) that contains a _context instance_ i and a _context collection_ c. * The common expression {{any(j:commonExpr)}} evaluated in context (i, c) yields true if c contains an instance j for which commonExpr evaluated in context (i, c) yields true. * The common expression {{all(j:commonExpr)}} evaluated in context (i, c) yields true unless c contains an instance j for which commonExpr evaluated in context (i, c) does not yield true. * The common expression {{aggregate(aggregatable expression or property)}} evaluated in context (i, c) loops over c, evaluates for each instance j the aggregatable expression or property in context (j, c) and yields the aggregation of the resulting primitive values. * The common expression {{aggregate(custom aggregate)}} evaluated in context (i, c) yields the value of the custom aggregate applied to the collection c. * The common expression {{path/A}} (where A = any, all or aggregate) evaluated in context (i, c) evaluates to A evaluated in context (i, i/path). * Unless otherwise stated, other common expressions made up of sub-expressions (like {{e1 add e2}}) pass their context to their sub-expressions. * Query options like {{$filter}} and {{$compute}} take a common expression. They loop over the resource addressed by the resource path [OData-URL, section 4] and evaluate for each instance j the common expression in context (j, addressed resource). If the addressed resource is a singleton, it is treated like a one-element collection in this context. * {{$apply}} transformations like {{filter}} and {{compute}} have a common expression as parameter. They loop over their input set and evaluate for each instance j the common expression in context (j, input set). This is compatible with the current specification, but additionally allows expressions like {{path/aggregate(…)}}. It also allows {{filter(any(…))}}, if we want to continue forbidding that (for compatibility of the core spec), we need an additional rule: * The lambda operators {{any}} and {{all}} MUST occur after a {{path/}}. If we also want to forbid nestings like {{path/any(p:aggregate(p/Amount) …)}}, we could change the text as follows: * In the second and third bullet point, each instance j is evaluated in context (i, undefined). * A common expression that depends on the context collection MUST NOT encounter an undefined value. (In the {{path/any(p:aggregate(p/Amount) …)}} example, {{any}} would set an undefined context collection and {{aggregate}} would encounter that.) |
Proposal |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection.
{code:java} Products?$filter=Sales/aggregate(p:p/Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:q/Amount)) {code} |
|
Environment | Proposed |
Proposal |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection.
{code:java} Products?$filter=Sales/aggregate(p:p/Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:q/Amount)) {code} |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection.
{code:java} Products?$filter=Sales/aggregate(p:p/Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:q/Amount)) {code} See also [oasis-tcs/odata-abnf#36|https://github.com/oasis-tcs/odata-abnf/pull/36]. |
Proposal |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection.
{code:java} Products?$filter=Sales/aggregate(p:p/Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:q/Amount)) {code} See also [oasis-tcs/odata-abnf#36|https://github.com/oasis-tcs/odata-abnf/pull/36]. |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection.
{code:java} Products?$filter=Sales/aggregate(p:p/Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:q/Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Proposal |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection.
{code:java} Products?$filter=Sales/aggregate(p:p/Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:q/Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection.
{code:java} Products?$filter=Sales/aggregate(p:Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Proposal |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection.
{code:java} Products?$filter=Sales/aggregate(p:Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection.
{code:java} Products?$filter=Sales/aggregate(p:p/Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Proposal |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection.
{code:java} Products?$filter=Sales/aggregate(p:p/Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(p:p/Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Component/s | URL Conventions [ 10270 ] |
Affects Version/s | V4.0_CS02 [ 10336 ] |
Fix Version/s | V4.0_CSD04 [ 10567 ] |
Proposal |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(p:p/Amount) gt 100 {code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the resource addressed by the resource path [OData-URL, section 4]. If the addressed resource is a single instance, the current collection is undefined. * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option or an expression nested within {{$expand}} or {{$select}}, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a sort or [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the collection being filtered or sorted or augmented. {code:java} Customers?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price){code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Status | New [ 10000 ] | Open [ 1 ] |
Proposal |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option or an expression nested within {{$expand}} or {{$select}}, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in a sort or [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145], the current collection is the collection being filtered or sorted or augmented. {code:java} Customers?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price){code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option or an expression nested within {{$expand}} or {{$select}}, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Customers?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Proposal |
* The {{aggregate}} function must be prepended with a -navigation- path that identifies a collection. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * {{$these}} is a new kind of [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option or an expression nested within {{$expand}} or {{$select}}, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Customers?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function must be prepended with a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561]. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * {{$these}} is a new kind of {{collectionPathExpr}} that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option or an expression nested within {{$expand}} or {{$select}}, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Customers?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Proposal |
* The {{aggregate}} function must be prepended with a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561]. Inside it, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within that collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * {{$these}} is a new kind of {{collectionPathExpr}} that evaluates to a "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option or an expression nested within {{$expand}} or {{$select}}, when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Customers?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path that prepends the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function behaves like a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] and must come after a (navigation) property name that addresses the collection to be aggregated. Inside the parentheses that follow, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within the addressed collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * The collection to be aggregated can alternatively be addressed by the keyword {{$these}}. There is a new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Customers?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Description |
The current specification of the {{aggregate}} function ( {code:java} $filter=Sales/any(p:aggregate(p/Amount mul TaxRate with sum) gt 5) {code} that include property paths with and without lambda variable. Suggestion to rephrase the definitions: * All common expressions are evaluated in a context (i, c) that contains a _context instance_ i and a _context collection_ c. * The common expression {{any(j:commonExpr)}} evaluated in context (i, c) yields true if c contains an instance j for which commonExpr evaluated in context (i, c) yields true. * The common expression {{all(j:commonExpr)}} evaluated in context (i, c) yields true unless c contains an instance j for which commonExpr evaluated in context (i, c) does not yield true. * The common expression {{aggregate(aggregatable expression or property)}} evaluated in context (i, c) loops over c, evaluates for each instance j the aggregatable expression or property in context (j, c) and yields the aggregation of the resulting primitive values. * The common expression {{aggregate(custom aggregate)}} evaluated in context (i, c) yields the value of the custom aggregate applied to the collection c. * The common expression {{path/A}} (where A = any, all or aggregate) evaluated in context (i, c) evaluates to A evaluated in context (i, i/path). * Unless otherwise stated, other common expressions made up of sub-expressions (like {{e1 add e2}}) pass their context to their sub-expressions. * Query options like {{$filter}} and {{$compute}} take a common expression. They loop over the resource addressed by the resource path [OData-URL, section 4] and evaluate for each instance j the common expression in context (j, addressed resource). If the addressed resource is a singleton, it is treated like a one-element collection in this context. * {{$apply}} transformations like {{filter}} and {{compute}} have a common expression as parameter. They loop over their input set and evaluate for each instance j the common expression in context (j, input set). This is compatible with the current specification, but additionally allows expressions like {{path/aggregate(…)}}. It also allows {{filter(any(…))}}, if we want to continue forbidding that (for compatibility of the core spec), we need an additional rule: * The lambda operators {{any}} and {{all}} MUST occur after a {{path/}}. If we also want to forbid nestings like {{path/any(p:aggregate(p/Amount) …)}}, we could change the text as follows: * In the second and third bullet point, each instance j is evaluated in context (i, undefined). * A common expression that depends on the context collection MUST NOT encounter an undefined value. (In the {{path/any(p:aggregate(p/Amount) …)}} example, {{any}} would set an undefined context collection and {{aggregate}} would encounter that.) |
The current specification of the {{aggregate}} function ( {code:java} $filter=Sales/any(p:aggregate(p/Amount mul TaxRate with sum) gt 5) {code} that include property paths with and without lambda variable. |
Proposal |
* The {{aggregate}} function behaves like a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] and must come after a (navigation) property name that addresses the collection to be aggregated. Inside the parentheses that follow, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within the addressed collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * The collection to be aggregated can alternatively be addressed by the keyword {{$these}}. There is a new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Customers?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function behaves like a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] and must come after a (navigation) property name that addresses the collection to be aggregated. Inside the parentheses that follow, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within the addressed collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * The collection to be aggregated can alternatively be addressed by the keyword {{$these}}. There is a new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Proposal |
* The {{aggregate}} function behaves like a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] and must come after a (navigation) property name that addresses the collection to be aggregated. Inside the parentheses that follow, common expressions are evaluated like in lambda operators. The lambda variable evaluates to the current instance within the addressed collection (whereas an unprefixed {{Amount}} would be evaluated in the context of the {{Products}} instance currently being filtered).
{code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * The collection to be aggregated can alternatively be addressed by the keyword {{$these}}. There is a new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Proposal |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection addressed by the path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection identified by the navigation path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
Proposal |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection identified by the navigation path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection identified by the navigation path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. The third paragraph in [OData-Aggr, section 3.24 "Function aggregate"] must be rewritten to reflect the rules above. The {{$these}} keyword and "current collection" concept introduced in these rules are not mentioned outside of that section for now. |
Proposal |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection identified by the navigation path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. The third paragraph in [OData-Aggr, section 3.24 "Function aggregate"] must be rewritten to reflect the rules above. The {{$these}} keyword and "current collection" concept introduced in these rules are not mentioned outside of that section for now. |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. The current collection is also at the origin of the path {{$these}}, therefore {{s/Amount}} could be replaced by {{Amount}} in the following example. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:s/Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection identified by the navigation path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. The third paragraph in [OData-Aggr, section 3.24 "Function aggregate"] must be rewritten to reflect the rules above. The {{$these}} keyword and "current collection" concept introduced in these rules are not mentioned outside of that section for now. |
Proposal |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. The current collection is also at the origin of the path {{$these}}, therefore {{s/Amount}} could be replaced by {{Amount}} in the following example. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:s/Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection identified by the navigation path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. The third paragraph in [OData-Aggr, section 3.24 "Function aggregate"] must be rewritten to reflect the rules above. The {{$these}} keyword and "current collection" concept introduced in these rules are not mentioned outside of that section for now. |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. The current collection is also at the origin of the path {{$these}}, therefore {{s/Amount}} could be replaced by {{Amount}} in the following example. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:s/Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection identified by the navigation path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. The third paragraph in [OData-Aggr, section 3.24 "Function aggregate"] must be rewritten to reflect the rules above. The {{$these}} keyword and "current collection" concept introduced in these rules are not mentioned outside of that section for now. See https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69074/ODATA-1451.docx |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution |
[https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69078/odata-data-aggregation-ext-v4.0-wd05.docx]
[https://d.docs.live.net/17ea5a0da4145c51/OData/odata-data-aggregation-ext-v4.0-wd05.docx] (editable) |
|
Environment | Proposed | Resolved |
Proposal |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. The current collection is also at the origin of the path {{$these}}, therefore {{s/Amount}} could be replaced by {{Amount}} in the following example. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:s/Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection identified by the navigation path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. The third paragraph in [OData-Aggr, section 3.24 "Function aggregate"] must be rewritten to reflect the rules above. The {{$these}} keyword and "current collection" concept introduced in these rules are not mentioned outside of that section for now. See https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69074/ODATA-1451.docx |
* The {{aggregate}} function is considered a [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561] (rather than a {{methodCallExpr}}) and must be prepended with a navigation path that addresses the input collection (in the sense of {code:java} Products?$filter=Sales/aggregate(s:s/Amount mul TaxRate with sum) gt 100{code} * Instead of a navigation path, the input collection can also be addressed by the keyword {{$these}}. A new kind of {{[{{propertyPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L516-L523]}} is introduced in which {{$these}} addresses the "current collection" (defined below), in analogy with the current instance {{$this}} [OData-URL, section 5.1.1.14.6]. The current collection is also at the origin of the path {{$these}}, therefore {{s/Amount}} could be replaced by {{Amount}} in the following example. {code:java} Sales?$apply=groupby((Product),filter($these/aggregate(s:s/Amount) lt 100)){code} * {{$these}} can be prepended to collection path expressions like {{any}}, {{all}} and {{aggregate}}. (But we allow only {{$these/aggregate}} for now, so as not to touch the core spec.) See also * In a system query option (possibly nested within {{$expand}} or {{$select}}), when evaluating the {{boolCommonExpr}} in a [{{filter}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L313] or the {{commonExpr}} in an [{{orderbyItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L316] or [{{computeItem}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L281], the current collection is the collection being filtered or ordered or augmented. {code:java} Products?$select=Sales($filter=$these/aggregate(s:Price with avg) gt $this/Price) {code} * In an {{$apply}} transformation, when evaluating the {{boolCommonExpr}} in a [{{filterTrafo}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L145] or the {{commonExpr}} in a [{{computeExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-aggregation-abnf.txt#L129], the current collection is the input set of the transformation. * When evaluating a {{commonExpr}} in its nearest [{{collectionPathExpr}}|https://github.com/oasis-tcs/odata-abnf/blob/513b5bd1319d3093491d76a30ea91ded619b9e5a/abnf/odata-abnf-construction-rules.txt#L556-L561], the current collection is the collection identified by the navigation path before the {{collectionPathExpr}}. This allows things like {code:java} Products?$filter=Sales/any(p:p/Amount gt $these/aggregate(q:Amount)) {code} See also [oasis-tcs/odata-abnf#37|https://github.com/oasis-tcs/odata-abnf/pull/37]. The third paragraph in [OData-Aggr, section 3.24 "Function aggregate"] must be rewritten to reflect the rules above. The {{$these}} keyword and "current collection" concept introduced in these rules are not mentioned outside of that section for now. See [https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69074/ODATA-1451.docx] |
Environment | Resolved | Applied |
Resolution | [https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69078/odata-data-aggregation-ext-v4.0-wd05.docx] |
[https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69078/odata-data-aggregation-ext-v4.0-wd05.docx]
2022-02-11: Resolution edited to allow the {{aggregate}} function in {{/$filter}} segments and {{orderby}} transformations: https://www.oasis-open.org/apps/org/workgroup/odata/download.php/69595/odata-data-aggregation-ext-v4.0-wd05.docx |
Status | Resolved [ 5 ] | Applied [ 10002 ] |
Status | Applied [ 10002 ] | Closed [ 6 ] |