author | Sandrine Ribeau <sandrine.ribeau@logilab.fr> |
Tue, 23 Dec 2008 13:15:23 -0800 | |
changeset 286 | 451a74c5652c |
parent 274 | 893353d66f86 |
child 301 | e47150482ac1 |
permissions | -rw-r--r-- |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
1 |
.. -*- coding: utf-8 -*- |
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
2 |
|
255
5d2804b9a28c
[doc] add internal links from book abstract
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
209
diff
changeset
|
3 |
.. _RQL: |
5d2804b9a28c
[doc] add internal links from book abstract
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
209
diff
changeset
|
4 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
5 |
====================================== |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
6 |
RQL language (Relation Query Language) |
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
7 |
====================================== |
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
8 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
9 |
Introduction |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
10 |
============ |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
11 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
12 |
Goals RQL |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
13 |
--------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
14 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
15 |
The goal is to have a language emphasizing the way of browsing |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
16 |
relations. As such, attributes will be regarded as cases of |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
17 |
special relations (in terms of implementation, the user |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
18 |
language not to see virtually no difference between an attribute and a |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
19 |
relation). |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
20 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
21 |
RQL is inspired by SQL but is the highest level. A knowledge of the |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
22 |
`CubicWeb` schema defining the application is necessary. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
23 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
24 |
Comparison with existing languages |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
25 |
---------------------------------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
26 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
27 |
SQL |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
28 |
``` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
29 |
RQL builds on the features of SQL but is at a higher level |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
30 |
(the current implementation of RQL generates SQL). For that it is limited |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
31 |
to the way of browsing relations and introduces variables. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
32 |
The user does not need to know the model underlying SQL, but the `CubicWeb` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
33 |
scheam defining the application. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
34 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
35 |
Versa |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
36 |
````` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
37 |
Should I look in more detail, but here is already some ideas for |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
38 |
the moment ... Versa_ is the language most similar to what we wanted |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
39 |
to do, but the model underlying data being RDF, there is some |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
40 |
number of things such as namespaces or handling of the RDF types which |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
41 |
does not interest us. On the functionality level, Versa_ is very comprehensive |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
42 |
including through many functions of conversion and basic types manipulation, |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
43 |
which may need to be guided at one time or another. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
44 |
Finally, the syntax is a little esoteric. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
45 |
|
274
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
46 |
Sparql |
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
47 |
`````` |
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
48 |
|
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
49 |
The query language most similar to RQL is SPARQL_, defined by the W3C to serve |
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
50 |
for the semantic web. |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
51 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
52 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
53 |
The different types of queries |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
54 |
------------------------------ |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
55 |
|
274
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
56 |
Search (`Any`) |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
57 |
This type of query can extract entities and attributes of entities. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
58 |
|
274
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
59 |
Inserting entities (`INSERT`) |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
60 |
This type of query is used to insert new entities in the database. It |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
61 |
will also create direct relationships entities newly created. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
62 |
|
274
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
63 |
Update entities, relations creation (`SET`) |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
64 |
This type of query updates existing entities in the database, |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
65 |
or create relations between existing entities. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
66 |
|
274
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
67 |
Deletion of entities or relationship (`DELETE`) |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
68 |
This type of query allows for the removal of entities and relations existing |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
69 |
in the database. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
70 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
71 |
Search Query |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
72 |
------------ |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
73 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
74 |
[ `DISTINCT`] <entity type> V1 (V2) \ * |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
75 |
[ `GROUPBY` V1 (V2) \*] [ `ORDERBY` <orderterms>] |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
76 |
[ `WHERE` <restriction>] |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
77 |
[ `LIMIT` <value>] [ `OFFSET` <value>] |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
78 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
79 |
:entity type: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
80 |
Type of selected variables. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
81 |
The special type `Any` is equivalent to not specify a type. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
82 |
:restriction: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
83 |
list of relations to go through whic follow the pattern |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
84 |
`V1 relation V2 | <static value>` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
85 |
:orderterms: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
86 |
Definition of the selection order: variable or column number followed by |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
87 |
sorting method ( `ASC`, `DESC`), ASC is the default. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
88 |
:note for grouped queries: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
89 |
For grouped queries (e.g., a clause `GROUPBY`), all |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
90 |
selected variables must be aggregated or grouped. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
91 |
|
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
92 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
93 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
94 |
- *Search for the object of identifier 53* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
95 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
96 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
97 |
Any WHERE X |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
98 |
X eid 53 |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
99 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
100 |
- *Search material such as comics, owned by syt and available* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
101 |
:: |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
102 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
103 |
WHERE X Document |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
104 |
X occurence_of F, F class C, C name 'Comics' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
105 |
X owned_by U, U login 'syt' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
106 |
X available true |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
107 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
108 |
- *Looking for people working for eurocopter interested in training* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
109 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
110 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
111 |
Person P WHERE |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
112 |
P work_for P, S name 'Eurocopter' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
113 |
P interested_by T, T name 'training' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
114 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
115 |
- *Search note less than 10 days old written by jphc or ocy* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
116 |
:: |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
117 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
118 |
Note N WHERE |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
119 |
N written_on D, D day> (today -10), |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
120 |
N written_by P, P name 'jphc' or P name 'ocy' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
121 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
122 |
- *Looking for people interested in training or living in Paris* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
123 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
124 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
125 |
Person P WHERE |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
126 |
(P interested_by T, T name 'training') or |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
127 |
(P city 'Paris') |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
128 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
129 |
- *The name and surname of all people* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
130 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
131 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
132 |
Any N, P WHERE |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
133 |
X is Person, X name N, X first_name P |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
134 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
135 |
Note that the selection of several entities generally force |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
136 |
the use of "Any" because the type specification applies otherwise |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
137 |
to all the selected variables. We could write here |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
138 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
139 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
140 |
String N, P WHERE |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
141 |
X is Person, X name N, X first_name P |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
142 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
143 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
144 |
Insertion query |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
145 |
--------------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
146 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
147 |
`INSERT` <entity type> V1 (, <entity type> V2) \ * `:` <assignments> |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
148 |
[ `WHERE` <restriction>] |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
149 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
150 |
: assignments: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
151 |
list of relations to assign in the form `V1 relationship V2 | <static value>` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
152 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
153 |
The restriction can define variables used in assignments. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
154 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
155 |
Caution, if a restriction is specified, the insertion is done for |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
156 |
*each line results returned by the restriction*. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
157 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
158 |
- *Insert a new person named 'foo'* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
159 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
160 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
161 |
INSERT Person X: X name 'widget' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
162 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
163 |
- *Insert a new person named 'foo', another called 'nice' and a 'friend' relation |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
164 |
between them* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
165 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
166 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
167 |
INSERT Person X, Person Y: X name 'foo', Y name 'nice', X friend Y |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
168 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
169 |
- *Insert a new person named 'foo' and a 'friend' relation with an existing |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
170 |
person called 'nice'* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
171 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
172 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
173 |
INSERT Person X: X name 'foo', X friend Y WHERE name 'nice' |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
174 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
175 |
Update and relation creation queries |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
176 |
------------------------------------ |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
177 |
`SET` <assignements> |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
178 |
[ `WHERE` <restriction>] |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
179 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
180 |
Caution, if a restriction is specified, the update is done *for |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
181 |
each line results returned by the restriction*. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
182 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
183 |
- *Renaming of the person named 'foo' to 'bar' with the first name changed* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
184 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
185 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
186 |
SET X name 'bar', X first_name 'original' where X is Person X name 'foo' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
187 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
188 |
- *Insert a relation of type 'know' between objects linked by |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
189 |
the relation of type 'friend'* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
190 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
191 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
192 |
SET X know Y WHERE X friend Y |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
193 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
194 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
195 |
Deletion query |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
196 |
-------------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
197 |
`DELETE` (<entity type> V) | (V1 relation v2 ),... |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
198 |
[ `WHERE` <restriction>] |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
199 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
200 |
Caution, if a restriction is specified, the deletion is made *for |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
201 |
each line results returned by the restriction*. |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
202 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
203 |
- *Deletion of the person named 'foo'* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
204 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
205 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
206 |
DELETE Person X WHERE X name 'foo' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
207 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
208 |
- *Removal of all relations of type 'friend' from the person named 'foo'* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
209 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
210 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
211 |
DELETE X friend Y WHERE X is Person, X name 'foo' |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
212 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
213 |
|
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
214 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
215 |
Language definition |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
216 |
=================== |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
217 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
218 |
Reserved keywords |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
219 |
----------------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
220 |
The keywords are not case sensitive. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
221 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
222 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
223 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
224 |
DISTINCT, INSERT, SET, DELETE, |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
225 |
WHERE, AND, OR, NOT |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
226 |
IN, LIKE, |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
227 |
TRUE, FALSE, NULL, TODAY, NOW |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
228 |
GROUPBY, ORDERBY, ASC, DESC |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
229 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
230 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
231 |
Variables and Typing |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
232 |
-------------------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
233 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
234 |
With RQL, we do not distinguish between entities and attributes. The |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
235 |
value of an attribute is considered an entity of a particular type (see |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
236 |
below), linked to one (real) entity by a relation called the name of |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
237 |
the attribute. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
238 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
239 |
Entities and values to browse and/or select are represented in |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
240 |
the query by *variables* that must be written in capital letters. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
241 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
242 |
There is a special type **Any**, referring to a non specific type. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
243 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
244 |
We can restrict the possible types for a variable using the |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
245 |
special relation **is**. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
246 |
The possible type(s) for each variable is derived from the schema |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
247 |
according to the constraints expressed above and thanks to the relations between |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
248 |
each variable. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
249 |
|
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
250 |
Built-in types |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
251 |
`````````````` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
252 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
253 |
The base types supported are string (between double or single quotes), |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
254 |
integers or floats (the separator is the'.'), dates and |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
255 |
boolean. We expect to receive a schema in which types String, |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
256 |
Int, Float, Date and Boolean are defined. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
257 |
|
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
258 |
* `String` (literal: between double or single quotes). |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
259 |
* `Int`, `Float` (separator being'.'). |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
260 |
* `Date`, `Datetime`, `Time` (literal: string YYYY/MM/DD [hh:mm] or keywords |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
261 |
`TODAY` and `NOW`). |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
262 |
* `Boolean` (keywords `TRUE` and `FALSE`). |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
263 |
* `Keyword` NULL. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
264 |
|
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
265 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
266 |
Operators |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
267 |
--------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
268 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
269 |
Logical Operators |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
270 |
``````````````````` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
271 |
:: |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
272 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
273 |
AND, OR, ',' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
274 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
275 |
',' is equivalent to 'AND' but with the smallest among the priority |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
276 |
of logical operators (see :ref:`PriorityOperators`). |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
277 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
278 |
Mathematical Operators |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
279 |
`````````````````````` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
280 |
:: |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
281 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
282 |
+, -, *, / |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
283 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
284 |
Comparison operators |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
285 |
```````````````````` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
286 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
287 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
288 |
=, <, <=, >=, > = ~, IN, LIKE |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
289 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
290 |
* The operator `=` is the default operator. |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
291 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
292 |
* The operator `LIKE` equivalent to `~=` can be used with the |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
293 |
special character `%` in a string to indicate that the chain |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
294 |
must start or finish by a prefix/suffix: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
295 |
:: |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
296 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
297 |
Any X WHERE X name =~ 'Th%' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
298 |
Any X WHERE X name LIKE '%lt' |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
299 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
300 |
* The operator `IN` provides a list of possible values: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
301 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
302 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
303 |
Any X WHERE X name IN ( 'chauvat', 'fayolle', 'di mascio', 'thenault') |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
304 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
305 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
306 |
XXX nico: A trick <> 'bar' would not it be more convenient than NOT A |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
307 |
trick 'bar'? |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
308 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
309 |
.. _PriorityOperators: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
310 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
311 |
Operators priority |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
312 |
`````````````````` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
313 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
314 |
1. '*', '/' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
315 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
316 |
2. '+', '-' |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
317 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
318 |
3. 'and' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
319 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
320 |
4. 'or' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
321 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
322 |
5. ',' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
323 |
|
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
324 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
325 |
Advanced Features |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
326 |
----------------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
327 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
328 |
Functions aggregates |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
329 |
```````````````````` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
330 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
331 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
332 |
COUNT, MIN, MAX, AVG, SUM |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
333 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
334 |
Functions on string |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
335 |
``````````````````` |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
336 |
:: |
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
337 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
338 |
UPPER, LOWER |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
339 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
340 |
Optional relations |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
341 |
`````````````````` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
342 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
343 |
* They allow you to select entities related or not to another. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
344 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
345 |
* You must use the `?` behind the variable to specify that the relation |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
346 |
toward it is optional: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
347 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
348 |
- Anomalies of a project attached or not to a version :: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
349 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
350 |
Any X, V WHERE X concerns P, P eid 42, X corrected_in V? |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
351 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
352 |
- All cards and the project they document if necessary :: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
353 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
354 |
Any C, P WHERE C is Card, P? documented_by C |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
355 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
356 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
357 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
358 |
BNF grammar |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
359 |
----------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
360 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
361 |
The terminal elements are in capital letters, non-terminal in lowercase. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
362 |
The value of the terminal elements (between quotes) is a Python regular |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
363 |
expression. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
364 |
:: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
365 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
366 |
statement:: = (select | delete | insert | update) ';' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
367 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
368 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
369 |
# select specific rules |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
370 |
select ::= 'DISTINCT'? E_TYPE selected_terms restriction? group? sort? |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
371 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
372 |
selected_terms ::= expression ( ',' expression)* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
373 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
374 |
group ::= 'GROUPBY' VARIABLE ( ',' VARIABLE)* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
375 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
376 |
sort ::= 'ORDERBY' sort_term ( ',' sort_term)* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
377 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
378 |
sort_term ::= VARIABLE sort_method =? |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
379 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
380 |
sort_method ::= 'ASC' | 'DESC' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
381 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
382 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
383 |
# delete specific rules |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
384 |
delete ::= 'DELETE' (variables_declaration | relations_declaration) restriction? |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
385 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
386 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
387 |
# insert specific rules |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
388 |
insert ::= 'INSERT' variables_declaration ( ':' relations_declaration)? restriction? |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
389 |
|
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
390 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
391 |
# update specific rules |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
392 |
update ::= 'SET' relations_declaration restriction |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
393 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
394 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
395 |
# common rules |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
396 |
variables_declaration ::= E_TYPE VARIABLE (',' E_TYPE VARIABLE)* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
397 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
398 |
relations_declaration ::= simple_relation (',' simple_relation)* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
399 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
400 |
simple_relation ::= VARIABLE R_TYPE expression |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
401 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
402 |
restriction ::= 'WHERE' relations |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
403 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
404 |
relations ::= relation (LOGIC_OP relation)* |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
405 |
| '(' relations')' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
406 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
407 |
relation ::= 'NOT'? VARIABLE R_TYPE COMP_OP? expression |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
408 |
| 'NOT'? R_TYPE VARIABLE 'IN' '(' expression (',' expression)* ')' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
409 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
410 |
expression ::= var_or_func_or_const (MATH_OP var_or_func_or_const) * |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
411 |
| '(' expression ')' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
412 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
413 |
var_or_func_or_const ::= VARIABLE | function | constant |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
414 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
415 |
function ::= FUNCTION '(' expression ( ',' expression) * ')' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
416 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
417 |
constant ::= KEYWORD | STRING | FLOAT | INT |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
418 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
419 |
# tokens |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
420 |
LOGIC_OP ::= ',' | 'GOLD' | 'AND' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
421 |
MATH_OP ::= '+' | '-' | '/' | '*' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
422 |
COMP_OP ::= '>' | '>=' | '=' | '<=' | '<' | '~=' | 'LIKE' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
423 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
424 |
FUNCTION ::= 'MIN' | 'MAX' | 'SUM' | 'AVG' | 'COUNT' | 'upper' | 'LOWER' |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
425 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
426 |
VARIABLE ::= '[A-Z][A-Z0-9]*' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
427 |
E_TYPE ::= '[A-Z]\w*' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
428 |
R_TYPE ::= '[a-z_]+' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
429 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
430 |
KEYWORD ::= 'TRUE' | 'FALSE' | 'NULL' | 'TODAY' | 'NOW' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
431 |
STRING ::= "'([^'\]|\\.)*'" |'"([^\"]|\\.)*\"' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
432 |
FLOAT ::= '\d+\.\d*' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
433 |
INT ::= '\d+' |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
434 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
435 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
436 |
Remarks |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
437 |
------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
438 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
439 |
Sorting and groups |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
440 |
`````````````````` |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
441 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
442 |
- For grouped queries (e.g. with a GROUPBY clause), all |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
443 |
selected variables should be grouped. |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
444 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
445 |
- To group and/or sort by attributes, we can do: "X,L user U, U |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
446 |
login L GROUPBY L, X ORDERBY L" |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
447 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
448 |
- If the sorting method (SORT_METHOD) is not specified, then the sorting is |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
449 |
ascendant. |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
450 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
451 |
Negation |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
452 |
```````` |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
453 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
454 |
* A query such as `Document X WHERE NOT X owned_by U` means "the |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
455 |
documents have no relation `owned_by`". |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
456 |
* But the query `Document X WHERE NOT X owned_by U, U login "syt"` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
457 |
means "the documents have no relation `owned_by` with the user |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
458 |
syt". They may have a relation "owned_by" with another user. |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
459 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
460 |
Identity |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
461 |
```````` |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
462 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
463 |
You can use the special relation `identity` in a query to |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
464 |
add an identity constraint between two variables. This is equivalent |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
465 |
to ``is`` in python:: |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
466 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
467 |
Any A WHERE A comments B, A identity B |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
468 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
469 |
return all objects that comment themselves. The relation |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
470 |
`identity` is especially useful when defining the rules for securities |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
471 |
with `RQLExpressions`. |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
472 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
473 |
Implementation |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
474 |
============== |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
475 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
476 |
Internal representation (syntactic tree) |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
477 |
---------------------------------------- |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
478 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
479 |
The tree research does not contain the selected variables |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
480 |
(e.g. there is only what follows "WHERE"). |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
481 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
482 |
The insertion tree does not contain the variables inserted or relations |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
483 |
defined on these variables (e.g. there is only what follows "WHERE"). |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
484 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
485 |
The removal tree does not contain the deleted variables and relations |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
486 |
(e.g. there is only what follows the "WHERE"). |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
487 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
488 |
The update tree does not contain the variables and relations updated |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
489 |
(e.g. there is only what follows the "WHERE"). |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
490 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
491 |
:: |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
492 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
493 |
Select ((Relationship | And | Gold)?, Group?, Sort?) |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
494 |
Insert (Relations | And | Gold)? |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
495 |
Delete (Relationship | And | Gold)? |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
496 |
Update (Relations | And | Gold)? |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
497 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
498 |
And ((Relationship | And | Gold), (Relationship | And | Gold)) |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
499 |
Or ((Relationship | And | Gold), (Relationship | And | Gold)) |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
500 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
501 |
Relationship ((VariableRef, Comparison)) |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
502 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
503 |
Comparison ((Function | MathExpression | Keyword | Constant | VariableRef) +) |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
504 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
505 |
Function (()) |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
506 |
MathExpression ((MathExpression | Keyword | Constant | VariableRef), (MathExpression | Keyword | Constant | VariableRef)) |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
507 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
508 |
Group (VariableRef +) |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
509 |
Sort (SortTerm +) |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
510 |
SortTerm (VariableRef +) |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
511 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
512 |
VariableRef () |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
513 |
Variable () |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
514 |
Keyword () |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
515 |
Constant () |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
516 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
517 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
518 |
Remarks |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
519 |
------- |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
520 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
521 |
- The current implementation does not support linking two relations of type |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
522 |
'is' with a OR. I do not think that the negation is supported on this type |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
523 |
of relation (XXX FIXME to be confirmed). |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
524 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
525 |
- Relations defining the variables must be left to those using them. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
526 |
For example:: |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
527 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
528 |
Point P where P abs X, P ord Y, P value X+Y |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
529 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
530 |
is valid, but:: |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
531 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
532 |
Point P where P abs X, P value X+Y, P ord Y |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
533 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
534 |
is not. |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
535 |
|
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
536 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
537 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
538 |
Conclusion |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
539 |
========== |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
540 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
541 |
Limitations |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
542 |
----------- |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
543 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
544 |
It lacks at the moment: |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
545 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
546 |
- COALESCE |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
547 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
548 |
- restrictions on groups (HAVING) |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
549 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
550 |
and certainly other things ... |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
551 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
552 |
A disadvantage is that to use this language we must know the |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
553 |
format used (with real relation names and entities, not those viewing |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
554 |
in the user interface). On the other hand, we can not really bypass |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
555 |
that, and it is the job of a user interface to hide the RQL. |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
556 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
557 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
558 |
Topics |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
559 |
------ |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
560 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
561 |
It would be convenient to express the schema matching |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
562 |
relations (non-recursive rules):: |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
563 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
564 |
Document class Type <-> Document occurence_of Fiche class Type |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
565 |
Sheet class Type <-> Form collection Collection class Type |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
566 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
567 |
Therefore 1. becomes:: |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
568 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
569 |
Document X where |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
570 |
X class C, C name 'Cartoon' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
571 |
X owned_by U, U login 'syt' |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
572 |
X available true |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
573 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
574 |
I'm not sure that we should handle this at RQL level ... |
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
575 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
576 |
There should also be a special relation 'anonymous'. |
115
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
577 |
|
4b66ad23fbd1
[doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
578 |
|
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
579 |
|
274
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
580 |
.. _Versa: http://uche.ogbuji.net/tech/rdf/versa/ |
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
581 |
.. _SPARQL: http://www.w3.org/TR/rdf-sparql-query/ |
209
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
582 |
|
38a9c240ac64
[doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
583 |
|
274
893353d66f86
[doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
255
diff
changeset
|
584 |
[FIXME] see also RQL documentation in source rql/doc. |