bug-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-recutils] A new field type?


From: Jose E. Marchesi
Subject: Re: [bug-recutils] A new field type?
Date: Mon, 07 Feb 2011 17:47:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

Hi JF.
    
    I suggest that any record name inside a recfile might be a valid
    field type for other records fields.  The allowed values for such
    fields might only be keys of records of the specified name.  This
    method results in some kind of relational Data Base.

What you are describing is already possible by using compound field
names.

In your example, we can make a Maintenance record to make a reference to
an equipment by using:

/
| %rec: Asset
| %key: tag
| %type: tag regexp /^[0-9]{8}$/
| 
| tag: 01234567
| description: car
| vendor: Henry Ford
| 
| %rec: Maintenance
| 
| Asset:tag:equipment: 01234567
| failureMode: oil leakage
| ...
\

Or, as there is no ambiguity, we can omit the role "equipment":

/
| %rec: Asset
| %key: tag
| %type: tag regexp /^[0-9]{8}$/
| 
| tag: 01234567
| description: car
| vendor: Henry Ford
| 
| %rec: Maintenance
| 
| Asset:tag: 01234567
| failureMode: oil leakage
| ...
\

In those situations, recfix already checks for the type of Asset:tag:,
taking care about the reference.

But recsel still has to be modified to implement joins using compound
fields.  What I had in mind is exactly what you was proposing, by
allowing the usage of compound fields in the fex:

 recsel -t Maintenance -e "failuresNumber > 100" -P equipment:vendor

Or, if no "role" is used in the record:

 recsel -t Maintenance -e "failuresNumber > 100" -P Asset:vendor

But this needs to be polished.  Maybe your suggestion (to define
references in the record descriptor instead of the data) is beter.

-- 
Jose E. Marchesi    address@hidden
GNU Project         http://www.gnu.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]