server/test/datacomputed/migratedapp/schema.py
changeset 9969 0f64ef873f7a
parent 9964 f4a3ee05cf9d
child 9971 5e44dd9dde6b
equal deleted inserted replaced
9968:50f046bf0e50 9969:0f64ef873f7a
    14 # details.
    14 # details.
    15 #
    15 #
    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, RelationDefinition, ComputedRelation
    19 from yams.buildobjs import (EntityType, RelationDefinition, ComputedRelation,
       
    20                             Int, Float)
    20 
    21 
    21 
    22 
    22 class Employee(EntityType):
    23 class Employee(EntityType):
    23     pass
    24     pass
    24 
    25 
    36 class works_for(ComputedRelation):
    37 class works_for(ComputedRelation):
    37     rule = 'O employees S, NOT EXISTS (O associates S)'
    38     rule = 'O employees S, NOT EXISTS (O associates S)'
    38 
    39 
    39 
    40 
    40 class Company(EntityType):
    41 class Company(EntityType):
    41     pass
    42     score = Float(formula='Any AVG(NN) WHERE X employees E, N concerns E, N note NN')
    42 
    43 
    43 
    44 
    44 class Note(EntityType):
    45 class Note(EntityType):
    45     pass
    46     note = Int()
    46 
    47 
    47 
    48 
    48 class concerns(RelationDefinition):
    49 class concerns(RelationDefinition):
    49     subject = 'Note'
    50     subject = 'Note'
    50     object = 'Employee'
    51     object = 'Employee'