Please note: this project is inactive since early 2006
Subsections

 
2.4.7.3 RToMany

RToOne objects describe a to-many relationship from an Entity to another. It derives from Relationship and overrides the following defaults:

Prop.  Type  Default  Comment 
name string no default The name is the only mandatory arguments when instanciating a APrimaryKey. Once set, it should not be changed
multiplicity sequence [0, None] None means unconstrained: no upper limit
joinSemantic int 0 see 2.4.7 for possible values

(All other defaults are BaseRelationship's ones, cf.2.4.7)

Minimally, a RToMany needs a name and a the name of the destination entity, destination.

2.4.7.3.1 Source and destination attributes

 

Attributes src and dst, identifying source and destination attributes, are automatically calculated if they are not supplied. The rules are the same than the ones given above for RToOne, you just need to swap name 'src'/''source'' and 'dst'/''destination'' in the above explanation.

As an example, suppose you have a pymodel declaring such a RToMany:

    self.model.entities = [
      Entity('Store',
             properties=[RToMany('toEmployees','Employee')]
             ),
      # ...
      ]

RToMany then automatically binds 'src' to the source entity 'Store' 's primary key, and creates a AForeignKey named 'fkStore' in the destination entity 'Employee' (unless such a property -either an attribute or a relationship- already exists with this name, in which case it uses the first unused name among 'fkStore1', 'fkStore2', etc.

You'll also want to read the section 2.4.7 for a complete explanation on how automatic binding/generation of APrimaryKey/AForeignKey is handled when two relationships are inverse of each other.

Comments are welcome: Sebastien Bigaret / Modeling Home Page
Hosted by:SourceForge.net Logo