equal
deleted
inserted
replaced
1 .. -*- coding: utf-8 -*- |
1 .. -*- coding: utf-8 -*- |
|
2 |
|
3 .. _datamodel_definition: |
2 |
4 |
3 Yams *schema* |
5 Yams *schema* |
4 ------------- |
6 ------------- |
5 |
7 |
6 The **schema** is the core piece of a *CubicWeb* instance as it |
8 The **schema** is the core piece of a *CubicWeb* instance as it |
8 are either already defined in `Yams`_ and the *CubicWeb* standard |
10 are either already defined in `Yams`_ and the *CubicWeb* standard |
9 library; or more specific types defined in cubes. The schema for a |
11 library; or more specific types defined in cubes. The schema for a |
10 cube is defined in a `schema` python module or package. |
12 cube is defined in a `schema` python module or package. |
11 |
13 |
12 .. _`Yams`: http://www.logilab.org/project/yams |
14 .. _`Yams`: http://www.logilab.org/project/yams |
|
15 |
|
16 .. _datamodel_overview: |
13 |
17 |
14 Overview |
18 Overview |
15 ~~~~~~~~ |
19 ~~~~~~~~ |
16 |
20 |
17 The core idea of the yams schema is not far from the classical |
21 The core idea of the yams schema is not far from the classical |
406 * we can not use `RRQLExpression` on relation types for reading |
410 * we can not use `RRQLExpression` on relation types for reading |
407 |
411 |
408 * special relations "has_<ACTION>_permission" can not be used |
412 * special relations "has_<ACTION>_permission" can not be used |
409 |
413 |
410 |
414 |
411 |
415 .. _yams_example: |
412 |
416 |
413 Defining your schema using yams |
417 Defining your schema using yams |
414 ------------------------------- |
418 ------------------------------- |
415 |
419 |
416 Entity type definition |
420 Entity type definition |
492 |
496 |
493 *Note*: if you end up with an `if` in the definition of your entity, this probably |
497 *Note*: if you end up with an `if` in the definition of your entity, this probably |
494 means that you need two separate entities that implement the `ITree` interface and |
498 means that you need two separate entities that implement the `ITree` interface and |
495 get the result from `.children()` which ever entity is concerned. |
499 get the result from `.children()` which ever entity is concerned. |
496 |
500 |
497 Inheritance |
501 .. Inheritance |
498 ``````````` |
502 .. ``````````` |
499 XXX feed me |
503 .. XXX feed me |
500 |
504 |
501 |
505 |
502 Definition of relations |
506 Definition of relations |
503 ~~~~~~~~~~~~~~~~~~~~~~~ |
507 ~~~~~~~~~~~~~~~~~~~~~~~ |
504 |
508 |
505 XXX add note about defining relation type / definition |
509 .. XXX add note about defining relation type / definition |
506 |
510 |
507 A relation is defined by a Python class heriting `RelationType`. The name |
511 A relation is defined by a Python class heriting `RelationType`. The name |
508 of the class corresponds to the name of the type. The class then contains |
512 of the class corresponds to the name of the type. The class then contains |
509 a description of the properties of this type of relation, and could as well |
513 a description of the properties of this type of relation, and could as well |
510 contain a string for the subject and a string for the object. This allows to create |
514 contain a string for the subject and a string for the object. This allows to create |
544 ``underscore_separated_words``. |
548 ``underscore_separated_words``. |
545 |
549 |
546 :Historical note: |
550 :Historical note: |
547 |
551 |
548 It has been historically possible to use `ObjectRelation` which |
552 It has been historically possible to use `ObjectRelation` which |
549 defines a relation in the opposite direction. This feature is soon to be |
553 defines a relation in the opposite direction. This feature is |
550 deprecated and therefore should not be used in newly written code. |
554 deprecated and therefore should not be used in newly written code. |
551 |
555 |
552 :Future deprecation note: |
556 :Future deprecation note: |
553 |
557 |
554 In an even more remote future, it is quite possible that the |
558 In an even more remote future, it is quite possible that the |