-
Notifications
You must be signed in to change notification settings - Fork 41
/
odata-v4-aggregation.abnf
161 lines (140 loc) · 6.32 KB
/
odata-v4-aggregation.abnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
;------------------------------------------------------------------------------
; odata-aggregation-abnf
;------------------------------------------------------------------------------
;
; OData Extension for Data Aggregation Version 4.0
; Committee Specification 01
; 26 February 2014
; Copyright (c) OASIS Open 2014. All Rights Reserved.
; Source: http://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs01/abnf/
;
; Technical Committee:
; OASIS Open Data Protocol (OData) TC
; https://www.oasis-open.org/committees/odata
;
; Chairs:
; - Barbara Hartel ([email protected]), SAP AG
; - Ram Jeyaraman ([email protected]), Microsoft
;
; Editors:
; - Ralf Handl ([email protected]), SAP AG
; - Hubert Heijkers ([email protected]), IBM
; - Gerald Krause ([email protected]), SAP AG
; - Michael Pizzo ([email protected]), Microsoft
; - Martin Zurmuehl ([email protected]), SAP AG
;
; Additional artifacts:
; This grammar is one component of a Work Product which consists of:
; - OData Extension for Data Aggregation Version 4.0
; - OData Aggregation ABNF Construction Rules Version 4.0
; - OData Aggregation ABNF Test Cases
; - OData Aggregation Vocabulary
;
; Related work:
; This specification is related to:
; - OData Version 4.0 Part 1: Protocol
; - OData Version 4.0 Part 2: URL Conventions
; - OData Version 4.0 Part 3: CSDL
; - OData ABNF Construction Rules Version 4.0
; - OData Core Vocabulary
; - OData Measures Vocabulary
; - OData JSON Format Version 4.0
; This specification replaces or supersedes:
; - None
;
; Declared XML namespaces:
; - None
;
; Abstract:
; This specification adds basic grouping and aggregation functionality (e.g.
; sum, min, and max) to the Open Data Protocol (OData) without changing any
; of the base principles of OData.
;
; Overview:
; This grammar uses the ABNF defined in RFC5234 with one extension: literals
; enclosed in single quotes (e.g. '$metadata') are treated case-sensitive.
;
; It extends the OData ABNF Construction Rules Version 4.0
;
; Contents:
; 1. New alternatives for OData ABNF Construction Rules
; 2. System Query Option $apply
; 3. Extensions to $filter
;
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; 1. New alternatives for OData ABNF Construction Rules
;------------------------------------------------------------------------------
systemQueryOption =/ apply
boolMethodCallExpr =/ isdefinedExpr
primitiveProperty =/ aggregateAlias / customAggregate
;------------------------------------------------------------------------------
; 2. System Query Option $apply
;------------------------------------------------------------------------------
apply = '$apply' EQ applyExpr
applyExpr = applyTrafo *( "/" applyTrafo )
applyTrafo = aggregateTrafo
/ bottomcountTrafo
/ bottompercentTrafo
/ bottomsumTrafo
/ concatTrafo
/ expandTrafo
/ filterTrafo
/ groupbyTrafo
/ identityTrafo
/ searchTrafo
/ topcountTrafo
/ toppercentTrafo
/ topsumTrafo
/ customFunction
aggregateTrafo = 'aggregate' OPEN BWS aggregateExpr *( BWS COMMA BWS aggregateExpr ) BWS CLOSE
aggregateExpr = customAggregate [ aggregateAs aggregateFrom ]
/ commonExpr aggregateWith aggregateAs [ aggregateFrom ]
/ pathPrefix '$count' aggregateAs
/ pathPrefix customAggregate
/ pathPrefix pathSegment OPEN aggregateExpr CLOSE
aggregateAs = RWS 'as' RWS aggregateAlias
aggregateWith = RWS 'with' RWS aggregateMethod
aggregateFrom = RWS 'from' RWS groupingProperty [ aggregateWith ] [ aggregateFrom ]
aggregateMethod = 'sum'
/ 'min'
/ 'max'
/ 'average'
/ 'countdistinct'
/ namespace "." odataIdentifier
customAggregate = odataIdentifier
aggregateAlias = odataIdentifier
groupingProperty = pathPrefix
( entityNavigationProperty [ "/" qualifiedEntityTypeName ]
/ primitiveProperty
/ complexProperty
)
pathPrefix = [ qualifiedEntityTypeName "/" ] *( pathSegment "/" )
pathSegment = ( complexProperty / complexColProperty ) [ "/" qualifiedComplexTypeName ]
/ navigationProperty [ "/" qualifiedEntityTypeName ]
bottomcountTrafo = 'bottomcount' OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
bottompercentTrafo = 'bottompercent' OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
bottomsumTrafo = 'bottomsum' OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
concatTrafo = 'concat' OPEN BWS applyExpr 1*( BWS COMMA BWS applyExpr ) BWS CLOSE
expandTrafo = 'expand' OPEN BWS expandPath [ BWS COMMA BWS filterTrafo ] *( BWS COMMA BWS expandTrafo ) BWS CLOSE
filterTrafo = 'filter' OPEN BWS boolCommonExpr BWS CLOSE
searchTrafo = 'search' OPEN BWS searchExpr BWS CLOSE
groupbyTrafo = 'groupby' OPEN BWS groupbyList *( BWS COMMA BWS applyExpr) BWS CLOSE
groupbyList = OPEN BWS groupbyElement *( BWS COMMA BWS groupbyElement ) BWS CLOSE
groupbyElement = groupingProperty / rollupSpec
rollupSpec = 'rollup' OPEN BWS
( '$all' / groupingProperty )
1*( BWS COMMA BWS groupingProperty )
BWS CLOSE
identityTrafo = 'identity'
topcountTrafo = 'topcount' OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
toppercentTrafo = 'toppercent' OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
topsumTrafo = 'topsum' OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE
customFunction = namespace "." entityColFunction functionExprParameters
;------------------------------------------------------------------------------
; 3. Extensions to $filter
;------------------------------------------------------------------------------
isdefinedExpr = 'isdefined' OPEN BWS ( firstMemberExpr ) BWS CLOSE
;------------------------------------------------------------------------------
; End of odata-aggregation-abnf
;------------------------------------------------------------------------------