-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp_chap-ebnf.Rmd
149 lines (131 loc) · 6.81 KB
/
app_chap-ebnf.Rmd
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
# EQL EBNF [^1-app-chap:EQL-EBNF] {#app-chap:EQL-EBNF}
[^1-app-chap:EQL-EBNF]: The EBNF presented here is an updated version of the EBNF of the `EQL` vignette.
This chapter presents the EBNF [@garshol:2003a] that describes version 2 of the EQL. As the original EBNF adapted from @john:2012a was written in German, some of the abbreviation terms were translated into English abbreviations (e.g., DOMA is the abbreviation for the German term **Dom**inanz**a**bfrage and the newly translated DOMQ is the abbreviation for the English term **dom**ination **q**uery).
## Terminal symbols of EQL2 (operators) and their meaning
The terminal symbols described below are listed in descending order by their binding priority.
```{r echo=FALSE, message=FALSE}
library(dplyr)
library(knitr)
dt = data.frame(Symbol = c("#",
",",
"==",
"=",
"!=",
"=~",
"!~",
">",
">=",
"<",
">=",
"|",
"&",
"^",
"->"),
Meaning = c("Result modifier (projection)",
"Parameter list separator",
"Equality (new in version 2 of the EQL; added for cleaner syntax)",
"Equality (optional; for backwards compatibility)",
"Inequality",
"Regular expression matching",
"Regular expression non-matching",
"Greater than",
"Equal to or greater than",
"Less than",
"Equal to or less than",
"Alternatives separator",
"Conjunction of equal rank",
"Dominance conjunction",
"Sequence operator"))
dt %>%
kable("html")
```
## Terminal symbols of EQL2 (brackets) and their meanings.
```{r echo=FALSE}
library(dplyr)
library(knitr)
dt = data.frame(Symbol = c("'",
"(",
")",
"[",
"]"),
Meaning = c("Quotes literal string",
"Function parameter list opening bracket",
"Function parameter list closing bracket",
"Sequence or dominance-enclosing opening bracket",
"Sequence or dominance-enclosing closing bracket"))
dt %>%
kable("html")
```
## Terminal symbols of EQL2 (functions) and their meanings.
```{r echo=FALSE}
library(dplyr)
library(knitr)
dt = data.frame(Symbol = c("Start",
"Medial",
"End",
"Num"),
Meaning = c("Start",
"Medial",
"Final",
"Count"))
dt %>%
kable("html")
```
## Formal description of EMU Query Language Version 2
```{r echo=FALSE}
library(dplyr)
library(knitr)
dt = data.frame(EBNF_term = c('EQL = CONJQ | SEQQ | DOMQ;',
'DOMQ = "[", ( CONJQ | DOMQ | SEQQ ), "^", ( CONJQ | DOMQ | SEQQ ), "]";',
'SEQQ = "[", ( CONJQ | SEQQ | DOMQ ), "->", ( CONJQ | SEQQ | DOMQ ), "]";',
'CONJQ = { "[" }, SQ, { "&", SQ }, { "]" };',
'SQ = LABELQ | FUNCQ;',
'LABELQ = [ "#" ], LEVEL, ( "=" | "==" | "!=" | "=~" | "!~" ), LABELALTERNATIVES;',
'FUNCQ = POSQ | NUMQ;',
'POSQ = POSFCT, "(", LEVEL, ",", LEVEL, ")", "=", "0" | "1";',
'NUMQ = "Num", "(", LEVEL, ",", LEVEL, ")", COP, INTPN;',
'LABELALTERNATIVES = LABEL , { "|", LABEL };',
'LABEL = LABELING | ( "\'", LABELING, "\'" );',
'POSFCT = "Start" | "Medial" | "End";',
'COP = "=" | "==" | "!=" | ">" | "<" | "<=" | ">=";',
'INTPN = "0" | INTP;',
'INTP = DIGIT-"0", { DIGIT };',
'DIGIT = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";'),
Abbreviation = c("**E**MU **Q**uery **L**anguage",
"**dom**inance **q**uery",
"**seq**uential **q**uery",
"**conj**unction **q**uery",
"**s**imple **q**uery",
"**label** **q**uery",
"**fun**ction **q**uery",
"**position** **q**uery",
"**number** **q**uery",
"**label alternatives**",
"**label**",
"**pos**ition **f**un**ct**ion",
"**c**omparison **o**perator",
"**int**eger **p**ositive with **n**ull",
"**int**eger **p**ositive",
"**digit**"),
Conditions = c("",
"levels must be hierarchically associated",
"levels must be linearly associated",
"levels must be linearly associated",
"",
"",
"",
"levels must be hierarchically associated; second level determines semantics",
"levels must be hierarchically associated; first level determines semantics",
"",
"levels must be part of the database structure; LABELING is an arbitrary character string or a label group class configured in the emuDB; result modifier # may only occur once",
"",
"",
"",
"",
""))
dt %>%
kable("html")
```
**INFO:** The LABELING term used in the LABEL EBNF term can represent any character string that is present in the annotation. As this can be any combination of Unicode characters, we chose not to explicitly list them as part of the EBNF.
## Restrictions {#restrictions}
A query may only contain a single result modifier # (hashtag).