author | Sandrine Ribeau <sandrine.ribeau@logilab.fr> |
Tue, 23 Dec 2008 13:15:23 -0800 | |
changeset 286 | 451a74c5652c |
parent 130 | doc/book/en/B050-data-as-objects.en.txt@213f07dffde3 |
permissions | -rw-r--r-- |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
1 |
.. -*- coding: utf-8 -*- |
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
2 |
|
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
3 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
4 |
Stored data handling |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
5 |
==================== |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
6 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
7 |
Classes `Entity` and `AnyEntity` |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
8 |
-------------------------------- |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
9 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
10 |
To provide a specific behavior for each entity, we just need to define |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
11 |
a class inheriting from `cubicweb.entities.EnyEntity`. In genera, we have |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
12 |
to defined those classes in a module of `entites` package of an application |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
13 |
so that it will be available on both server and client side. |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
14 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
15 |
The class `AnyEntity` is loaded dynamically from the class `Entity` |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
16 |
(`cubciweb.common.entity`). We define a sub-class to add methods or to |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
17 |
specialize the handling of a given entity type |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
18 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
19 |
Descriptors are added when classes are registered in order to initialize the class |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
20 |
according to its schema: |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
21 |
|
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
22 |
* we can access the defined attributes in the schema thanks the attributes of |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
23 |
the same name on instances (typed value) |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
24 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
25 |
* we can access the defined relations in the schema thanks to the relations of |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
26 |
the same name on instances (entities instances list) |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
27 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
28 |
The methods defined for `AnyEntity` or `Entity` are the following ones: |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
29 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
30 |
* `has_eid()`, returns true is the entity has an definitive eid (e.g. not in the |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
31 |
creation process) |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
32 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
33 |
* `check_perm(action)`, checks if the user has the permission to execcute the |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
34 |
requested action on the entity |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
35 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
36 |
:Formatting and output generation: |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
37 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
38 |
* `view(vid, **kwargs)`, apply the given view to the entity |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
39 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
40 |
* `absolute_url(**kwargs)`, returns an absolute URL to access the primary view |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
41 |
of an entity |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
42 |
|
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
43 |
* `rest_path()`, returns a relative REST URL to get the entity |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
44 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
45 |
* `format(attr)`, returns the format (MIME type) of the field given un parameter |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
46 |
|
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
47 |
* `printable_value(attr, value=_marker, attrtype=None, format='text/html')`, |
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
48 |
returns a string enabling the display of an attribute value in a given format |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
49 |
(the value is automatically recovered if necessarry) |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
50 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
51 |
* `display_name(form='')`, returns a string to display the entity type by |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
52 |
specifying the preferred form (`plural` for a plural form) |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
53 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
54 |
:Data handling: |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
55 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
56 |
* `as_rset()`, converts the entity into an equivalent result set simulating the |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
57 |
request `Any X WHERE X eid _eid_` |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
58 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
59 |
* `complete(skip_bytes=True)`, executes a request that recovers in one time |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
60 |
all the missing attributes of an entity |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
61 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
62 |
* `get_value(name)`, returns the value associated to the attribute name given |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
63 |
in parameter |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
64 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
65 |
* `related(rtype, x='subject', limit=None, entities=False)`, returns a list |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
66 |
of entities related to the current entity by the relation given in parameter |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
67 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
68 |
* `unrelated(rtype, targettype, x='subject', limit=None)`, returns a result set |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
69 |
corresponding to the entities not related to the current entity by the |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
70 |
relation given in parameter and satisfying its constraints |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
71 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
72 |
* `set_attributes(**kwargs)`, updates the attributes list with the corresponding |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
73 |
values given named parameters |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
74 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
75 |
* `copy_relations(ceid)`, copies the relations of the entities having the eid |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
76 |
given in the parameters on the current entity |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
77 |
|
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
78 |
* `last_modified(view)`, returns the date the object has been modified |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
79 |
(used by HTTP cache handling) |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
80 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
81 |
* `delete()` allows to delete the entity |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
82 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
83 |
:Standard meta-data (Dublin Core): |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
84 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
85 |
* `dc_title()`, returns a unicode string corresponding to the meta-data |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
86 |
`Title` (used by default the first attribute non-meta of the entity |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
87 |
schema) |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
88 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
89 |
* `dc_long_title()`, same as dc_title but can return a more |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
90 |
detailled title |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
91 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
92 |
* `dc_description(format='text/plain')`, returns a unicode string |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
93 |
corresponding to the meta-data `Description` (look for a description |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
94 |
attribute by default) |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
95 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
96 |
* `dc_authors()`, returns a unicode string corresponding to the meta-data |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
97 |
`Authors` (owners by default) |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
98 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
99 |
* `dc_date(date_format=None)`, returns a unicode string corresponding to |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
100 |
the meta-data `Date` (update date by default) |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
101 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
102 |
:Vocabulary control on relations: |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
103 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
104 |
* `vocabulary(rtype, x='subject', limit=None)`, called by the |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
105 |
editing views, it returns a list of couples (label, eid) of entities |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
106 |
that could be related to the entity by the relation `rtype` |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
107 |
* `subject_relation_vocabulary(rtype, limit=None)`, called internally |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
108 |
by `vocabulary` in the case of a subject relation |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
109 |
* `object_relation_vocabulary(rtype, limit=None)`, called internally |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
110 |
by `vocabulary` in the case of an object relation |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
111 |
* `relation_vocabulary(rtype, targettype, x, limit=None)`, called |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
112 |
internally by `subject_relation_vocabulary` and `object_relation_vocabulary` |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
113 |
|
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
114 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
115 |
*rtags* |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
116 |
------- |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
117 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
118 |
*rtags* allows to specify certain behaviors of relations relative to a given |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
119 |
entity type (see later). They are defined on the entity class by the attribute |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
120 |
`rtags` which is a dictionnary with as its keys the triplet :: |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
121 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
122 |
<relation type>, <target entity type>, <context position ("subject" ou "object")> |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
123 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
124 |
and as the values a `set` or a tuple of markers defining the properties that |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
125 |
apply to this relation. |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
126 |
|
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
127 |
It is possible to simplify this dictionnary: |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
128 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
129 |
* if we want to specifiy a single marker, it is not necessarry to |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
130 |
use a tuple as the value, the marker by itself (characters string) |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
131 |
is enough |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
132 |
* if we only care about a single type of relation and not about the target |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
133 |
and the context position (or when this one is not ambigous), we can simply |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
134 |
use the name of the relation type as the key |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
135 |
* if we want a marker to apply independently from the target entity type, |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
136 |
we have to use the string `*` as the target entity type |
93
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
137 |
|
9c919a47e140
[doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff
changeset
|
138 |
|
130
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
139 |
Please note that this dictionnary is *treated at the time the class is created*. |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
140 |
It is automatically merged with the parent class(es) (no need to copy the |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
141 |
dictionnary from the parent class to modify it). Also, modify it after the |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
142 |
class is created will not have any effect... |
213f07dffde3
[doc] Translation to english.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents:
127
diff
changeset
|
143 |
|
127
ae611743f5c6
[doc] divided book in parts
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
113
diff
changeset
|
144 |
.. include:: B051-define-entities.en.txt |