Creating relationships

There are three diferent types of relationships
  • One to Many (1:M)
  • Many to One (M:1)
  • Many to Many (M:M)
One to many and many to one relationships are denoted with the keywords "parent" and "child". Every child entity in a relationship has exactly one parent and all parent entities in a relationship can have multiple children. The keyword "sibling" is reserved for M:M relationships, both entities must have a corresponding sibling relationship with the other.
1:M relationship:
family Relationships 
{ 
     entity A 
     { 
          field id int Aid; 
          relationship BList with B on Aid as child; 
     } 
     entity B 
     { 
          field id int Bid; 
          field int Aid; 
     } 
}
M:1 relationship:
family Relationships 
{ 
     entity A 
     { 
          field id int Aid; 
     } 
     entity B 
     { 
          field id int Bid; 
          field int Aid; 
          relationship A with A on Aid as parent; 
     } 
}
1:M and M:1 relationship:
family Relationships 
{ 
     entity A 
     { 
          field id int Aid; 
          relationship BList with B on Aid as child; 
     } 
     entity B 
     { 
          field id int Bid; 
          field int Aid; 
          relationship A with A on Aid as parent; 
     } 
}
M:M relationship:
family Relationships 
{ 
     entity A 
     { 
          field id int Aid; 
          relationship BList with B as sibling; 
     } 
     entity B 
     { 
          field id int Bid;
          relationship AList with A as sibling; 
     } 
}

Next: Creating rules

Last edited Oct 20, 2006 at 4:29 PM by justinc, version 5

Comments

No comments yet.