class AchatFabrication(EntityType): date_achat = Date() quantite = Int() quantite_plusieurs = Boolean(default=False, required=True, description='True if quantite is "plusieurs"') parure = SubjectRelation('Parure', cardinality='1*', inlined=True) avec_mat = SubjectRelation('FabriqueAvecMat', cardinality='*1') remarques = RichString(fulltextindexed=True, default_format='text/rest')
class Ticket(EntityType): title = String(maxsize=32, required=True, fulltextindexed=True) concerns = SubjectRelation('Project', composite='object') in_version = SubjectRelation('Version', composite='object', cardinality='?*', inlined=True)
class Note(WorkflowableEntityType): date = String(maxsize=10) type = String(vocabulary=[u'todo', u'a', u'b', u'T', u'lalala']) para = String(maxsize=512, __permissions__={ 'add': ('managers', ERQLExpression('X in_state S, S name "todo"')), 'read': ('managers', 'users', 'guests'), 'update': ('managers', ERQLExpression('X in_state S, S name "todo"')), }) something = String(maxsize=1, __permissions__={ 'read': ('managers', 'users', 'guests'), 'add': (ERQLExpression('NOT X para NULL'), ), 'update': ('managers', 'owners') }) migrated_from = SubjectRelation('Note') attachment = SubjectRelation('File') inline1 = SubjectRelation('Affaire', inlined=True, cardinality='?*', constraints=[ RQLUniqueConstraint( 'S type T, S inline1 A1, A1 todo_by C, ' 'Y type T, Y inline1 A2, A2 todo_by C', 'S,Y') ]) todo_by = SubjectRelation('CWUser')
class Right(EntityType): # defines structure top_from_right = SubjectRelation('Diamond', composite='object', cardinality='1?', inlined=True) # in-container rtype to_inner_left = SubjectRelation('Left') loop_in_place = SubjectRelation('Right')
class Personne(EntityType): __permissions__ = { 'read': ('managers', 'users', 'guests'), # 'guests' will be removed 'add': ('managers', 'users'), 'update': ('managers', 'owners'), 'delete': ('managers', 'owners') } __unique_together__ = [('nom', 'prenom', 'inline2')] nom = String(fulltextindexed=True, required=True, maxsize=64) prenom = String(fulltextindexed=True, maxsize=64) sexe = String(maxsize=1, default='M', fulltextindexed=True) promo = String(vocabulary=('bon', 'pasbon')) titre = String(fulltextindexed=True, maxsize=128) adel = String(maxsize=128) ass = String(maxsize=128) web = String(maxsize=128) tel = Int() fax = Int() datenaiss = Datetime() tzdatenaiss = TZDatetime() test = Boolean( __permissions__={ 'read': ('managers', 'users', 'guests'), 'add': ('managers', ), 'update': ('managers', ), }) description = String() firstname = String(fulltextindexed=True, maxsize=64) concerne = SubjectRelation('Affaire') connait = SubjectRelation('Personne') inline2 = SubjectRelation('Affaire', inlined=True, cardinality='?*')
class CWRelation(EntityType): """define a non final relation: link a non final relation type from a non final entity to a non final entity type. used to build the instance schema """ __permissions__ = PUB_SYSTEM_ENTITY_PERMS relation_type = SubjectRelation('CWRType', cardinality='1*', constraints=[RQLConstraint('O final FALSE')], composite='object') from_entity = SubjectRelation('CWEType', cardinality='1*', constraints=[RQLConstraint('O final FALSE')], composite='object') to_entity = SubjectRelation('CWEType', cardinality='1*', constraints=[RQLConstraint('O final FALSE')], composite='object') constrained_by = SubjectRelation('CWConstraint', cardinality='*1', composite='subject') cardinality = String(maxsize=2, internationalizable=True, vocabulary=CARDINALITY_VOCAB, description=_('subject/object cardinality')) ordernum = Int(description=_('control subject entity\'s relations order'), default=0) composite = String(description=_('is the subject/object entity of the relation ' 'composed of the other ? This implies that when ' 'the composite is deleted, composants are also ' 'deleted.'), vocabulary=('', _('subject'), _('object')), maxsize=8, default=None) description = RichString(internationalizable=True, description=_('semantic description of this relation'))
class CWAttribute(EntityType): """define a final relation: link a final relation type from a non final entity to a final entity type. used to build the instance schema """ __permissions__ = PUB_SYSTEM_ENTITY_PERMS relation_type = SubjectRelation('CWRType', cardinality='1*', constraints=[RQLConstraint('O final TRUE')], composite='object') from_entity = SubjectRelation('CWEType', cardinality='1*', constraints=[RQLConstraint('O final FALSE')], composite='object') to_entity = SubjectRelation('CWEType', cardinality='1*', constraints=[RQLConstraint('O final TRUE')], composite='object') constrained_by = SubjectRelation('CWConstraint', cardinality='*1', composite='subject') cardinality = String(maxsize=2, internationalizable=True, vocabulary=[_('?1'), _('11')], description=_('subject/object cardinality')) ordernum = Int(description=('control subject entity\'s relations order'), default=0) formula = String(maxsize=2048) indexed = Boolean(description=_('create an index for quick search on this attribute')) fulltextindexed = Boolean(description=_('index this attribute\'s value in the plain text index')) internationalizable = Boolean(description=_('is this attribute\'s value translatable')) defaultval = Bytes(description=_('default value as gziped pickled python object')) extra_props = Bytes(description=_('additional type specific properties')) description = RichString(internationalizable=True, description=_('semantic description of this attribute'))
class State(EntityType): """used to associate simple states to an entity type and/or to define workflows """ __permissions__ = PUB_SYSTEM_ENTITY_PERMS __unique_together__ = [('name', 'state_of')] name = String(required=True, indexed=True, internationalizable=True, maxsize=256) description = RichString( default_format='text/rest', description=_('semantic description of this state')) # XXX should be on BaseTransition w/ AND/OR selectors when we will # implements #345274 allowed_transition = SubjectRelation( 'BaseTransition', cardinality='**', constraints=[ RQLConstraint( 'S state_of WF, O transition_of WF', msg=_( 'state and transition don\'t belong the the same workflow') ) ], description=_('allowed transitions from this state')) state_of = SubjectRelation( 'Workflow', cardinality='1*', composite='object', inlined=True, description=_('workflow to which this state belongs'))
class Person(EntityType): __unique_together__ = [('nom', 'prenom')] nom = String(maxsize=64, fulltextindexed=True, required=True) prenom = String(maxsize=64, fulltextindexed=True) sexe = String(maxsize=1, default='M') promo = String(vocabulary=('bon', 'pasbon')) titre = String(maxsize=128, fulltextindexed=True) adel = String(maxsize=128) ass = String(maxsize=128) web = String(maxsize=128) tel = Int(__permissions__={ 'read': (), 'add': ('managers', ), 'update': ('managers', ) }) fax = Int() datenaiss = Date() test = Boolean() salary = Float() travaille = SubjectRelation('Societe', __permissions__={ 'read': (), 'add': (), 'delete': ('managers', ), }) evaluee = SubjectRelation('Note')
class State(EntityType): """used to associate simple states to an entity type and/or to define workflows """ __permissions__ = { 'read': ( 'managers', 'users', 'guests', ), 'add': ( 'managers', 'users', ), 'delete': ( 'managers', 'owners', ), 'update': ( 'managers', 'owners', ), } # attributes eid = Int(required=True, uid=True) name = String(required=True, indexed=True, internationalizable=True, constraints=[SizeConstraint(256)]) description = String(fulltextindexed=True) # relations state_of = SubjectRelation('Eetype', cardinality='+*') next_state = SubjectRelation('State', cardinality='**')
class Workflow(EntityType): __permissions__ = PUB_SYSTEM_ENTITY_PERMS name = String(required=True, indexed=True, internationalizable=True, maxsize=256) description = RichString( default_format='text/rest', description=_('semantic description of this workflow')) workflow_of = SubjectRelation( 'CWEType', cardinality='+*', description=_('entity types which may use this workflow'), constraints=[RQLConstraint('O final FALSE')]) initial_state = SubjectRelation( 'State', cardinality='?*', constraints=[ RQLConstraint('O state_of S', msg=_('state doesn\'t belong to this workflow')) ], description=_('initial state for this workflow'))
class SubWorkflowExitPoint(EntityType): """define how we get out from a sub-workflow""" subworkflow_state = SubjectRelation( 'State', cardinality='1*', constraints=[ RQLConstraint( 'T subworkflow_exit S, T subworkflow WF, O state_of WF', msg=_('exit state must be a subworkflow state')) ], description=_('subworkflow state')) destination_state = SubjectRelation( 'State', cardinality='?*', constraints=[ RQLConstraint( 'T subworkflow_exit S, T transition_of WF, O state_of WF', msg= _('destination state must be in the same workflow as our parent transition' )) ], description=_( 'destination state. No destination state means that transition ' 'should go back to the state from which we\'ve entered the ' 'subworkflow.'))
class Affaire(WorkflowableEntityType): __permissions__ = { 'read': ('managers', ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')), 'add': ('managers', ERQLExpression('X concerne S, S owned_by U')), 'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')), 'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')), } ref = String(fulltextindexed=True, indexed=True, constraints=[SizeConstraint(16)]) sujet = String(fulltextindexed=True, constraints=[SizeConstraint(256)]) descr = RichString(fulltextindexed=True, description=_('more detailed description')) duration = Int() invoiced = Float() opt_attr = Bytes() depends_on = SubjectRelation('Affaire') require_permission = SubjectRelation('CWPermission') concerne = SubjectRelation(('Societe', 'Note')) todo_by = SubjectRelation('Personne', cardinality='?*') documented_by = SubjectRelation('Card')
class Personne(EntityType): __permissions__ = { 'read': ('managers', 'users'), # 'guests' was removed 'add': ('managers', 'users'), 'update': ('managers', 'owners'), 'delete': ('managers', 'owners') } __unique_together__ = [('nom', 'prenom', 'datenaiss')] nom = String(fulltextindexed=True, required=True, maxsize=64) prenom = String(fulltextindexed=True, maxsize=64) civility = String(maxsize=1, default='M', fulltextindexed=True) promo = String(vocabulary=('bon','pasbon', 'pasbondutout')) titre = String(fulltextindexed=True, maxsize=128) adel = String(maxsize=128) ass = String(maxsize=128) web = String(maxsize=128) tel = Int() fax = Int() datenaiss = Datetime() test = Boolean() travaille = SubjectRelation('Societe') concerne = SubjectRelation('Affaire') concerne2 = SubjectRelation(('Affaire', 'Note'), cardinality='1*') connait = SubjectRelation('Personne', symmetric=True)
class Gene(EntityType): """Gene entity defintion. A gene is characterized by the following attributes: - label, defined through a Yams String. - bio2rdf_symbol, also defined as a Yams String, since it is just an identifier. - gene_id is a URI identifying a gene, hence it is defined as a relation with an ``ExternalUri`` object. - a pair of unique identifiers in the HUGO Gene Nomenclature Committee (http://http://www.genenames.org/). They are defined as ``ExternalUri`` entities as well. - same_as is also defined through a URI, and hence through a relation having ``ExternalUri`` entities as objects. """ # Corresponds to http://www.w3.org/2000/01/rdf-schema#label label = String(maxsize=512, fulltextindexed=True) # Corresponds to http://www4.wiwiss.fu-berlin.de/diseasome/resource/ # diseasome/geneId gene_id = SubjectRelation('ExternalUri', cardinality='**') # Corresponds to http://www4.wiwiss.fu-berlin.de/diseasome/resource/ # diseasome/hgncId hgnc_id = SubjectRelation('ExternalUri', cardinality='**') # Corresponds to http://www4.wiwiss.fu-berlin.de/diseasome/resource/ # diseasome/hgncIdPage hgnc_page = SubjectRelation('ExternalUri', cardinality='**') # Corresponds to http://www4.wiwiss.fu-berlin.de/diseasome/resource/ # diseasome/bio2rdfSymbol bio2rdf_symbol = String(maxsize=64, fulltextindexed=True) #Corresponds to http://www.w3.org/2002/07/owl#sameAs same_as = SubjectRelation('ExternalUri', cardinality='**')
class Personne(EntityType): nom = String(required=True) prenom = String() enfant = SubjectRelation('Personne', inlined=True, cardinality='?*') connait = SubjectRelation('Personne', symmetric=True, constraints=[RQLConstraint('NOT S identity O')]) photo = Bytes()
class Affaire(EntityType): sujet = String(maxsize=128) ref = String(maxsize=12) concerne = SubjectRelation('Societe') obj_wildcard = SubjectRelation('*') sym_rel = SubjectRelation('Person', symmetric=True) inline_rel = SubjectRelation('Person', inlined=True, cardinality='?*')
class Folder(EntityType): __unique_together__ = [('name', 'parent')] name = String(required=True) parent = SubjectRelation('Folder', inlined=True, cardinality='?*', composite='object') element = SubjectRelation('XFile', composite='subject')
class School(EntityType): """an (high) school""" name = String(required=True, fulltextindexed=True, maxsize=128) address = String(maxsize=512) description = String(fulltextindexed=True) phone = SubjectRelation('PhoneNumber', composite='subject') use_email = SubjectRelation('EmailAddress', composite='subject')
class Occupation(EntityType): libelle = String(maxsize=255, fulltextindexed=True) valeur = String(maxsize=255, fulltextindexed=True) compte = SubjectRelation('Compte', cardinality='?*') annee = Int() pagination = String(maxsize=64, fulltextindexed=True) rattache_a = SubjectRelation('Personne', cardinality='?*') occupation = String(maxsize=255, fulltextindexed=True) personne = SubjectRelation('Personne', cardinality = '?*', composite='subject', inlined=True)
class Patch(EntityType): name = String(required=True, maxsize=64) content = SubjectRelation('XFile', cardinality='1*', inlined=True, __permissions__=PERM('patch-content')) implements = SubjectRelation('Ticket', cardinality='1*', composite='object', inlined=True)
class CWUniqueTogetherConstraint(EntityType): """defines a sql-level multicolumn unique index""" __permissions__ = PUB_SYSTEM_ENTITY_PERMS name = String(required=True, unique=True, maxsize=64) constraint_of = SubjectRelation('CWEType', cardinality='1*', composite='object', inlined=True) relations = SubjectRelation('CWRType', cardinality='+*', constraints=[RQLConstraint( 'S constraint_of ET, RDEF relation_type O, RDEF from_entity ET, ' 'O final TRUE OR (O final FALSE AND O inlined TRUE)')])
class Ticket(EntityType): name = String(required=True, maxsize=64) description = String(required=True) concerns = SubjectRelation('Project', cardinality='1*', composite='object', inlined=True) done_in_version = SubjectRelation('Version', cardinality='?*', inlined=True)
class Project(EntityType): __permissions__ = PERM('project') name = String(required=True) documented_by = SubjectRelation( 'XFile', cardinality='*?', __permissions__=PERM('project-documentation'), composite='subject') canread = SubjectRelation('CWUser') canwrite = SubjectRelation('CWUser')
class Affaire(EntityType): __permissions__ = { 'read': ('managers', ERQLExpression('X owned_by U'), ERQLExpression('X concerne S?, S owned_by U')), 'add': ('managers', ERQLExpression('X concerne S, S owned_by U')), 'update': ('managers', 'owners', ERQLExpression('X in_state S, S name in ("pitetre", "en cours")')), 'delete': ('managers', 'owners', ERQLExpression('X concerne S, S owned_by U')), } ref = String(fulltextindexed=True, indexed=True, maxsize=16) documented_by = SubjectRelation('Card', cardinality='1*') concerne = SubjectRelation(('Societe', 'Note'), cardinality='1*')
class Ticket(EntityType): name = String(required=True, maxsize=64) description = String(required=True) done_in_version = SubjectRelation('Version', cardinality='?*', composite='object', inlined=True) documented_by = SubjectRelation( 'XFile', cardinality='*?', composite='subject', __permissions__=PERM('ticket-documentation'))
class CWSearch(EntityType): """ An entity used to save a search which may contains resources on the server file system. Attributes ---------- title: String (mandatory) a short description of the file. path: String (mandatory) the rql request that will be saved. expiration_data: Date (mandatory) the expiration date of the current search. result: SubjectRelation (mandatory) a json file with all the server resources associated with the current search - {"rql": rql, "files": [], "nonexistent-files": []} rset: SubjectRelation (mandatory) the result set associated with the current search. rset_type: String (optional, default 'jsonexport') the type of the rset. """ __permissions__ = { "read": ( "managers", ERQLExpression("X owned_by U"), ), "add": ("managers", "users"), "delete": ("managers", "owners"), "update": ("managers", "owners"), } title = String(maxsize=256, required=True, constraints=[ RQLUniqueConstraint( "X title N, S title N, X owned_by U, X is CWSearch", mainvars="X", msg=_("this name is already used")) ], description=_("Please set a unique subset name.")) path = String(required=True, description=_("the rql request we will save (do not edit " "this field).")) expiration_date = Date(required=True, indexed=True) # json which contains resultset and filepath result = SubjectRelation("File", cardinality="1*", inlined=True, composite="subject") rset = SubjectRelation("File", cardinality="1*", inlined=True, composite="subject") # view regid to show rset rset_type = String(required=True, default="jsonexport", maxsize=50)
class Travail(EntityType): artisan = SubjectRelation('Personne', cardinality='1*', composite='object', inlined=True) salaire_argent = SubjectRelation('Prix', cardinality='??', inlined=True, composite='subject') salaire_nature_qt = Int() salaire_nature_obj = String(maxsize=64, fulltextindexed=True) nombre_aides = Int() designation_aides = String(maxsize=64, fulltextindexed=True) salaire_aides = SubjectRelation('Prix', cardinality='??', inlined=True, composite='subject') tache = String(maxsize=255, fulltextindexed=True) duree = Int() date_travail = Date() remarques = RichString(fulltextindexed=True, default_format='text/rest') facon_et_etoffe = Boolean(default=False, required=True)
class Transaction(EntityType): date = Date() type_achat = String(maxsize=2) # a virer ? pagination = String(maxsize=255, fulltextindexed=True) date_ordre = Date() date_recette = Date() remarques = RichString(fulltextindexed=True, default_format='text/rest') intervenants = SubjectRelation('Intervenant', composite='subject', cardinality='*1') destinataires = SubjectRelation('Destinataire', composite='subject', cardinality='*1') travaux = SubjectRelation('Travail', composite='subject', cardinality='**') vendeurs = SubjectRelation('Vendeur', composite='subject', cardinality='*1') prix_partage = Boolean(required=True, default=False) base_paradox = Boolean(default=False, description='vient de la base Paradox')
class Version(EntityType): __unique_together__ = [('name', 'version_of')] name = String(required=True, maxsize=16) version_of = SubjectRelation('Project', cardinality='1*', composite='object', inlined=True) documented_by = SubjectRelation( 'XFile', cardinality='*?', composite='subject', __permissions__=PERM('version-documentation')) canread = SubjectRelation('CWUser') canwrite = SubjectRelation('CWUser')