Change relational language to use math symbols

The symbols previously used were a Canadian script, and were looking
good enough, but they might not be installed in every machine.

Besides, all this is to workaround a Qt5 bug that prevents from
rendering those symbols at times.
master
Salvo 'LtWorf' Tomaselli 2015-05-31 19:01:03 +07:00
parent 7e1c2c964c
commit 8cb08ad030
19 changed files with 30 additions and 33 deletions

@ -1,8 +1,12 @@
1.3 2.0
- Fix bug in relational-cli that made it crash when an exception was raised - Fix bug in relational-cli that made it crash when an exception was raised
- Point to new website - Point to new website
- Drop support for PySide - Drop support for PySide
- Switch to Python3 and drop support for Python2 - Switch to Python3 and drop support for Python2
- Switch to Qt5
- Radical change of language. The UNICODE symbols used previously were meant for a
Canadian Aborigenal script. Now switched them to use UNICODE math symbols.
- Since the language is changing, take the chance to use better symbols for JOIN
1.2 1.2
- Better tokenizer, gives more indicative errors - Better tokenizer, gives more indicative errors

@ -50,13 +50,13 @@ BINARY = 2
PRODUCT = u'*' PRODUCT = u'*'
DIFFERENCE = u'-' DIFFERENCE = u'-'
UNION = u'' UNION = u''
INTERSECTION = u'' INTERSECTION = u''
DIVISION = u'÷' DIVISION = u'÷'
JOIN = u'ᐅᐊ' JOIN = u''
JOIN_LEFT = u'ᐅLEFTᐊ' JOIN_LEFT = u''
JOIN_RIGHT = u'ᐅRIGHTᐊ' JOIN_RIGHT = u''
JOIN_FULL = u'ᐅFULLᐊ' JOIN_FULL = u''
PROJECTION = u'π' PROJECTION = u'π'
SELECTION = u'σ' SELECTION = u'σ'
RENAME = u'ρ' RENAME = u'ρ'
@ -330,7 +330,7 @@ def tokenize(expression):
# Removes the entire parentesis and content from the expression # Removes the entire parentesis and content from the expression
expression = expression[end + 1:].strip() expression = expression[end + 1:].strip()
elif expression.startswith((u"σ", u"π", u"ρ")): # Unary 2 bytes elif expression.startswith((SELECTION, RENAME, PROJECTION)): # Unary 2 bytes
items.append(expression[0:1]) items.append(expression[0:1])
# Adding operator in the top of the list # Adding operator in the top of the list
expression = expression[ expression = expression[
@ -346,17 +346,10 @@ def tokenize(expression):
# Inserting parameter of the operator # Inserting parameter of the operator
expression = expression[ expression = expression[
par:].strip() # Removing parameter from the expression par:].strip() # Removing parameter from the expression
elif expression.startswith((u"÷", u"", u"", u"*", u"-")): elif expression.startswith((DIVISION, INTERSECTION, UNION, PRODUCT, DIFFERENCE, JOIN, JOIN_LEFT, JOIN_RIGHT, JOIN_FULL)):
items.append(expression[0]) items.append(expression[0])
expression = expression[1:].strip() # 1 char from the expression expression = expression[1:].strip() # 1 char from the expression
state = 4 state = 4
elif expression.startswith(u""): # Binary long
i = expression.find(u"")
if i == -1:
raise TokenizerException(u"Expected ᐊ in %s" % (expression,))
items.append(expression[:i + 1])
expression = expression[i + 1:].strip()
state = 4
elif re.match(r'[_0-9A-Za-z]', expression[0]) == None: # At this point we only have relation names, so we raise errors for anything else elif re.match(r'[_0-9A-Za-z]', expression[0]) == None: # At this point we only have relation names, so we raise errors for anything else
raise TokenizerException( raise TokenizerException(
"Unexpected '%c' in '%s'" % (expression[0], expression)) "Unexpected '%c' in '%s'" % (expression[0], expression))

@ -1 +1 @@
σ skill=='C'(people ᐅᐊ skills) σ skill=='C'(people skills)

@ -1 +1 @@
σ (len(name)==4)(peopleᐅᐊ skills) σ (len(name)==4)(people ⋈ skills)

@ -1 +1 @@
σ name=='eve' (people) people σ name=='eve' (people) people

@ -1 +1 @@
people σ name=='eve' (people) people σ name=='eve' (people)

@ -1 +1 @@
(σ age<25(people) σ age>30(people)) ᐅᐊ ratings-πid,name,chief,age,rating(σ rating<r((ρid➡i,rating➡r(π id,rating((σ age<25(people) σ age>30(people)) ᐅᐊ ratings))) * (σ age<25(people) σ age>30(people)) ᐅᐊ ratings)) (σ age<25(people) σ age>30(people)) ⋈ ratings-πid,name,chief,age,rating(σ rating<r((ρid➡i,rating➡r(π id,rating((σ age<25(people) σ age>30(people)) ⋈ ratings))) * (σ age<25(people) σ age>30(people)) ⋈ ratings))

@ -1 +1 @@
σ skill=='C' and age<25 and skill!=name(people ᐅᐊ skills) σ skill=='C' and age<25 and skill!=name(people skills)

@ -1 +1 @@
πname,phone(((πname,id(people)- π name,id(πid(σ i!=id and room==r(ρ id➡i,room➡r(person_room)*person_room)) ᐅᐊ people)) ᐅᐊ person_room) ᐅᐊ rooms) πname,phone(((πname,id(people)- π name,id(πid(σ i!=id and room==r(ρ id➡i,room➡r(person_room)*person_room)) ⋈ people)) ⋈ person_room) ⋈ rooms)

@ -1 +1 @@
σ age<30 and skill=='PHP' (people ᐅᐊ skills) σ age<30 and skill=='PHP' (people skills)

@ -1 +1 @@
σ (id==2) (σ age>5 (people people)) σ (id==2) (σ age>5 (people people))

@ -1 +1 @@
σ skill=='C' and chief==0 ((σ age<30 (people) σ age>40(people)) ᐅᐊ skills) σ skill=='C' and chief==0 ((σ age<30 (people) σ age>40(people)) ⋈ skills)

@ -1 +1 @@
πname,age,skill((ratings-πid,rating(σ r>rating (ρrating➡r(πrating(ratings )) * ratings)) ᐅᐊ people) ᐅᐊ skills) πname,age,skill((ratings-πid,rating(σ r>rating (ρrating➡r(πrating(ratings )) * ratings)) ⋈ people) ⋈ skills)

@ -1 +1 @@
σ age<30 (σ (id%2==0) (people) σ age>22(people)) σ age<30 (σ (id%2==0) (people) σ age>22(people))

@ -1 +1 @@
people σ name=='eve' (people) people σ name=='eve' (people)

@ -1 +1 @@
σ name=='eve' (people) people σ name=='eve' (people) people

@ -1 +1 @@
people people ᑎ people people people ∩ people

@ -1 +1 @@
σ skill=='C'(skills) σ id%2==0 (skills) σ skill=='C'(skills) σ id%2==0 (skills)

@ -1 +1 @@
σ age<21 (people) σage >30(people) σ age<21 (people) σage >30(people)