doc/book/en/intro/concepts/index.rst
author Nicolas Chauvat <nicolas.chauvat@logilab.fr>
Thu, 23 Jul 2009 14:45:31 +0200
changeset 2445 6f065b366d14
parent 2279 b4e970513117
child 2476 1294a6bdf3bf
permissions -rw-r--r--
rename environment variables
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     2
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
     3
.. _Concepts:
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
     4
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
     5
The Core Concepts of CubicWeb
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
     6
=============================
301
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 300
diff changeset
     7
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
     8
This section defines some terms and core concepts of the *CubicWeb*
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
     9
framework. To avoid confusion while reading this book, take time to go through
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    10
the following definitions and use this section as a reference during your
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    11
reading.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    12
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    13
.. _Cube:
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    14
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    15
Cubes
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    16
-----
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    17
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    18
A cube is a software component made of three parts: its data model
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    19
(:file:`schema`), its logic (:file:`entities`) and its user interface
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    20
(:file:`views`).
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    21
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    22
A cube can use other cubes as building blocks and assemble them to provide
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    23
a whole with richer functionnalities than its parts. The cubes `cubicweb-blog`_
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    24
and `cubicweb-comment`_ could be used to make a cube named *myblog* with
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    25
commentable blog entries.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    26
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    27
The `CubicWeb Forge`_ offers a large number of cubes developed by the community
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    28
and available under a free software license.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    29
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    30
The command ``cubicweb-ctl list`` displays the list of cubes installed on your
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    31
system.
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    32
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    33
On a Unix system, the available cubes are usually stored in the directory
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    34
:file:`/usr/share/cubicweb/cubes`. During development, the cubes are commonly
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    35
found in the directory :file:`/path/to/cubicweb_forest/cubes`. The environment
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    36
variable :envvar:`CW_CUBES_PATH` gives additionnal locations where to search for
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    37
cubes.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    38
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    39
.. _`CubicWeb Forge`: http://www.cubicweb.org/project/
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    40
.. _`cubicweb-blog`: http://www.cubicweb.org/project/cubicweb-blog
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    41
.. _`cubicweb-comment`: http://www.cubicweb.org/project/cubicweb-comment
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    42
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    43
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    44
Instances
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    45
---------
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    46
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    47
An instance is a runnable application installed on a computer and based on a
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    48
cube.
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    49
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    50
The instance directory contains the configuration files. Several instances can
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    51
be created and based on the same cube. For exemple, several software forges can
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    52
be set up on one computer system based on the `cubicweb-forge`_ cube.
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    53
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    54
.. _`cubicweb-forge`: http://www.cubicweb.org/project/cubicweb-forge
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    55
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    56
Instances can be of three different types: all-in-one, web engine or data
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    57
repository. For applications that support high traffic, several web (front-end)
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    58
and data (back-end) instances can be set-up to share the load.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    59
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    60
.. image:: ../../images/archi_globale.en.png
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    61
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    62
The command ``cubicweb-ctl list`` displays the list of instances installed on
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    63
your system.
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    64
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    65
On a Unix system, the instances are usually stored in the directory
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    66
:file:`/etc/cubicweb.d/`. During development, the :file:`~/etc/cubicweb.d/`
2445
6f065b366d14 rename environment variables
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2279
diff changeset
    67
directory is looked up, as well as the paths in :envvar:`CW_INSTANCES_DIR`
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    68
environment variable.
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    69
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    70
The term application can refer to an instance or to a cube, depending on the
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    71
context. This book will try to avoid using this term and use *cube* and
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    72
*instance* as appropriate.
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    73
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    74
Data Repository
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    75
---------------
2175
16d3c37c5d28 [doc] improvements
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2172
diff changeset
    76
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    77
The data repository [#]_ provides access to one or more data sources (including
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    78
SQL databases, LDAP repositories, Mercurial or Subversion version control
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    79
systems, other CubicWeb repositories, GAE's DataStore, etc).
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    80
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    81
All interactions with the repository are done using the Relation Query Language
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    82
(RQL). The repository federates the data sources and hides them from the
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    83
querier, which does not realize when a query spans accross several data sources
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    84
and requires running sub-queries and merges to complete.
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    85
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    86
It is common to run the web engine and the repository in the same process (see
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    87
instances of type all-in-one above), but this is not a requirement. A repository
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    88
can be set up to be accessed remotely using Pyro (`Python Remote Objects`_) and
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    89
act as a server.
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    90
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    91
Some logic can be attached to events that happen in the repository, like
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    92
creation of entities, deletion of relations, etc. This is used for example to
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    93
send email notifications when the state of an object changes. See `Hooks` below.
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    94
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    95
.. _[#]: not to be confused with a Mercurial repository or a Debian repository.
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    96
.. _`Python Remote Objects`: http://pyro.sourceforge.net/
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
    97
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    98
Web Engine
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
    99
----------
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   100
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   101
The web engine replies to http requests and runs the user interface and most of
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   102
the application logic.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   103
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   104
By default the web engine provides a generated user interface based on the data
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   105
model of the instance. Entities can be created, displayed, updated and
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   106
deleted. As the default user interface is not very fancy, it is usually
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   107
necessary to develop your own.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   108
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   109
Schema (Data Model)
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   110
-------------------
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   111
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   112
The data model of a cube is described as an entity-relationship schema using a
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   113
comprehensive language made of Python classes imported from the yams_ library.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   114
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   115
.. _yams: http://www.logilab.org/project/yams/
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   116
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   117
An `entity type` defines a set of attributes and is used in some relations.
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   118
Attributes may be of the following types: `String`, `Int`, `Float`, `Boolean`,
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   119
`Date`, `Time`, `Datetime`, `Interval`, `Password`, `Bytes`, `RichString`. See
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   120
:ref:`yams.BASE_TYPES` for details.
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   121
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   122
A `relation type` is used to define a binary oriented relation between two
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   123
entity types.  The left-hand part of a relation is named the `subject` and the
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   124
right-hand part is named the `object`.
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   125
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   126
A `relation definition` is a triple (*subject entity type*, *relation type*, *object
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   127
entity type*) associated with a set of properties such as cardinality,
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   128
constraints, etc.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   129
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   130
Permissions can be set on entity types and relation types to control who will be
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   131
able to create, read, update or delete entities and relations.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   132
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   133
Some meta-data necessary to the system is added to the data model. That includes
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   134
entities like users and groups, the entities used to store the data model
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   135
itself and attributes like unique identifier, creation date, creator, etc.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   136
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   137
When you create a new *CubicWeb* instance, the schema is stored in the database.
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   138
When the cubes the instance is based on evolve, they may change their data model
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   139
and provide migration scripts that will be executed when the administrator will
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   140
run the upgrade process for the instance.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   141
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   142
Registries and Objects
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   143
----------------------
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   144
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   145
XXX registry, register, registries, registers ???
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   146
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   147
Application objects
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   148
~~~~~~~~~~~~~~~~~~~
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   149
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   150
Beside a few core functionalities, almost every feature of the framework is
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   151
achieved by dynamic objects (`application objects` or `appobjects`) stored in a
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   152
two-levels registry (the `vregistry`). Each object is affected to a registry with
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   153
an identifier in this registry. You may have more than one object sharing an
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   154
identifier in the same registry, At runtime, appobjects are selected in the
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   155
vregistry according to the context.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   156
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   157
Application objects are stored in the registry using a two level hierarchy :
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   158
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   159
  object's `__registry__` : object's `id` : [list of app objects]
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   160
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   161
The base class of appobjects is `AppRsetObject` (module `cubicweb.appobject`).
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   162
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   163
The `vregistry`
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   164
~~~~~~~~~~~~~~~
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   165
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   166
At startup, the `registry` or registers base, inspects a number of directories
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   167
looking for compatible classes definition. After a recording process, the objects
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   168
are assigned to registers so that they can be selected dynamically while the
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   169
application is running.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   170
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   171
Selectors
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   172
~~~~~~~~~
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   173
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   174
Each appobject has a selector, that is used to compute how well the object fits
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   175
a given context. The better the object fits the context, the higher the score.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   176
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   177
CubicWeb provides a set of basic selectors that may be parametrized. Selectors
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   178
can be combined with the binary operators `&` and `|` to build more complex
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   179
selector that can be combined too.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   180
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   181
There are three common ways to retrieve some appobject from the repository:
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   182
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   183
* get the most appropriate objects by specifying a registry and an identifier. In
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   184
  that case, the object with the greatest score is selected. There should always
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   185
  be a single appobject with a greater score than others.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   186
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   187
* get all appobjects applying to a context by specifying a registry.In
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   188
  that case, every object with the a postive score is selected.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   189
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   190
* get the object within a particular registry/identifier. In that case no
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   191
  selection process is involved, the vregistry will expect to find a single
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   192
  object in that cell.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   193
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   194
Selector sets are the glue that tie views to the data model. Using them
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   195
appropriately is an essential part of the construction of well behaved cubes.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   196
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   197
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   198
When no score is higher than the others, an exception is raised in development
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   199
mode to let you know that the engine was not able to identify the view to
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   200
apply. This error is silented in production mode and one of the objects with the
2172
cf8f9180e63e delete-trailing-whitespace
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 1714
diff changeset
   201
higher score is picked.
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   202
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   203
If no object has a positive score, ``NoSelectableObject`` exception is raised.
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   204
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   205
If no object is found for a particular registry and identifier,
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   206
``ObjectNotFound`` exception is raised.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   207
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   208
In such cases you would need to review your design and make sure your views are
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   209
properly defined.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   210
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   211
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   212
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   213
The RQL query language
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   214
----------------------
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   215
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   216
**No need for a complicated ORM when you have a powerful query language**
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   217
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   218
All the persistant data in a CubicWeb application is retrieved and modified by using the
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   219
Relation Query Language.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   220
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   221
This query language is inspired by SQL but is on a higher level in order to
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   222
emphasize browsing relations.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   223
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   224
db-api
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   225
~~~~~~
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   226
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   227
The repository exposes a `db-api`_ like api but using the RQL instead of SQL.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   228
XXX feed me
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   229
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   230
Result set
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   231
~~~~~~~~~~
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   232
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   233
XXX feed me
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   234
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   235
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   236
Views
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   237
-----
2279
b4e970513117 [doc] improve description of core concepts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 2175
diff changeset
   238
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   239
** *CubicWeb* is data driven **
119
7a56ca431d65 [doc] missing file
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   240
1714
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   241
XXX feed me.
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   242
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   243
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   244
Hooks
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   245
-----
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   246
** *CubicWeb* provides an extensible data repository **
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   247
a721966779be new book layout, do not compile yet
sylvain.thenault@logilab.fr
parents: 1398
diff changeset
   248
XXX feed me.