Next: , Previous: %confidential, Up: Top


15 Compound Field Names

Please note that the features described in this chapter are very likely to change in the near future. It is thus recommended to not rely on them in your own databases.

It is possible to make a reference to a record (or set of records) of a certain type by using a compound field name. A compound field is composed by three components separated by double colon characters (:):

     TYPE:FIELD[:ROLE]:

The first component is a record type, usually defined somewhere else (see Record Descriptors). The second component is the name of a field. Finally, an optional third component is the role played by the referenced field in the referencing record.

The simplest kind of reference is one without an explicit role. It is used when only one association between records of different types is desired. Consider for example:

     %rec: Maintainer
     
     Name: Jose E. Marchesi
     Package:Name: recutils

In the previous example it is pretty clear which role is played by the referenced package in the Maintainer record: it is the package maintained by the maintainer. But sometimes the role is not that identifiable. Consider for example the following record:

     %rec: Bug
     
     Id: 203
     Title: recsel crashes with files bigger than 2gb
     Hacker:Name: Smitha Johnson

Seems to be a bug report. But, what is the relationship between Smitha Johnson and the bug? Is she the reporter? Or perhaps she is the hacker that is working to fix it? Is she the hacker that closed the bug? We can clarify the role of Smitha by using the third part of the compound field: her role.

     Id: 203
     Title: recsel crashes with files bigger than 2gb
     Hacker:Name:Reporter: Smitha Johnson

So now the situation is clear: Smitha is the reporter.

It is possible to make references to different instances of the same record type by using roles. Supposing that we want to record who is the assignee of the bug report, we can introduce the new role Assignee:

     Id: 203
     Title: recsel crashes with files bigger than 2gb
     Hacker:Name:Reporter: Smitha Johnson
     Hacker:Name:Assignee: Juan Valdes

Note that, like in the case of regular fields, there can be several compound fields with the same name and the same implicit role in a record, like in:

     %rec: Maintainer
     
     Name: Jose E. Marchesi
     Package:Name: GNU PDF
     Package:Name: GNU Ferret
     Package:Name: GNU rec

Same applies to several compound fields with explicit roles:

     %rec: Package
     
     Name: GNU foo
     Hacker:Name:Maintainer: Elvis 'The King' Presley
     Hacker:Name:Maintainer: Michael 'The other King' Jackson