diff --git a/CHANGELOG b/CHANGELOG index d8bae9a..1688a1b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,23 +1,25 @@ 1.0 +- Adds history in the GUI +- Adds menus to the GUI +- Checks if given name to relations are valid +- Discards the old and not so functional tlb format +- Float type recognition is more robust, now handled using a regexp +- Date type recognition is more robust, now using a combination of regexp plus date object +- Integer type recognition now allows negative numbers in relations +- Rename operations are now much faster, content won't be copied unless subsequent updates, insert, updates or deletes will occur +- Added testsuite +- Module parallel does something, can execute queries in parallel +- Implemented select_union_intersect_subtract general optimization - Removed encoding from .desktop file (was deprecated) - Added manpage for relational-cli - Internally uses set instead of lists to describe relation's content - Tuples are internally mapped on tuples and no longer on lists -- Discards the old and not so functional tlb format -- Rename will mark the resulting relation as readonly and subsequent updates, insert, updates or deletes will actually copy the content -- Added testsuite +- Set hash method for the classes +- Parsing of strings representing dates is now cached, eliminating the need for double parse - Fixed python expression tokenization, now uses native tokenizer - Fixed optimization involving selection and parenthesis in the expression (Rev 260) - Fixed futile_union_intersection_subtraction optimization that didn't work when selection operator was in the left subtree (Rev 261) -- Module parallel does something, can execute queries in parallel -- Set hash method for the classes -- Implemented select_union_intersect_subtract general optimization -- Float type recognition is more robust, now handled using a regexp -- Date type recognition is more robust, now using a combination of regexp plus date object -- Parsing of strings representing dates is now cached, eliminating the need for double parse -- Restyle of the GUI -- Adds history in the GUI -- Checks if given name to relations are valid +- Restyle of the GUI, splitters added 0.11 - Font is set only on windows (Rev 206) diff --git a/relational/parser.py b/relational/parser.py index 1da85ed..6026043 100644 --- a/relational/parser.py +++ b/relational/parser.py @@ -143,8 +143,8 @@ class node (object): def result_format(self,rels): '''This function returns a list containing the fields that the resulting relation will have. - Since it needs to know real instances of relations, it requires a dictionary where keys are - the names of the relations and the values are the relation objects.''' + It requires a dictionary where keys are the names of the relations and the values are + the relation objects.''' if rels==None: return @@ -205,15 +205,15 @@ class node (object): return (le+ self.name +re) -def find_matching_parenthesis(expression,start=0): +def _find_matching_parenthesis(expression,start=0,openpar=u'(',closepar=u')'): '''This function returns the position of the matching close parenthesis to the 1st open parenthesis found starting from start (0 by default)''' par_count=0 #Count of parenthesis for i in range(start,len(expression)): - if expression[i]=='(': + if expression[i]==openpar: par_count+=1 - elif expression[i]==')': + elif expression[i]==closepar: par_count-=1 if par_count==0: return i #Closing parenthesis of the parameter @@ -248,7 +248,7 @@ def tokenize(expression): while len(expression)>0: if expression.startswith('('): #Parenthesis state state=2 - end=find_matching_parenthesis(expression) + end=_find_matching_parenthesis(expression) #Appends the tokenization of the content of the parenthesis items.append(tokenize(expression[1:end])) #Removes the entire parentesis and content from the expression @@ -259,7 +259,7 @@ def tokenize(expression): expression=expression[2:].strip() #Removing operator from the expression if expression.startswith('('): #Expression with parenthesis, so adding what's between open and close without tokenization - par=expression.find('(',find_matching_parenthesis(expression)) + par=expression.find('(',_find_matching_parenthesis(expression)) else: #Expression without parenthesis, so adding what's between start and parenthesis as whole par=expression.find('(') @@ -322,7 +322,7 @@ def parse(expr): You can use parenthesis to change priority: a ᐅᐊ (q ᑌ d). - IMPORTANT: The encoding used by this module is UTF-8 + IMPORTANT: The encoding used by this module is UTF-8 (all strings must be UTF-8) EXAMPLES σage > 25 and rank == weight(A) diff --git a/relational_gui/guihandler.py b/relational_gui/guihandler.py index ddfcb60..17fc683 100644 --- a/relational_gui/guihandler.py +++ b/relational_gui/guihandler.py @@ -36,7 +36,7 @@ class relForm(QtGui.QMainWindow): self.undo=None #UndoQueue for queries self.selectedRelation=None self.ui=ui - self.qcounter=1 + self.qcounter=1 #Query counter def load_query(self,*index): self.ui.txtQuery.setText(self.savedQ.itemData(index[0]).toString()) @@ -168,7 +168,7 @@ class relForm(QtGui.QMainWindow): It shouldn't be called giving filename but not giving name.''' #Asking for file to load if filename==None: - filename = QtGui.QFileDialog.getOpenFileName(self,QtGui.QApplication.translate("Form", "Load Relation"),"",QtGui.QApplication.translate("Form", "Relations (*.csv);;Old Relations (*.tlb);;Text Files (*.txt);;All Files (*)")) + filename = QtGui.QFileDialog.getOpenFileName(self,QtGui.QApplication.translate("Form", "Load Relation"),"",QtGui.QApplication.translate("Form", "Relations (*.csv);;Text Files (*.txt);;All Files (*)")) filename=str(filename.toUtf8()) #Default relation's name diff --git a/test/skill_of_best_person.query b/test/skill_of_best_person.query new file mode 100644 index 0000000..8eeb69e --- /dev/null +++ b/test/skill_of_best_person.query @@ -0,0 +1 @@ +πname,age,skill((ratings-πid,rating(σ r>rating (ρrating➡r(πrating(ratings )) * ratings)) ᐅᐊ people) ᐅᐊ skills) diff --git a/test/skill_of_best_person.result b/test/skill_of_best_person.result new file mode 100644 index 0000000..5d07f7d --- /dev/null +++ b/test/skill_of_best_person.result @@ -0,0 +1,4 @@ +name,age,skill +eve,25,Perl +eve,25,C +eve,25,C++