doc/tutorials/advanced/part01_create-cube.rst
changeset 12403 d901fc62eb01
parent 12402 e4da2575ac37
child 12530 9d88e1177c35
equal deleted inserted replaced
12402:e4da2575ac37 12403:d901fc62eb01
    70 
    70 
    71   .. sourcecode:: python
    71   .. sourcecode:: python
    72 
    72 
    73     __depends__ = {'cubicweb': '>= 3.26.7',
    73     __depends__ = {'cubicweb': '>= 3.26.7',
    74                    'cubicweb-file': '>= 1.9.0',
    74                    'cubicweb-file': '>= 1.9.0',
    75 		   'cubicweb-folder': '>= 1.1.0',
    75                    'cubicweb-folder': '>= 1.1.0',
    76 		   'cubicweb-person': '>= 1.2.0',
    76                    'cubicweb-person': '>= 1.2.0',
    77 		   'cubicweb-comment': '>= 1.2.0',
    77                    'cubicweb-comment': '>= 1.2.0',
    78 		   'cubicweb-tag': '>= 1.2.0',
    78                    'cubicweb-tag': '>= 1.2.0',
    79 		   'cubicweb-zone': None}
    79                    'cubicweb-zone': None}
    80 
    80 
    81 Notice that you can express minimal version of the cube that should be used,
    81 Notice that you can express minimal version of the cube that should be used,
    82 `None` meaning whatever version available. All packages starting with 'cubicweb-'
    82 `None` meaning whatever version available. All packages starting with 'cubicweb-'
    83 will be recognized as being cube, not bare python packages.
    83 will be recognized as being cube, not bare python packages.
    84 
    84 
   100 
   100 
   101 .. sourcecode:: python
   101 .. sourcecode:: python
   102 
   102 
   103     from yams.buildobjs import RelationDefinition
   103     from yams.buildobjs import RelationDefinition
   104 
   104 
       
   105 
   105     class comments(RelationDefinition):
   106     class comments(RelationDefinition):
   106 	subject = 'Comment'
   107         subject = 'Comment'
   107 	object = 'File'
   108         object = 'File'
   108 	cardinality = '1*'
   109         # a Comment can be on only one File
   109 	composite = 'object'
   110         # but a File can have several comments
       
   111         cardinality = '1*'
       
   112         composite = 'object'
       
   113 
   110 
   114 
   111     class tags(RelationDefinition):
   115     class tags(RelationDefinition):
   112 	subject = 'Tag'
   116         subject = 'Tag'
   113 	object = 'File'
   117         object = 'File'
       
   118 
   114 
   119 
   115     class filed_under(RelationDefinition):
   120     class filed_under(RelationDefinition):
   116 	subject = 'File'
   121         subject = 'File'
   117 	object = 'Folder'
   122         object = 'Folder'
       
   123 
   118 
   124 
   119     class situated_in(RelationDefinition):
   125     class situated_in(RelationDefinition):
   120 	subject = 'File'
   126         subject = 'File'
   121 	object = 'Zone'
   127         object = 'Zone'
       
   128 
   122 
   129 
   123     class displayed_on(RelationDefinition):
   130     class displayed_on(RelationDefinition):
   124 	subject = 'Person'
   131         subject = 'Person'
   125 	object = 'File'
   132         object = 'File'
   126 
   133 
   127 
   134 
   128 This schema:
   135 This schema:
   129 
   136 
   130 * allows to comment and tag on `File` entity type by adding the `comments` and
   137 * allows to comment and tag on `File` entity type by adding the `comments` and