doc/book/en/C040-rql.en.txt
author sylvain.thenault@logilab.fr
Tue, 10 Mar 2009 19:35:38 +0100
branchtls-sprint
changeset 1036 593df4919845
parent 405 295f3cd70915
child 1165 9d325c3b0014
permissions -rw-r--r--
when reading the schema while adding/removing cubes, read schema in non-strict mode
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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` 
301
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 274
diff changeset
    33
schema defining the application.
209
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
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   111
        Any P WHERE
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   112
        P is Person, P work_for P, S name 'Eurocopter'
209
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
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   118
        Any N WHERE
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   119
        N is Note, N written_on D, D day> (today -10),
209
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
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   125
        Any P WHERE
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   126
        P is Person, (P interested_by T, T name 'training') OR
209
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
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   161
        INSERT Person X: X name 'foo'
209
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
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   214
Undocumented (yet) type of queries
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   215
----------------------------------
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   216
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   217
**Limit / offset**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   218
::
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   219
    
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   220
    Any P ORDERBY N LIMIT 5 OFFSET 10 WHERE P is Person, P firstname N
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   221
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   222
**Function calls**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   223
::
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   224
    
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   225
    Any UPPER(N) WHERE P firstname N
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   226
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   227
**Exists**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   228
::
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   229
    
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   230
    Any X ORDERBY PN,N
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   231
    WHERE X num N, X version_of P, P name PN, 
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   232
          EXISTS(X in_state S, S name IN ("dev", "ready"))
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   233
          OR EXISTS(T tags X, T name "priority")
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   234
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   235
**Left outer join**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   236
::
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   237
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   238
    Any T,P,V WHERE T is Ticket, T concerns P, T done_in V?
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   239
    
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   240
    
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   241
**Having**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   242
::
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   243
    
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   244
    Any X GROUPBY X WHERE X knows Y HAVING COUNT(Y) > 10
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   245
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   246
**Simple union**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   247
::
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   248
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   249
    (Any X WHERE X is Person) UNION (Any X WHERE X is Company)
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   250
    
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   251
**Complex union**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   252
::
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   253
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   254
     DISTINCT Any W, REF
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   255
        WITH W, REF BEING 
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   256
            (
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   257
	      (Any W, REF WHERE W is Workcase, W ref REF, 
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   258
                                 W concerned_by D, D name "Logilab")
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   259
               UNION 
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   260
              (Any W, REF WHERE W is Workcase, W ref REF, '
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   261
                                W split_into WP, WP name "WP1")
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   262
            )
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   263
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   264
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   265
Language definition
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   266
===================
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
Reserved keywords
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   269
-----------------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   270
The keywords are not case sensitive.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   271
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   272
::
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   273
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   274
     DISTINCT, INSERT, SET, DELETE,
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   275
     WHERE, AND, OR, NOT, EXISTS,
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   276
     IN, LIKE, UNION, WITH, BEING,
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   277
     TRUE, FALSE, NULL, TODAY, NOW,
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   278
     LIMIT, OFFSET,
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   279
     HAVING, GROUPBY, ORDERBY, ASC, DESC
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   280
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   281
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   282
Variables and Typing
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   285
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
   286
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
   287
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
   288
the attribute.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   289
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   290
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
   291
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
   292
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   293
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
   294
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   295
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
   296
special relation **is**.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   297
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
   298
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
   299
each variable.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   300
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   301
Built-in types
209
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   304
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
   305
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
   306
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
   307
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
   308
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   309
* `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
   310
* `Int`, `Float` (separator being'.').
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   311
* `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
   312
   `TODAY` and `NOW`).
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   313
* `Boolean` (keywords `TRUE` and `FALSE`).
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   314
* `Keyword` NULL.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   315
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   316
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   317
Operators
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   318
---------
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
Logical Operators
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
::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   323
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   324
     AND, OR, ','
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   325
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   326
',' 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
   327
of logical operators (see :ref:`PriorityOperators`).
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   328
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   329
Mathematical Operators
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
::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   332
209
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   335
Comparison operators
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   336
````````````````````
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   337
::
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   338
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   339
     =, <, <=, >=, > = ~, IN, LIKE
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   340
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   341
* 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
   342
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   343
* 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
   344
  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
   345
  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
   346
  ::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   347
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   348
     Any X WHERE X name =~ 'Th%'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   349
     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
   350
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   351
* 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
   352
  ::
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 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
   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
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
   358
trick 'bar'?
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
.. _PriorityOperators:
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   361
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   362
Operators priority
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   363
``````````````````
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
1. '*', '/'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   366
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   367
2. '+', '-'
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   368
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   369
3. 'and'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   370
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   371
4. 'or'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   372
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   373
5. ','
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   374
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   375
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   376
Advanced Features
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   379
Functions aggregates
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   380
````````````````````
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
     COUNT, MIN, MAX, AVG, SUM
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   384
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   385
Functions on string
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   386
```````````````````
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   387
::
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   388
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   389
     UPPER, LOWER
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   390
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   391
Optional relations
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   392
``````````````````
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
* 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
   395
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   396
* 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
   397
  toward it is optional:
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   398
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   399
   - 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
   400
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   401
       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
   402
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   403
   - 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
   404
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   405
       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
   406
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   407
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   408
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   409
BNF grammar
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   410
-----------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   411
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   412
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
   413
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
   414
expression.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   415
::
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
     statement:: = (select | delete | insert | update) ';'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   418
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   419
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   420
     # select specific rules
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   421
     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
   422
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   423
     selected_terms ::= expression ( ',' expression)*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   424
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   425
     group       ::= 'GROUPBY' VARIABLE ( ',' VARIABLE)*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   426
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   427
     sort        ::= 'ORDERBY' sort_term ( ',' sort_term)*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   428
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   429
     sort_term   ::=  VARIABLE sort_method =?
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   430
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   431
     sort_method ::= 'ASC' | 'DESC'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   432
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   433
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   434
     # delete specific rules
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   435
     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
   436
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
     # insert specific rules
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   439
     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
   440
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   441
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   442
     # update specific rules
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   443
     update ::= 'SET' relations_declaration restriction
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   444
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   445
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   446
     # common rules
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   447
     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
   448
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   449
     relations_declaration ::= simple_relation (',' simple_relation)*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   450
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   451
     simple_relation ::= VARIABLE R_TYPE expression
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   452
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   453
     restriction ::= 'WHERE' relations
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   454
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   455
     relations   ::= relation (LOGIC_OP relation)*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   456
                   | '(' relations')'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   457
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   458
     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
   459
                   | '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
   460
                   
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   461
     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
   462
                   | '(' expression ')'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   463
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   464
     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
   465
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   466
     function    ::= FUNCTION '(' expression ( ',' expression) * ')'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   467
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   468
     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
   469
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   470
     # tokens
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   471
     LOGIC_OP ::= ',' | 'GOLD' | 'AND'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   472
     MATH_OP  ::= '+' | '-' | '/' | '*'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   473
     COMP_OP  ::= '>' | '>=' | '=' | '<=' | '<' | '~=' | 'LIKE'
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
     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
   476
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   477
     VARIABLE ::= '[A-Z][A-Z0-9]*'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   478
     E_TYPE   ::= '[A-Z]\w*'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   479
     R_TYPE   ::= '[a-z_]+'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   480
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   481
     KEYWORD  ::= 'TRUE' | 'FALSE' | 'NULL' | 'TODAY' | 'NOW'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   482
     STRING   ::= "'([^'\]|\\.)*'" |'"([^\"]|\\.)*\"'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   483
     FLOAT    ::= '\d+\.\d*'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   484
     INT      ::= '\d+'
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   485
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   486
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   487
Remarks
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   488
-------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   489
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   490
Sorting and groups
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   491
``````````````````
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   492
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   493
- 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
   494
  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
   495
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   496
- 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
   497
  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
   498
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   499
- 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
   500
  ascendant.
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   501
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   502
Negation
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   503
````````
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   504
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   505
* 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
   506
  documents have no relation `owned_by`".
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   507
* 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
   508
  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
   509
  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
   510
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   511
Identity
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   512
````````
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   513
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   514
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
   515
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
   516
to ``is`` in python::
115
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
   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
   519
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   520
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
   521
`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
   522
with `RQLExpressions`.
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   523
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   524
Implementation
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   525
==============
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   526
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   527
Internal representation (syntactic tree)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   528
----------------------------------------
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
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
   531
(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
   532
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   533
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
   534
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
   535
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   536
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
   537
(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
   538
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   539
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
   540
(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
   541
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   542
::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   543
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   544
     Select         ((Relationship | And | Gold)?, Group?, Sort?)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   545
     Insert         (Relations | And | Gold)?
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   546
     Delete         (Relationship | And | Gold)?
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   547
     Update         (Relations | And | Gold)?
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   548
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   549
     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
   550
     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
   551
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   552
     Relationship   ((VariableRef, Comparison))
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   553
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   554
     Comparison     ((Function | MathExpression | Keyword | Constant | VariableRef) +)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   555
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   556
     Function       (())
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   557
     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
   558
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   559
     Group          (VariableRef +)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   560
     Sort           (SortTerm +)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   561
     SortTerm       (VariableRef +)
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   562
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   563
     VariableRef    ()
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   564
     Variable       ()
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   565
     Keyword        ()
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   566
     Constant       ()
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   567
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
Remarks
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   570
-------
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   571
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   572
- 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
   573
  '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
   574
  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
   575
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   576
- 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
   577
  For example::
115
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
     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
   580
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   581
   is valid, but::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   582
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   583
     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
   584
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   585
   is not.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   586
335
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   587
RQL logs
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   588
--------
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   589
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   590
You can configure the `CubicWeb` application so that you keep a log
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   591
of the queries executed against your database. To do so, you want to
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   592
edit the configuration file of your application 
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   593
``.../etc/cubicweb.d/myapp/all-in-one.conf`` and uncomment the
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   594
variable ``query-log-file``: ::
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   595
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   596
  # web application query log file
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 301
diff changeset
   597
  query-log-file=/tmp/rql-myapp.log
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   598
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   599
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   600
Conclusion
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   601
==========
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   602
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   603
Limitations
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   604
-----------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   605
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   606
It lacks at the moment:
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   607
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   608
- COALESCE
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   609
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   610
- restrictions on groups (HAVING)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   611
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   612
and certainly other things ...
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   613
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   614
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
   615
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
   616
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
   617
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
   618
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   619
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   620
Topics
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   621
------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   622
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   623
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
   624
relations (non-recursive rules)::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   625
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   626
     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
   627
     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
   628
    
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   629
Therefore 1. becomes::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   630
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   631
     Document X where
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   632
     X class C, C name 'Cartoon'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   633
     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
   634
     X available true
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   635
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   636
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
   637
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   638
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
   639
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   640
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   641
274
893353d66f86 [doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 255
diff changeset
   642
.. _Versa: http://uche.ogbuji.net/tech/rdf/versa/
893353d66f86 [doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 255
diff changeset
   643
.. _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
   644
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   645
274
893353d66f86 [doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 255
diff changeset
   646
[FIXME] see also RQL documentation in source rql/doc.