OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [OASIS Issue Tracker] (ODATA-1451) Rephrase definitions for any, all and aggregate


Heiko Theissen created ODATA-1451:
-------------------------------------

             Summary: Rephrase definitions for any, all and aggregate
                 Key: ODATA-1451
                 URL: https://issues.oasis-open.org/browse/ODATA-1451
             Project: OASIS Open Data Protocol (OData) TC
          Issue Type: Improvement
          Components: Data Aggregation, URL Conventions
            Reporter: Heiko Theissen


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.)



--
This message was sent by Atlassian Jira
(v8.3.3#803004)


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]