simplified outer join

git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@54 014f5005-505e-4b48-8d0a-63407b615a7c
master
LtWorf 2008-11-09 12:15:04 +07:00
parent ec8218cfc0
commit 19e801092e
3 changed files with 14 additions and 12 deletions

@ -41,4 +41,5 @@
- When adding a relation, the file must be chosen 1st, and then the default relation's name is the same as the filename - When adding a relation, the file must be chosen 1st, and then the default relation's name is the same as the filename
- Changed internal rename method. Now uses a dictionary - Changed internal rename method. Now uses a dictionary
- Optimized saving of relations - Optimized saving of relations
- Can save relations from gui - Can save relations from gui
- Outer join methods simplified

@ -106,17 +106,20 @@ class Ui_Dialog(object):
self.tabWidget.setCurrentIndex(0) self.tabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),Dialog.accept) QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),Dialog.accept)
QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),Dialog.reject) QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),Dialog.reject)
#QtCore.QObject.connect(self.label_4,QtCore.SIGNAL("linkActivated()"),self.openSite)
QtCore.QMetaObject.connectSlotsByName(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def openSite(self):
print "ciao"
def retranslateUi(self, Dialog): def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Documentation", None, QtGui.QApplication.UnicodeUTF8)) Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Documentation", None, QtGui.QApplication.UnicodeUTF8))
self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Relational", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox.setTitle(QtGui.QApplication.translate("Dialog", "Relational", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("Dialog", "Relational", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText(QtGui.QApplication.translate("Dialog", "Relational", None, QtGui.QApplication.UnicodeUTF8))
self.label_3.setText(QtGui.QApplication.translate("Dialog", "Version "+relational.version, None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText(QtGui.QApplication.translate("Dialog", "Version "+relational.version, None, QtGui.QApplication.UnicodeUTF8))
self.groupBox_3.setTitle(QtGui.QApplication.translate("Dialog", "Author", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_3.setTitle(QtGui.QApplication.translate("Dialog", "Author", None, QtGui.QApplication.UnicodeUTF8))
self.label_2.setText(QtGui.QApplication.translate("Dialog", "Salvo \"LtWorf\" Tomaselli", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(QtGui.QApplication.translate("Dialog", "Salvo \"LtWorf\" Tomaselli <tiposchi@tiscali.it>", None, QtGui.QApplication.UnicodeUTF8))
self.groupBox_2.setTitle(QtGui.QApplication.translate("Dialog", "Links", None, QtGui.QApplication.UnicodeUTF8)) self.groupBox_2.setTitle(QtGui.QApplication.translate("Dialog", "Links", None, QtGui.QApplication.UnicodeUTF8))
self.label_4.setText(QtGui.QApplication.translate("Dialog", "http://galileo.dmi.unict.it/wiki/relational/", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setText(QtGui.QApplication.translate("Dialog", "http://galileo.dmi.unict.it/wiki/relational/", None, QtGui.QApplication.UnicodeUTF8))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("Dialog", "About", None, QtGui.QApplication.UnicodeUTF8)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("Dialog", "About", None, QtGui.QApplication.UnicodeUTF8))
self.textEdit.setHtml(QtGui.QApplication.translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" self.textEdit.setHtml(QtGui.QApplication.translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><title>GNU General Public License - GNU Project - Free Software Foundation (FSF)</title><style type=\"text/css\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><title>GNU General Public License - GNU Project - Free Software Foundation (FSF)</title><style type=\"text/css\">\n"

@ -230,21 +230,19 @@ class relation (object):
return a.union(b) return a.union(b)
def outer_right(self,other): def outer_right(self,other):
'''Same as left join, with swapped parameters''' '''Outer right join. Considers self as left and param as right. If the
return self.outer_left(other,True) tuple has no corrispondence, empy attributes are filled with a "---"
string. This is due to the fact that empty string or a space would cause
problems when saving the relation.
Just like natural join, it works considering shared attributes.'''
return other.outer_left(self)
def outer_left(self,other,swap=False): def outer_left(self,other,swap=False):
'''Outer left join. Considers self as left and param as right. If the '''Outer left join. Considers self as left and param as right. If the
tuple has no corrispondence, empty attributes are filled with a "---" tuple has no corrispondence, empty attributes are filled with a "---"
string. This is due to the fact that empty string or a space would cause string. This is due to the fact that empty string or a space would cause
problems when saving the relation. problems when saving the relation.
Just like natural join, it works considering shared attributes. Just like natural join, it works considering shared attributes.'''
If swap is True, it will behave as a right join'''
if swap:
tmp=other
other=self
self=tmp
shared=[] shared=[]
for i in self.header.attributes: for i in self.header.attributes: