Support of Relational Algebra Knowledge ... - Hornad - TUKE
Support of Relational Algebra Knowledge ... - Hornad - TUKE
Support of Relational Algebra Knowledge ... - Hornad - TUKE
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Lex[[MAX]]<br />
Lex[[MIN]]<br />
Lex[[COUNT]]<br />
Lex[[ V ]]<br />
Lex[[ . ]]<br />
Lex[[ , ]]<br />
Lex[[ ( ]]<br />
Lex[[ ) ]]<br />
Lex[[ + ]]<br />
Lex[[ - ]]<br />
Lex[[ * ]]<br />
Lex[[ / ]]<br />
Lex[[ < ]]<br />
Lex[[ < ]]<br />
Lex[[ > ]]<br />
Lex[[ > ]]<br />
Lex[[ = ]]<br />
Lex[[ != ]]<br />
Lexical Unit<br />
MAX<br />
MIN<br />
COUNT<br />
RESULT<br />
DOT<br />
POINT<br />
LOZAT<br />
POZAT<br />
PLUS<br />
MINUS<br />
MULL<br />
DIV<br />
LT<br />
LE<br />
GT<br />
GE<br />
EQ<br />
NE<br />
Lex[[ MVi ]]<br />
i → ( '0' | .. | '9' )<br />
Lex[[ j 1 … j n ]]<br />
j k → ( 'a' | .. | 'z' ) { ( 'a' | .. | 'z' ) }<br />
Lex[[ c 1 … c n ]]<br />
c k → ( '0' | .. | '9' ) { ( '0' | .. | '9' ) }<br />
[( '.' | ',' ) ( '0' | .. | '9' ) {( '0' | .. | '9' )}]<br />
Lex[[ ai 1 … i n a ]]<br />
i k → znak , a → ” ' “<br />
A set <strong>of</strong> rules:<br />
Terminal<br />
Symbol<br />
PART<br />
ID<br />
NM<br />
KONST<br />
Relation → LOZAT ( ID | PART ) POZAT<br />
Function → SUM | AVER | MAX | MIN | COUNT<br />
Conditions → Condition {(AND | OR) Condition}<br />
Condition → [NOT] (ID (EQ|NE|GT|GE|LT|LE)<br />
Query | LOZAT Conditions POZAT)<br />
Query<br />
→ ID | NM | ST | LOZAT Query POZAT<br />
| Query Operaction Query<br />
Operation → PLUS | MINUS | MUL | DIV<br />
It is a context-free grammar. The form <strong>of</strong> each grammar<br />
rule is<br />
A → α , where A ∈ Ν a α ∈ ( N U T). <br />
<br />
On the left side <strong>of</strong> any rule it is no terminal symbol<br />
The grammar is LL(1) grammar, because it satisfies<br />
FIRST-FIRST a FIRST-FOLLOW conditions, i.e. for<br />
A type rules are defined:<br />
A → α1|α2 | ... | αn<br />
FIRST-FIRST<br />
If α i ⇒ * w, w ∈ T + , α j ⇒ * u, u ∈ T + ,<br />
then FIRST 1 (α i ) ∩ FIRST 1 (α j ) = ∅ pre 1 ≤ i, j ≤ n, i ≠<br />
j.<br />
<br />
FIRST-FOLOW<br />
If α i ⇒ * e ,t.j. e∈FIRST 1 (α i ) for i,<br />
then FIRST 1 (α j )∩FOLLOW 1 (A )=∅ pre 1 ≤ j ≤ n, i ≠ j<br />
Program → { PART Command } RESULT Command<br />
Command → EQ (Select | Project | JoinAF | Agreg)<br />
Select → SEL Conditions Relation<br />
Project → PROJ ID { POINT ID } Relation<br />
JoinAF → ID ( Join | AF )<br />
Join → JOIN Condition { AND Condition }<br />
( ID | PART )<br />
Agreg → {POINT ID} FUN Function (ID|MUL)<br />
{POINT Function (ID|MUL)} Relation<br />
IV. IMPLEMENTATION<br />
On Figure 1 the scenario <strong>of</strong> the relational algebra<br />
performance is displayed. SQL_RA_Module controls the<br />
whole process <strong>of</strong> RA_queries and select statements<br />
treating. Compiler checks RA_query syntax and if any<br />
errors occur in parsing SQL_RA_module finishes its<br />
evaluation. RA_query is classified as incorrect.<br />
Otherwise, a module returns select1_statement which<br />
corresponds with student relational algebra query ([5]).<br />
The select1_statement is executed on database server<br />
([6][10]). The result relations <strong>of</strong> select1 and select2<br />
statements are compared. If they are equal a student<br />
RA_query is correct else it is incorrect. The module<br />
displayed error message if an error occurs in any step <strong>of</strong><br />
performance.