16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 |
18 |
19 from yams.buildobjs import (EntityType, String, SubjectRelation, |
19 from yams.buildobjs import (EntityType, String, SubjectRelation, |
20 RelationDefinition) |
20 RelationDefinition) |
|
21 |
21 from cubicweb.schema import (WorkflowableEntityType, |
22 from cubicweb.schema import (WorkflowableEntityType, |
22 RQLConstraint, RQLVocabularyConstraint) |
23 RQLConstraint, RQLVocabularyConstraint) |
|
24 |
23 |
25 |
24 class Personne(EntityType): |
26 class Personne(EntityType): |
25 nom = String(required=True) |
27 nom = String(required=True) |
26 prenom = String() |
28 prenom = String() |
27 type = String() |
29 type = String() |
34 # conflicting constraints, see cw_unrelated_rql tests in |
36 # conflicting constraints, see cw_unrelated_rql tests in |
35 # unittest_entity.py |
37 # unittest_entity.py |
36 RQLVocabularyConstraint('NOT (S connait P, P nom "toto")'), |
38 RQLVocabularyConstraint('NOT (S connait P, P nom "toto")'), |
37 RQLVocabularyConstraint('S travaille P, P nom "tutu"')]) |
39 RQLVocabularyConstraint('S travaille P, P nom "tutu"')]) |
38 |
40 |
|
41 |
39 class Societe(EntityType): |
42 class Societe(EntityType): |
40 nom = String() |
43 nom = String() |
41 evaluee = SubjectRelation('Note') |
44 evaluee = SubjectRelation('Note') |
|
45 fournit = SubjectRelation(('Service', 'Produit'), cardinality='1*') |
|
46 |
|
47 |
|
48 class Service(EntityType): |
|
49 fabrique_par = SubjectRelation('Personne', cardinality='1*') |
|
50 |
|
51 |
|
52 class Produit(EntityType): |
|
53 fabrique_par = SubjectRelation('Usine', cardinality='1*') |
|
54 |
|
55 |
|
56 class Usine(EntityType): |
|
57 lieu = String(required=True) |
|
58 |
42 |
59 |
43 class Note(EntityType): |
60 class Note(EntityType): |
44 type = String() |
61 type = String() |
45 ecrit_par = SubjectRelation('Personne') |
62 ecrit_par = SubjectRelation('Personne') |
46 |
63 |
|
64 |
47 class SubNote(Note): |
65 class SubNote(Note): |
48 __specializes_schema__ = True |
66 __specializes_schema__ = True |
49 description = String() |
67 description = String() |
50 |
68 |
|
69 |
51 class tags(RelationDefinition): |
70 class tags(RelationDefinition): |
52 subject = 'Tag' |
71 subject = 'Tag' |
53 object = ('Personne', 'Note') |
72 object = ('Personne', 'Note') |
|
73 |
54 |
74 |
55 class evaluee(RelationDefinition): |
75 class evaluee(RelationDefinition): |
56 subject = 'CWUser' |
76 subject = 'CWUser' |
57 object = 'Note' |
77 object = 'Note' |
58 |
78 |
59 |
79 |
60 class StateFull(WorkflowableEntityType): |
80 class StateFull(WorkflowableEntityType): |
61 name = String() |
81 name = String() |
62 |
|
63 |
|