Commit Graph

209 Commits

Author SHA1 Message Date
Salvo 'LtWorf' Tomaselli
e2ab59bcc4 Added public attribute with relation name regexp
Also simplified the function to check whether a name is valid for
a relation.
2015-07-14 10:35:54 +02:00
Salvo 'LtWorf' Tomaselli
9416a9fef9 Removed useless unicode marker from strings
We are using Python3 now, so that is not needed
2015-07-09 23:43:54 +02:00
Salvo 'LtWorf' Tomaselli
df485e4bd4 Make use of callable string
Instead of explicitly using eval, make use of the
new callable string feature
2015-07-09 23:42:52 +02:00
Salvo 'LtWorf' Tomaselli
4f85a545bf parse function returns a callable string
The python string returned by the parser are now directly callable.

They accept an optional parameter for the context.
2015-07-09 23:35:45 +02:00
Salvo 'LtWorf' Tomaselli
f5e8e442a0 Removed unused variables 2015-07-09 23:32:46 +02:00
Salvo 'LtWorf' Tomaselli
f6b4c6708b _rearrange() is an identity if not needed
Operations are possible even when the order of the attributes is
not the same. Because ordering is just an implementation detail and
not an actual part of relational algebra.

A _rearrange() function exists to convert relations to have a similar
format and be able to operate on them.

The function would perform a projection in any case, which would cause
the creation of a new temporary relation, even when the relations where
already using the same order of attributes.

This commit fixes the issue by making it return an identity if the
operation is not necessary.
2015-06-25 16:46:10 +02:00
Salvo 'LtWorf' Tomaselli
95e375f44a Use dictionary comprehension in selection
When doing a selection, a new context (in the form of a dictionary)
is created.

Instead of re-using the same dictionary re-assigning the values, now
use a comprehension to avoid redundant reads.
2015-06-25 16:34:47 +02:00
Salvo 'LtWorf' Tomaselli
bcc7053892 Removed a couple of un-pythonic lines 2015-06-17 17:13:35 +02:00
Salvo 'LtWorf' Tomaselli
59d712e53f Interface handler can suggest names
The interface handler can suggest names for loaded
relations.

This can be used to remove duplicated code.
2015-06-17 16:35:01 +02:00
Salvo 'LtWorf' Tomaselli
226b340969 Create class in maintenance module to help the UIs
The class has methods commonly used by user interfaces, so that
they don't need to be implemented multiple times by different
UIs.
2015-06-16 13:15:11 +02:00
Salvo 'LtWorf' Tomaselli
923e515535 Fix the version checker for python3 2015-06-13 17:39:42 +02:00
Salvo 'LtWorf' Tomaselli
5021f1f8cb Use the insert() method to load files
In this way, checks are performed automatically on every tuple
and code is simplified.

This should make it safer to raise exceptions on files that are
not relations.
2015-06-07 14:03:24 +02:00
Salvo 'LtWorf' Tomaselli
a033cb769a Make header inherit from tupl
Rather than having a header class that contains a list of header,
change it to directly be an immutable tuple.

This simplifies the code because header can now be compared and
indexed like any other tuple.

Code had to be changed all over the place to cope with this new
datatype.
2015-06-06 15:22:11 +02:00
Salvo 'LtWorf' Tomaselli
d754a166a1 Removed duplicated check 2015-06-06 14:17:27 +02:00
Salvo 'LtWorf' Tomaselli
b12ea8d27a Raise exception for duplicated attrs in projection
Rather than ignoring them, raise an exception
2015-06-06 14:15:47 +02:00
Salvo 'LtWorf' Tomaselli
bbc2855cc5 Use list comprehension 2015-06-06 14:12:02 +02:00
Salvo 'LtWorf' Tomaselli
229a83f3ad Missing import 2015-06-06 13:52:39 +02:00
Salvo 'LtWorf' Tomaselli
01dc9391d1 Adds len() to relation
Returns the cardinality
2015-06-05 18:28:44 +02:00
Salvo 'LtWorf' Tomaselli
d05c2e2d3c Replace intermediate lists with iterators
Some more intermediate lists created during joins are now
not created in favour of iterators instead
2015-06-05 18:15:03 +02:00
Salvo 'LtWorf' Tomaselli
f974fc316d Use intersection method of header
Rather than manually implement that with 2 for loops
2015-06-05 18:02:46 +02:00
Salvo 'LtWorf' Tomaselli
c8db7b619c Replace temp lists with iterators 2015-06-05 17:54:54 +02:00
Salvo 'LtWorf' Tomaselli
f0a9650174 Added iter function
Adds __iter__ and __contains__ to relations and headers.
2015-06-05 17:41:09 +02:00
Salvo 'LtWorf' Tomaselli
f2bde1b6bd Removed unmaintained parallel module
The module is unmaintained and in any case, does not limit the
amount of parallel jobs.
2015-06-02 14:58:20 +02:00
Salvo 'LtWorf' Tomaselli
a965cff14a Removed unused module 2015-06-01 10:32:15 +02:00
Salvo 'LtWorf' Tomaselli
de405480b5 Moved casting function in rstring
rstring now has an autocast() function that returns the automatic casting
for that value.
The casting is cached so is really performed only once, at most, during
the lifetime of the object.
2015-06-01 09:12:22 +02:00
Salvo 'LtWorf' Tomaselli
e4158a3685 Refactored rename header
Now will directly raise an exception, requiring one less if
2015-06-01 08:58:54 +02:00
Salvo 'LtWorf' Tomaselli
1f7983309b Simplified getAttributesId() 2015-06-01 08:55:11 +02:00
Salvo 'LtWorf' Tomaselli
496a5c19d1 Raise an exception when trying to insert n-uples with the wrong cardinality 2015-06-01 08:49:40 +02:00
Salvo 'LtWorf' Tomaselli
3fca4edd15 Refactory of rearrange 2015-06-01 08:48:52 +02:00
Salvo 'LtWorf' Tomaselli
766a3a6527 Simplified delete method 2015-06-01 08:45:29 +02:00
Salvo 'LtWorf' Tomaselli
be6400c270 Mark both relations as read-only after a rename
Only one relation was marked as read-only after a rename, which means
that changes to the original relation would affect the other one
as well.
2015-06-01 08:43:41 +02:00
Salvo 'LtWorf' Tomaselli
acdd4629a6 Python3 change, replace file() with open() 2015-06-01 07:32:53 +02:00
Salvo 'LtWorf' Tomaselli
4af2230ced Use rstrings anywhere
Since rstrings are faster and provide some caching features,
keep the same rstring objects from the beginning rather than
continuously casting strings.
2015-06-01 07:31:19 +02:00
Salvo 'LtWorf' Tomaselli
19cff69718 Cache type information on strings
During a selection operation, each value is matched against a regular
expression and then casting might be performed, depending on the results.

This commit caches the result of the match so that a value is not matched
multiple times in its lifetime.
2015-06-01 00:45:49 +02:00
Salvo 'LtWorf' Tomaselli
8cb08ad030 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.
2015-05-31 19:01:03 +02:00
Salvo 'LtWorf' Tomaselli
0a562ff603 Check for duplicated attributes
Fails to work if attributes are duplicated, raising an appropriate
exception.
2015-02-23 14:17:50 +01:00
Salvo 'LtWorf' Tomaselli
cf377eca46 Initial Qt5/Python3 switch
This converts the GUI code to use Qt5 and Python3

The GUI is still somewhat buggy, and it can't open files yet,
but seems to be mostly working, extensive testing will
be needed before this can be released.
2015-02-19 14:00:47 +01:00
Salvo 'LtWorf' Tomaselli
991b0d9942 Converted command line interface to Python3 2015-02-19 12:56:21 +01:00
Salvo 'LtWorf' Tomaselli
a355762fc4 Switch core module to Python3
The core module (the relational algebra, not the interface) is now
using Python3

Tests are passing, so it should be ok.
2015-02-19 12:42:41 +01:00
Salvo 'LtWorf' Tomaselli
c8d9e57a50 Get rid of the last remains of galileo 2013-12-27 00:47:48 +01:00
Salvo 'LtWorf' Tomaselli
556eecc118 Changed about and README to not point to galileo anymore 2013-12-27 00:31:43 +01:00
Salvo 'LtWorf' Tomaselli
5e4a703f56 New way of checking for new versions 2013-12-27 00:16:12 +01:00
Salvo 'LtWorf' Tomaselli
c637890795 Make the survey point to the new location on appspot 2013-12-26 23:51:00 +01:00
Salvo 'LtWorf' Tomaselli
f1eb4e0b23 doc change 2013-06-29 16:51:20 +02:00
Salvo 'LtWorf' Tomaselli
dee91df8a6 sql module was never implemented 2013-06-29 16:51:06 +02:00
Salvo 'LtWorf' Tomaselli
57979cbf8d can import with * 2013-06-29 15:41:03 +02:00
Salvo 'LtWorf' Tomaselli
78c37999cc fixed typo 2013-06-29 15:40:48 +02:00
Salvo 'LtWorf' Tomaselli
27ba11cf40 first stub of new API 2013-02-17 22:46:56 +01:00
Salvo 'LtWorf' Tomaselli
5433f14b66 Generates tokenizer exception if the value is not unicode 2013-02-10 14:24:52 +01:00
Salvo 'LtWorf' Tomaselli
2e0cbf94a7 - Can convert the expressions into python code objects as well
- Can test that the code objects work as expected too.
2013-02-10 14:11:26 +01:00