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-1163) A Case for Common Expressions


     [ https://issues.oasis-open.org/browse/ODATA-1163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gerald Krause updated ODATA-1163:
---------------------------------

    Description: 
Support of case expressions as known from the SQL standard would add to the ad hoc capabilities and support use cases that require such an IF-THEN-ELSE logic.

Imagine case( condition_1 : value_1, ..., condition_N : value_N [, else_value] ) would be available as canonical function for common expressions; an omitted else defaults to null. Here are some examples that could be addressed with it:

1. Core OData: Ad-hoc calculations with logic on the current property values:
Example: Signum(x)

GET ~/XValues?$compute=case(X > 0 : 1,X < 0 : -1, 0) as SignumX&$select=X,SignumX

2. Data Aggregation extension: Restricting aggregation to those values that occur in combination with certain groupable property values:
Example: Comparing company revenues for years 2000 and 2017

GET ~/Sales?$apply=groupby((Company), aggregate(case(Time/Year eq 2000 : Revenue) with sum as TotalRevenue2000, case(Time/Year eq 2017 : Revenue) with sum as TotalRevenue2017))

3. Data Aggregation extension: Defining dynamic groupable properties
Example: From a collection of incidents with fine-grained state model (e.g., new, assigned, resolved, verified, reopened, closed) retrieve the aggregated count of open and closed incidents:

GET ~/Incidents?$apply=compute(case(Status eq ‘Closed’ : ‘Closed’, ‘Open’) as ProcessingStatus)/groupby((ProcessingStatus), aggregate($count as IncidentCount))


  was:
Support of case expressions as known from the SQL standard would add to the ad hoc capabilities and support use cases that require such an IF-THEN-ELSE logic.

Imagine case( condition_1, value_1, ..., condition_N, value_N [, else_value] ) would be available as canonical function for common expressions; an omitted else defaults to null. Here are some examples that could be addressed with it:

1. Core OData: Ad-hoc calculations with logic on the current property values:
Example: Signum(x)

GET ~/XValues?$compute=case(X > 0, 1,X < 0, -1, 0) as SignumX&$select=X,SignumX

2. Data Aggregation extension: Restricting aggregation to those values that occur in combination with certain groupable property values:
Example: Comparing company revenues for years 2000 and 2017

GET ~/Sales?$apply=groupby((Company), aggregate(case(Time/Year eq 2000, Revenue) with sum as TotalRevenue2000, case(Time/Year eq 2017, Revenue) with sum as TotalRevenue2017))

3. Data Aggregation extension: Defining dynamic groupable properties
Example: From a collection of incidents with fine-grained state model (e.g., new, assigned, resolved, verified, reopened, closed) retrieve the aggregated count of open and closed incidents:

GET ~/Incidents?$apply=compute(case(Status eq ‘Closed’, ‘Closed’, ‘Open’) as ProcessingStatus)/groupby((ProcessingStatus), aggregate($count as IncidentCount))



> A Case for Common Expressions
> -----------------------------
>
>                 Key: ODATA-1163
>                 URL: https://issues.oasis-open.org/browse/ODATA-1163
>             Project: OASIS Open Data Protocol (OData) TC
>          Issue Type: New Feature
>          Components: Protocol, URL Conventions
>    Affects Versions: V4.01_CS01
>            Reporter: Gerald Krause
>             Fix For: V4.01_CS02
>
>
> Support of case expressions as known from the SQL standard would add to the ad hoc capabilities and support use cases that require such an IF-THEN-ELSE logic.
> Imagine case( condition_1 : value_1, ..., condition_N : value_N [, else_value] ) would be available as canonical function for common expressions; an omitted else defaults to null. Here are some examples that could be addressed with it:
> 1. Core OData: Ad-hoc calculations with logic on the current property values:
> Example: Signum(x)
> GET ~/XValues?$compute=case(X > 0 : 1,X < 0 : -1, 0) as SignumX&$select=X,SignumX
> 2. Data Aggregation extension: Restricting aggregation to those values that occur in combination with certain groupable property values:
> Example: Comparing company revenues for years 2000 and 2017
> GET ~/Sales?$apply=groupby((Company), aggregate(case(Time/Year eq 2000 : Revenue) with sum as TotalRevenue2000, case(Time/Year eq 2017 : Revenue) with sum as TotalRevenue2017))
> 3. Data Aggregation extension: Defining dynamic groupable properties
> Example: From a collection of incidents with fine-grained state model (e.g., new, assigned, resolved, verified, reopened, closed) retrieve the aggregated count of open and closed incidents:
> GET ~/Incidents?$apply=compute(case(Status eq ‘Closed’ : ‘Closed’, ‘Open’) as ProcessingStatus)/groupby((ProcessingStatus), aggregate($count as IncidentCount))



--
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]