doc/book/en/C040-rql.en.txt
author sylvain.thenault@logilab.fr
Fri, 17 Apr 2009 09:37:29 +0200
branchtls-sprint
changeset 1389 ae58c2e7e1f7
parent 1212 76de1c3aaef3
child 1591 e85bf08a123b
permissions -rw-r--r--
clear label handling
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
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    12
Goals of RQL
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    13
------------
209
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
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    17
special relations (in terms of implementation, the language
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    18
user should see virtually no difference between an attribute and a
209
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
`````
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    37
We should look in more detail, but here are already some ideas for
209
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`)
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    57
   Extract entities and attributes of entities.
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    58
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    59
Insert entities (`INSERT`)
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    60
   Insert new entities or relations in the database.
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    61
   It can also directly create relationships for the newly created entities.
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    62
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    63
Update entities, create relations (`SET`)
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    64
   Update existing entities in the database,
209
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
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    67
Delete entities or relationship (`DELETE`)
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    68
   Remove entities or relations existing in the database.
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    69
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    70
Search Query
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    71
------------
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    72
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    73
   [ `DISTINCT`] <entity type> V1 (V2) \ *
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    74
   [ `GROUPBY` V1 (V2) \*] [ `ORDERBY` <orderterms>]
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    75
   [ `WHERE` <restriction>]
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    76
   [ `LIMIT` <value>] [ `OFFSET` <value>]
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    77
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    78
:entity type:
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    79
   Type of selected variables.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    80
   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
    81
:restriction:
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    82
   list of conditions to test successively 
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    83
     `V1 relation V2 | <static value>`
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    84
:orderterms:
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    85
   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
    86
   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
    87
:note for grouped queries:
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    88
   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
    89
   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
    90
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    91
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    92
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    93
- *Search for the object of identifier 53*
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
    94
  ::
209
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
        Any WHERE X
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    97
        X eid 53
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    98
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
    99
- *Search material such as comics, owned by syt and available*
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   100
  ::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   101
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   102
        WHERE X Document
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   103
        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
   104
        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
   105
        X available true
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   106
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   107
- *Looking for people working for eurocopter interested in training*
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   108
  ::
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   109
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   110
        Any P WHERE
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   111
        P is Person, P work_for S, S name 'Eurocopter'
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   112
        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
   113
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   114
- *Search note less than 10 days old written by jphc or ocy*
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   115
  ::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   116
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   117
        Any N WHERE
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   118
        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
   119
        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
   120
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   121
- *Looking for people interested in training or living in Paris*
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   122
  ::
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   123
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   124
        Any P WHERE
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   125
        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
   126
        (P city 'Paris')
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   127
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   128
- *The name and surname of all people*
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   129
  ::
209
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
        Any N, P WHERE
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   132
        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
   133
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   134
  Note that the selection of several entities generally force
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   135
  the use of "Any" because the type specification applies otherwise
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   136
  to all the selected variables. We could write here
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   137
  ::
209
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
        String N, P WHERE
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   140
        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
   141
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   142
1212
76de1c3aaef3 [doc] RQL: a note about specifying several types
Emile Anclin <emile.anclin@logilab.fr>
parents: 1166
diff changeset
   143
  Note: You can not specify several types with * ... where X is FirstType or X is SecondType*.
76de1c3aaef3 [doc] RQL: a note about specifying several types
Emile Anclin <emile.anclin@logilab.fr>
parents: 1166
diff changeset
   144
  To specify several types explicitely, you have to do
76de1c3aaef3 [doc] RQL: a note about specifying several types
Emile Anclin <emile.anclin@logilab.fr>
parents: 1166
diff changeset
   145
76de1c3aaef3 [doc] RQL: a note about specifying several types
Emile Anclin <emile.anclin@logilab.fr>
parents: 1166
diff changeset
   146
  ::
76de1c3aaef3 [doc] RQL: a note about specifying several types
Emile Anclin <emile.anclin@logilab.fr>
parents: 1166
diff changeset
   147
76de1c3aaef3 [doc] RQL: a note about specifying several types
Emile Anclin <emile.anclin@logilab.fr>
parents: 1166
diff changeset
   148
        Any X where X is in (FirstType, SecondType)
76de1c3aaef3 [doc] RQL: a note about specifying several types
Emile Anclin <emile.anclin@logilab.fr>
parents: 1166
diff changeset
   149
76de1c3aaef3 [doc] RQL: a note about specifying several types
Emile Anclin <emile.anclin@logilab.fr>
parents: 1166
diff changeset
   150
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   151
Insertion query
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   154
    `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
   155
    [ `WHERE` <restriction>]
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   156
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   157
:assignments:
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   158
   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
   159
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   160
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
   161
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   162
Caution, if a restriction is specified, the insertion is done for 
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   163
*each line result returned by the restriction*.
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   164
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   165
- *Insert a new person named 'foo'*
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   166
  ::
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   167
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   168
        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
   169
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   170
- *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
   171
  between them*
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   174
        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
   175
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   176
- *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
   177
  person called 'nice'*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   178
  ::
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
        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
   181
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   182
Update and relation creation queries
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   183
------------------------------------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   184
    `SET` <assignements>
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   185
    [ `WHERE` <restriction>]
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   186
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   187
Caution, if a restriction is specified, the update is done *for
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   188
each result line returned by the restriction*.
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   189
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   190
- *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
   191
  ::
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   192
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   193
        SET X name 'bar', X first_name 'original' WHERE X is Person, X name 'foo'
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
- *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
   196
  the relation of type 'friend'*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   197
  ::
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   198
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   199
        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
   200
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   201
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   202
Deletion query
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   203
--------------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   204
    `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
   205
    [ `WHERE` <restriction>]
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   206
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   207
Caution, if a restriction is specified, the deletion is made *for
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   208
each line result returned by the restriction*.
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   209
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   210
- *Deletion of the person named 'foo'*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   211
  ::
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   212
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   213
        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
   214
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   215
- *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
   216
  ::
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   217
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   218
        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
   219
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   220
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   221
(yet) Undocumented types of queries
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   222
-----------------------------------
405
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
**Limit / offset**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   225
::
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
    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
   228
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   229
**Function calls**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   230
::
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   231
    
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   232
    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
   233
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   234
**Exists**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   235
::
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
    Any X ORDERBY PN,N
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   238
    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
   239
          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
   240
          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
   241
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   242
**Left outer join**
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
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   245
    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
   246
    
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
**Having**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   249
::
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
    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
   252
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   253
**Simple union**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   254
::
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   255
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   256
    (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
   257
    
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   258
**Complex union**
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   259
::
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   260
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   261
     DISTINCT Any W, REF
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   262
        WITH W, REF BEING 
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   263
            (
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   264
	      (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
   265
                                 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
   266
               UNION 
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   267
              (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
   268
                                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
   269
            )
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   270
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   271
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   272
Language definition
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   275
Reserved keywords
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   276
-----------------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   277
The keywords are not case sensitive.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   278
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   279
::
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   280
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   281
     DISTINCT, INSERT, SET, DELETE,
405
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   282
     WHERE, AND, OR, NOT, EXISTS,
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   283
     IN, LIKE, UNION, WITH, BEING,
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   284
     TRUE, FALSE, NULL, TODAY, NOW,
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   285
     LIMIT, OFFSET,
295f3cd70915 [documentation] add some more rql documentation
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 335
diff changeset
   286
     HAVING, GROUPBY, ORDERBY, ASC, DESC
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   287
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   288
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   289
Variables and Typing
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   290
--------------------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   291
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   292
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
   293
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
   294
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
   295
the attribute.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   296
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   297
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
   298
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
   299
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   300
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
   301
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   302
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
   303
special relation **is**.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   304
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
   305
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
   306
each variable.
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   307
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   308
Built-in types
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   309
``````````````
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   310
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   311
The base types supported are string (between double or single quotes),
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   312
integers or floats (the separator is '.'), dates and
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   313
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
   314
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
   315
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   316
* `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
   317
* `Int`, `Float` (separator being'.').
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   318
* `Date`, `Datetime`, `Time` (literal: string YYYY/MM/DD [hh:mm] or keywords
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   319
  `TODAY` and `NOW`).
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   320
* `Boolean` (keywords `TRUE` and `FALSE`).
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   321
* `Keyword` NULL.
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
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   324
Operators
209
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   327
Logical Operators
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   328
`````````````````
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   329
::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   330
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   331
     AND, OR, NOT, ','
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   332
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   333
',' 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
   334
of logical operators (see :ref:`PriorityOperators`).
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   335
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   336
Mathematical Operators
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
::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   339
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   340
     +, -, *, /
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   341
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   342
Comparison operators
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   343
````````````````````
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   344
::
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   345
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   346
     =, <, <=, >=, >, ~=, IN, LIKE
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
* 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
   349
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   350
* 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
   351
  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
   352
  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
   353
  ::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   354
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   355
     Any X WHERE X name ~= 'Th%'
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   356
     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
   357
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   358
* 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
   359
  ::
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   360
  
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   361
    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
   362
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   363
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   364
XXX nico: "A trick <> 'bar'" wouldn't it be more convenient than 
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   365
"NOT A trick 'bar'" ?
209
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
.. _PriorityOperators:
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   368
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   369
Operator priority
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   370
`````````````````
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   371
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   372
1. '*', '/'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   373
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   374
2. '+', '-'
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   375
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   376
3. 'not'
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   377
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   378
4 'and'
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   379
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   380
5 'or'
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   381
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   382
6 ','
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   383
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   384
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   385
Advanced Features
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   386
-----------------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   387
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   388
Aggregate Functions
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   389
```````````````````
209
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   392
     COUNT, MIN, MAX, AVG, SUM
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
Functions on string
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   395
```````````````````
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   396
::
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   397
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   398
     UPPER, LOWER
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   399
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   400
Optional relations
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   401
``````````````````
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   402
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   403
* 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
   404
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   405
* 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
   406
  toward it is optional:
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
   - 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
   409
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   410
       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
   411
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   412
   - 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
   413
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   414
       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
   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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   418
BNF grammar
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   421
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
   422
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
   423
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   426
     statement:: = (select | delete | insert | update) ';'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   427
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
     # select specific rules
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   430
     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
   431
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   432
     selected_terms ::= expression ( ',' expression)*
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
     group       ::= 'GROUPBY' VARIABLE ( ',' VARIABLE)*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   435
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   436
     sort        ::= 'ORDERBY' sort_term ( ',' sort_term)*
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
     sort_term   ::=  VARIABLE sort_method =?
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   439
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   440
     sort_method ::= 'ASC' | 'DESC'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   441
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   442
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   443
     # delete specific rules
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   444
     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
   445
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   446
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   447
     # insert specific rules
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   448
     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
   449
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   450
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   451
     # update specific rules
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   452
     update ::= 'SET' relations_declaration restriction
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   453
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   454
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   455
     # common rules
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   456
     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
   457
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   458
     relations_declaration ::= simple_relation (',' simple_relation)*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   459
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   460
     simple_relation ::= VARIABLE R_TYPE expression
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   461
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   462
     restriction ::= 'WHERE' relations
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   463
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   464
     relations   ::= relation (LOGIC_OP relation)*
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   465
                   | '(' relations')'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   466
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   467
     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
   468
                   | '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
   469
                   
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   470
     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
   471
                   | '(' expression ')'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   472
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   473
     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
   474
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   475
     function    ::= FUNCTION '(' expression ( ',' expression) * ')'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   476
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   477
     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
   478
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   479
     # tokens
1165
9d325c3b0014 Or is the french word for Gold ;)
Emile Anclin <emile.anclin@logilab.fr>
parents: 405
diff changeset
   480
     LOGIC_OP ::= ',' | 'OR' | 'AND'
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   481
     MATH_OP  ::= '+' | '-' | '/' | '*'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   482
     COMP_OP  ::= '>' | '>=' | '=' | '<=' | '<' | '~=' | 'LIKE'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   483
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   484
     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
   485
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   486
     VARIABLE ::= '[A-Z][A-Z0-9]*'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   487
     E_TYPE   ::= '[A-Z]\w*'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   488
     R_TYPE   ::= '[a-z_]+'
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
     KEYWORD  ::= 'TRUE' | 'FALSE' | 'NULL' | 'TODAY' | 'NOW'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   491
     STRING   ::= "'([^'\]|\\.)*'" |'"([^\"]|\\.)*\"'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   492
     FLOAT    ::= '\d+\.\d*'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   493
     INT      ::= '\d+'
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   494
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   495
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   496
Remarks
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   497
-------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   498
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   499
Sorting and groups
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   500
``````````````````
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   501
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   502
- 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
   503
  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
   504
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   505
- 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
   506
  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
   507
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   508
- 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
   509
  ascendant.
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
Negation
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   512
````````
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   513
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   514
* 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
   515
  documents have no relation `owned_by`".
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   516
* 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
   517
  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
   518
  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
   519
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   520
Identity
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   521
````````
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   522
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   523
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
   524
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
   525
to ``is`` in python::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   526
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   527
   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
   528
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   529
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
   530
`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
   531
with `RQLExpressions`.
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
Implementation
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   534
==============
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
Internal representation (syntactic tree)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   537
----------------------------------------
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 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
   540
(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
   541
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   542
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
   543
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
   544
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   545
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
   546
(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
   547
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   548
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
   549
(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
   550
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   551
::
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   552
1165
9d325c3b0014 Or is the french word for Gold ;)
Emile Anclin <emile.anclin@logilab.fr>
parents: 405
diff changeset
   553
     Select         ((Relationship | And | Or)?, Group?, Sort?)
9d325c3b0014 Or is the french word for Gold ;)
Emile Anclin <emile.anclin@logilab.fr>
parents: 405
diff changeset
   554
     Insert         (Relations | And | Or)?
9d325c3b0014 Or is the french word for Gold ;)
Emile Anclin <emile.anclin@logilab.fr>
parents: 405
diff changeset
   555
     Delete         (Relationship | And | Or)?
9d325c3b0014 Or is the french word for Gold ;)
Emile Anclin <emile.anclin@logilab.fr>
parents: 405
diff changeset
   556
     Update         (Relations | And | Or)?
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   557
1165
9d325c3b0014 Or is the french word for Gold ;)
Emile Anclin <emile.anclin@logilab.fr>
parents: 405
diff changeset
   558
     And            ((Relationship | And | Or), (Relationship | And | Or))
9d325c3b0014 Or is the french word for Gold ;)
Emile Anclin <emile.anclin@logilab.fr>
parents: 405
diff changeset
   559
     Or             ((Relationship | And | Or), (Relationship | And | Or))
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   560
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   561
     Relationship   ((VariableRef, Comparison))
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
     Comparison     ((Function | MathExpression | Keyword | Constant | VariableRef) +)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   564
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   565
     Function       (())
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   566
     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
   567
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   568
     Group          (VariableRef +)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   569
     Sort           (SortTerm +)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   570
     SortTerm       (VariableRef +)
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
     VariableRef    ()
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   573
     Variable       ()
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   574
     Keyword        ()
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   575
     Constant       ()
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   576
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   577
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   578
Remarks
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   579
-------
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
- 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
   582
  '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
   583
  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
   584
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   585
- 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
   586
  For example::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   587
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   588
     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
   589
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   590
  is valid, but::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   591
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   592
     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
   593
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   594
  is not.
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   595
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
   596
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
   597
--------
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
   598
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   599
You can configure the `CubicWeb` application to keep a log
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   600
of the queries executed against your database. To do so, 
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
   601
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
   602
``.../etc/cubicweb.d/myapp/all-in-one.conf`` and uncomment the
1166
9c5cc3dc2733 some more RQL doc improvements
Emile Anclin <emile.anclin@logilab.fr>
parents: 1165
diff changeset
   603
variable ``query-log-file``::
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
   604
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
   605
  # 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
   606
  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
   607
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   608
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   609
Conclusion
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   610
==========
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
Limitations
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
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   615
It lacks at the moment:
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   616
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   617
- COALESCE
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   618
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   619
- restrictions on groups (HAVING)
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   620
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   621
and certainly other things ...
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
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
   624
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
   625
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
   626
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
   627
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   628
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   629
Topics
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   630
------
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   631
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   632
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
   633
relations (non-recursive rules)::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   634
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   635
     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
   636
     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
   637
    
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   638
Therefore 1. becomes::
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   639
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   640
     Document X where
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   641
     X class C, C name 'Cartoon'
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   642
     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
   643
     X available true
115
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   644
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   645
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
   646
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   647
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
   648
4b66ad23fbd1 [doc] merge old lax book with the rest
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   649
209
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   650
274
893353d66f86 [doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 255
diff changeset
   651
.. _Versa: http://uche.ogbuji.net/tech/rdf/versa/
893353d66f86 [doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 255
diff changeset
   652
.. _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
   653
38a9c240ac64 [doc] Now uses specs from rql/doc
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   654
274
893353d66f86 [doc] fix rql intro
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 255
diff changeset
   655
[FIXME] see also RQL documentation in source rql/doc.