[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [OASIS Issue Tracker] (ODATA-827) introduce $compute query option
[ https://issues.oasis-open.org/browse/ODATA-827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ralf Handl updated ODATA-827: ----------------------------- Proposal: Add "$compute" query option allowing additional computed properties to be added to each instance. The syntax is similar to the compute() transformation in Data Aggregation, i.e. $compute=<list of compute expressions>, but without the restriction to simple values: allowed compute expressions are any expressions valid in a $filter system query option on the input set. More formally: compute = '$compute' EQ computeItem *( COMMA computeItem ) computeItem = commonExpr RWS 'as' RWS computedProperty computedProperty = odataIdentifier $compute is also allowed as query option nested within $expand to add computed dynamic properties to expanded entities. $compute is logically evaluated first, so the computed dynamic properties can be used in $expand, $filter, $orderby, and $select. Computed structural properties SHOULD be added to the default selection (in absence of $select), and are treated as other dynamic properties: - $select=* includes computed structural properties - $expand=* includes computed navigation properties or computed entities/collections of entities - appear in context URL same way as other (dynamic) properties GET ~Customers?$expand=Orders($compute=price*qty as totalprice;$select=name,price,qty,totalprice) Note: in this example, totalprice is available outside of the expand as Orders/totalprice, as in: GET ~Customers?$filter=Orders/any(o:o/totalprice gt 100)&$expand=Orders($compute=price*qty as totalprice;$select=name,price,qty,totalprice) was: Add "$compute" query option allowing additional computed properties to be added to each instance. The syntax is similar to the compute() transformation in Data Aggregation, i.e. $compute=<list of compute expressions>, but without the restriction to simple values: allowed compute expressions are any expressions valid in a $filter system query option on the input set. More formally: compute = '$compute' EQ computeItem *( COMMA computeItem ) computeItem = commonExpr RWS 'as' RWS computedProperty computedProperty = odataIdentifier $compute is also allowed as query option nested within $expand to add computed dynamic properties to expanded entities. $compute is logically evaluated first, so the computed dynamic properties can be used in $expand, $filter, $orderby, and $select. Computed structural properties SHOULD be added to the default selection (in absence of $select), and are treated as other dynamic properties: - $select=* includes computed structural properties - $expand=* includes computed navigation properties or computed entities/collections of entities - appear in context URL same way as other (dynamic) properties GET ~Customers?$expand=Orders($compute=price*qty as totalprice;$select=name,price,qty,totalprice) Note: in this example, totalprice is available outside of the expand as Orders/totalprice, as in: GET ~Customers?$filter=Orders/totalprice gt 100&$expand=Orders($compute=price*qty as totalprice;$select=name,price,qty,totalprice) > introduce $compute query option > ------------------------------- > > Key: ODATA-827 > URL: https://issues.oasis-open.org/browse/ODATA-827 > Project: OASIS Open Data Protocol (OData) TC > Issue Type: Improvement > Components: OData Protocol, OData URL Conventions > Affects Versions: V4.0_WD01 > Environment: New Query Capabilities > Reporter: Andrew Eisenberg > Labels: GoodIdea, Usability > Fix For: V4.01_WD01 > > > OData could be extended to allow derived computed values to be returned along with the properties of an entity. > This could be expressed as: > http://odata.netflix.com/v2/Catalog/Titles?$compute=substring(ShortSynopsis,20) as Summary&$select=Name,Summary > In ODATA-9 we added support for an equivalent compute transformation in our Data Aggregation Extensions. -- This message was sent by Atlassian JIRA (v6.2.2#6258)
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]