test/data/rewrite/schema.py
author Julien Cristau <julien.cristau@logilab.fr>
Wed, 30 Sep 2015 18:28:31 +0200
changeset 10742 8be1204cabdb
parent 9953 643b19d79e4a
permissions -rw-r--r--
[web] unicode → six.text_type
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9953
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
     1
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
     2
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
     3
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
     4
# This file is part of CubicWeb.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
     5
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
     9
# any later version.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
    10
#
5424
8ecbcbff9777 replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5421
diff changeset
    11
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
5421
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
    14
# details.
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
    15
#
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
8167de96c523 proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 4907
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
9953
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    18
from yams.buildobjs import (EntityType, RelationDefinition, String, SubjectRelation,
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    19
                            ComputedRelation, Int)
3240
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    20
from cubicweb.schema import ERQLExpression
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    21
9953
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    22
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    23
class Person(EntityType):
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    24
    name = String()
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    25
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    26
3240
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    27
class Affaire(EntityType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3420
diff changeset
    28
    __permissions__ = {
3240
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    29
        'read':   ('managers',
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    30
                   ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')),
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    31
        'add':    ('managers', ERQLExpression('X concerne S, S owned_by U')),
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    32
        'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')),
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    33
        'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')),
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    34
        }
3420
15f17399bda2 [tests] use maxsize instead of SizeConstraint
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 3240
diff changeset
    35
    ref = String(fulltextindexed=True, indexed=True, maxsize=16)
7555
c3bf459268d7 [rqlrewrite] closes #1772135: 1. don't try to reuse a relation from another statement (eg because a subquery has been introduced) 2. _use_orig_term should consider the current statement
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6337
diff changeset
    36
    documented_by = SubjectRelation('Card', cardinality='1*')
c3bf459268d7 [rqlrewrite] closes #1772135: 1. don't try to reuse a relation from another statement (eg because a subquery has been introduced) 2. _use_orig_term should consider the current statement
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6337
diff changeset
    37
    concerne = SubjectRelation(('Societe', 'Note'), cardinality='1*')
3240
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    38
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    39
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    40
class Societe(EntityType):
3877
7ca53fc72a0a reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3420
diff changeset
    41
    __permissions__ = {
3240
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    42
        'read': ('managers', 'users', 'guests'),
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    43
        'update': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    44
        'delete': ('managers', 'owners', ERQLExpression('U login L, X nom L')),
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    45
        'add': ('managers', 'users',)
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    46
        }
9189
9448215c73c4 [rqlrewrite] fix rqlrewrite unpredictability vs relation sharing. Closes #3036144
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7843
diff changeset
    47
    nom = String()
3240
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    48
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    49
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    50
class Division(Societe):
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    51
    __specializes_schema__ = True
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    52
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    53
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    54
class Note(EntityType):
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    55
    pass
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    56
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    57
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    58
class require_permission(RelationDefinition):
6337
6686ca1826a9 stop relying on person cube, it isn't needed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 5424
diff changeset
    59
    subject = ('Card', 'Note')
3240
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    60
    object = 'CWPermission'
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    61
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    62
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    63
class require_state(RelationDefinition):
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    64
    subject = 'CWPermission'
8604a15995d1 refactor so that rql rewriter may be used outside the server. Enhance it to be usable for RRQLExpression as well
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    65
    object = 'State'
4907
e623afd49356 [rql rewriting] handle case where we've and optional inlined relation in the original query. Also, we should append EXISTS even in subquery to avoid inserting duplicates in results
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3877
diff changeset
    66
e623afd49356 [rql rewriting] handle case where we've and optional inlined relation in the original query. Also, we should append EXISTS even in subquery to avoid inserting duplicates in results
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3877
diff changeset
    67
e623afd49356 [rql rewriting] handle case where we've and optional inlined relation in the original query. Also, we should append EXISTS even in subquery to avoid inserting duplicates in results
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3877
diff changeset
    68
class inlined_card(RelationDefinition):
e623afd49356 [rql rewriting] handle case where we've and optional inlined relation in the original query. Also, we should append EXISTS even in subquery to avoid inserting duplicates in results
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3877
diff changeset
    69
    subject = 'Affaire'
e623afd49356 [rql rewriting] handle case where we've and optional inlined relation in the original query. Also, we should append EXISTS even in subquery to avoid inserting duplicates in results
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3877
diff changeset
    70
    object = 'Card'
e623afd49356 [rql rewriting] handle case where we've and optional inlined relation in the original query. Also, we should append EXISTS even in subquery to avoid inserting duplicates in results
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3877
diff changeset
    71
    inlined = True
e623afd49356 [rql rewriting] handle case where we've and optional inlined relation in the original query. Also, we should append EXISTS even in subquery to avoid inserting duplicates in results
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 3877
diff changeset
    72
    cardinality = '?*'
7843
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    73
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    74
class inlined_note(RelationDefinition):
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    75
    subject = 'Card'
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    76
    object = 'Note'
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    77
    inlined = True
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    78
    cardinality = '?*'
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    79
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    80
class inlined_affaire(RelationDefinition):
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    81
    subject = 'Note'
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    82
    object = 'Affaire'
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    83
    inlined = True
3b51806da60b [rqlrewrite] if inlined relation has to be moved to a subquery, take care of the object of the relation (closes #1945725)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7555
diff changeset
    84
    cardinality = '?*'
9189
9448215c73c4 [rqlrewrite] fix rqlrewrite unpredictability vs relation sharing. Closes #3036144
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7843
diff changeset
    85
9448215c73c4 [rqlrewrite] fix rqlrewrite unpredictability vs relation sharing. Closes #3036144
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7843
diff changeset
    86
class responsable(RelationDefinition):
9448215c73c4 [rqlrewrite] fix rqlrewrite unpredictability vs relation sharing. Closes #3036144
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7843
diff changeset
    87
    subject = 'Societe'
9448215c73c4 [rqlrewrite] fix rqlrewrite unpredictability vs relation sharing. Closes #3036144
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7843
diff changeset
    88
    object = 'CWUser'
9448215c73c4 [rqlrewrite] fix rqlrewrite unpredictability vs relation sharing. Closes #3036144
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7843
diff changeset
    89
    inlined = True
9448215c73c4 [rqlrewrite] fix rqlrewrite unpredictability vs relation sharing. Closes #3036144
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7843
diff changeset
    90
    cardinality = '1*'
9953
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    91
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    92
class Contribution(EntityType):
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    93
    code = Int()
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    94
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    95
class ArtWork(EntityType):
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    96
    name = String()
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    97
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    98
class Role(EntityType):
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
    99
    name = String()
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   100
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   101
class contributor(RelationDefinition):
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   102
    subject = 'Contribution'
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   103
    object = 'Person'
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   104
    cardinality = '1*'
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   105
    inlined = True
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   106
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   107
class manifestation(RelationDefinition):
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   108
    subject = 'Contribution'
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   109
    object = 'ArtWork'
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   110
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   111
class role(RelationDefinition):
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   112
    subject = 'Contribution'
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   113
    object = 'Role'
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   114
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   115
class illustrator_of(ComputedRelation):
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   116
    rule = ('C is Contribution, C contributor S, C manifestation O, '
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   117
            'C role R, R name "illustrator"')
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   118
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   119
class participated_in(ComputedRelation):
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   120
    rule = 'S contributor O'
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   121
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   122
class match(RelationDefinition):
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   123
    subject = 'ArtWork'
643b19d79e4a [CWEP002] introduce RQLRelationRewriter
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 9189
diff changeset
   124
    object = 'Note'