-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.ol
160 lines (124 loc) · 3.54 KB
/
main.ol
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
type Path : string( regex( "([A-Za-z_][A-Za-z_0-9]*\\.)*([A-Za-z_][A-Za-z_0-9]*)" ) )
// MATCH
type Match : void {
data* : undefined
query : Match_Exp
}
type Match_Exp : bool | EQ_Exp | EXISTS_Exp | OR_Exp | AND_Exp | NOT_Exp
type EQ_Exp : void { equal: EQ_Data | EQ_Path }
type EQ_Data : void {
path : Path
data* : undefined
}
type EQ_Path : void {
left : Path
right : Path
}
type EXISTS_Exp : void {
exists : Path
}
type OR_Exp : void {
or : Binary_Exp
}
type AND_Exp : void {
and : Binary_Exp
}
type NOT_Exp : void {
not : Match_Exp
}
type Binary_Exp : void {
left : Match_Exp
right : Match_Exp
}
// UNWIND
type Unwind : void {
data* : undefined
query : Path
}
// PROJECT
type Project : void {
data* : undefined
query[1,*] : Project_Exp
}
type Project_Exp : Path | ValuesToPath_Exp
type ValuesToPath_Exp : void {
dstPath : Path
value[1,*] : Value
}
type Value : any | ValuePath | ValueMatch | ValueTernary
type ValuePath : void {
path : Path
}
type ValueMatch : void {
match : Match_Exp
}
type ValueTernary : void {
condition : Match_Exp
ifTrue[1,*] : Value
ifFalse[1,*] : Value
}
// GROUP
type Group : void {
data* : undefined
query : Group_Exp
}
type Group_Exp : void {
aggregate* : Aggregate
groupBy* : GroupBy
}
type GroupBy : void {
dstPath : Path
srcPath : Path
}
type Aggregate : void {
dstPath : Path
srcPath : Path
distinct? : bool //<< default is false
}
// LOOKUP
type Lookup : void {
leftData* : undefined
leftPath : Path
rightData* : undefined
rightPath : Path
dstPath : Path
}
// PIPELINE
type Pipeline : void {
data* : undefined
pipeline[1,*] :
void { matchQuery : Match_Exp }
| void { projectQuery[1,*] : Project_Exp }
| void { unwindQuery : Path }
| void { groupQuery : Group_Exp }
| void { lookupQuery : void {
leftPath : Path
rightData* : undefined
rightPath : Path
dstPath : Path
}
}
}
// QUERY RESPONSE
type QueryResponse : void {
result* : undefined
queryTime? : long
}
interface TQueryInterface {
RequestResponse :
match ( Match )( QueryResponse ) throws MalformedQuery_Expression( string ),
unwind ( Unwind )( QueryResponse ) throws MalformedQuery_Expression( string ),
project ( Project )( QueryResponse ) throws MalformedQuery_Expression( string ) MergeValueException( string ),
group ( Group )( QueryResponse ) throws MalformedQuery_Expression( string ),
lookup ( Lookup )( QueryResponse ) throws MalformedQuery_Expression( string ),
pipeline ( Pipeline )( QueryResponse ) throws MalformedQuery_Expression( string )
}
service TQuery {
inputPort IP {
location: "local"
interfaces: TQueryInterface
}
foreign java {
class: "joliex.tquery.engine.TQueryService"
}
}