This commit is contained in:
Salvo 'LtWorf' Tomaselli
2014-01-01 11:15:25 +01:00
parent e0b9525677
commit dabd746a5e
20 changed files with 969 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
.. link:
.. description:
.. tags:
.. date: 2014/01/01 10:44:33
.. title: Download
.. slug: download
Check the downloads here: https://code.google.com/p/relational/downloads/
And remember that relational is already packaged for Debian, Ubuntu, Gentoo.
Install on Debian/Ubuntu
========================
Relational is in the stable, testing and unstable repositories, so there is no need for particular efforts.
```
# aptitude install relational
```
A menu entry will be created.
If you don't want the QT deps, you can install relational-cli package, that runs inside the terminal.
Install on Gentoo
=================
```
emerge -av dev-python/PyQt4; emerge -av media-fonts/dejavu
```
If you want the embedded documentation (not mandatory):
```
emerge -av x11-libs/qt-webkit
```
Install on Windows
==================
Download the .exe setup and install it.
On older versions of windows you might need to separately download and install the Microsoft Visual C++ 2008 Redistributable Package.
Install on OsX
==============
Relational needs PyQt4 and Python2.7 to work, so make sure to have them on your system.
Download the source package, and then run
```
./relational_gui.py
```

View File

@@ -0,0 +1,63 @@
.. link:
.. description:
.. tags:
.. date: 2014/01/01 10:54:05
.. title: Tutorial
.. slug: tutorial
Introduction
============
Relational is an educational software. The purpose is to show if the query is correct or not. It doesn't replace and will never be able to replace the knowledge of relational algebra. It is just a tool to check the queries, which can make life easier.
Do not expect it to replace your brain please.
Create your own relation
========================
Before starting, we will create an example relation, that we will use in this tutorial.
Relations are stored into text files. One relation into one file.
By default relations will have .csv extension.
If you aren't interested in creating a new relation because you want to use the examples shipped with the installation, you can skip this.
Click on the "New relation" button.
Now, on the 1st row add the names of the columns you want for your relation, you can add more columns clicking on "Add column".
Now populate the table with the values.
When you are done click "Ok", you will be prompted to insert the name for the new relation. Just use letters, if the name you insert is not valid, the relation will be deleted and an error will be shown.
Load a relation
===============
To load a relation from disk, press the Load relation button.
A file chooser dialog will be shown and you will need to select the file you want to open.
Once you've selected the file, you will be required to give a name to the relation. This name will be used in the queries. Relational will automatically suggest to name the relation like the file, but the name can be changed.
Repeat the operation until you've opened all the relations you're interested in.
Show a relation
===============
Once a relation is opened, you will be able to display it in the center table.
To show a relation, double click on it, in the list within the Relations frame.
You might be interested to show the fields of a relation, without showing it (because you want another relation in the center). To show the fields, single click on a relation in the Relations frame, and the fields will be listed in the Attributes frame.
1st query
=========
The query must be inserted into the large text box at the bottom of the window.
Try writing the name of one of the loaded relations and press Enter. This simple query will result a relation identical to the one requested.
Other queries
=============
By default the resulting query will be named _last1, but it is possible to override that writing a name for the resulting query in the small textbox in the left-bottom part of the window.
Since most of the symbols aren't present on keyboards, they are provided as buttons on the left part of the screen. Pressing one of those buttons will insert the corresponding symbol at the cursor's position in the query's textbox.
Save a relation
===============
A new relation created by a query or by editing a relation inserting and removing tuples can be saved pressing on the Save relation button. It will save the currently selected relation.
A dialog will ask where to save the file.

50
website/stories/types.rst Normal file
View File

@@ -0,0 +1,50 @@
.. link:
.. description:
.. tags:
.. date: 2014/01/01 11:04:04
.. title: Types
.. slug: types
When performing selection, implicit casting will be performed, to allow the use of operators other than == and !=.
Rules
=====
* If the string matches this regexp: ^[\+\-]{0,1}[0-9]+$ it will be casted to python's int type
* If the string matches this regexp: ^[\+\-]{0,1}[0-9]+(\.([0-9])+)?$ it will be casted to python's float type
* If the string matches this regexp: ^([0-9]{1,4})(\\|-|/)([0-9]{1,2})(\\|-|/)([0-9]{1,2})$ that represents YYYY-MM-DD date, and the values correctly represent a date, it will be casted to relational's internal rdate type
* Otherwise the string will be kept as a string type.
According to the regexp, a string like '.3' will not be casted to float. I've never liked this format and hence it is forbidden in relational.
Prevent casting
===============
Consider the following relation:
id,product
113,scanner
113a,new scanner
The id field of the 1st tuple will be casted to int, but the same field of the 2nd tuple will not be casted. To avoid anomalies in queries dealing with such fields you must prevent implicit casting.
Achieving this is simple, just cast back to string, using str()
σ (str(id).endswith('3')) (products)
Type rdate
==========
Fields
* intdate is instance of datetime.date
* day
* month
* weekday
* year
Methods:
``
__hash__,__str__,__add__,__eq__,__ge__,__gt__,__le__,__lt__,__ne__,__sub__
``
Limits:
datetime.MAXYEAR and datetime.MINYEAR are limits to the range of the possible dates, also the regexp used must be considered.

View File

@@ -0,0 +1,9 @@
.. link:
.. description:
.. tags:
.. date: 2014/01/01 11:02:03
.. title: What is not supported
.. slug: what-is-not-supported
* Conversion from SQL
* Equijoin operator (maybe will never be supported, it is only a syntactic sugar)