Calculated Attributes

Body

Extending the OpenBFS/BFS via the usage of calculated attributes for arbitrary files and file types would provide a useful means of dynamic and constantly up to date meta-data on many types of files.

Details

On top of the current methods to define and maintain file attributes under OpenBFS/BFS, there could exist methods to define calculated attributes for arbitrary files and file types. The calculation may be based on other attributes of the same file, globally defined values or value lists and other special information like item count for queries or folders.

Importantly, when a value which a calculated attribute uses changes there must be a method to recursively trace all dependent calculated attributes and re-calculate any affected formulae in order to keep all attributes up to date. In the case of attributes which have been indexed, the appropriate indices must also be updated at the same time.

Such calculated attributes may be defined on a per-file basis (in the form of a specially flagged attribute, which indicates it has to be evaluated as opposed to just its formula string used as value); or in the MIME DB for various file types.

In the latter case all files of the according type would "inherit" them. This would be possible because in order for a file to have a value for such a calculated field, the file does not have to specifically provide it, as opposed to normal attributes which have to provide a specific value. Calculations for which some source attribute are missing would take the concrete value of , or maybe an empty value (NULL).

An implementation of this system would need to be aware of problems relating to recursive calculated attributes and enforce restrictions such that all calculations are acyclic. Many modern DBMS with similar functionality have overcome this problem.

Potential uses for such a system are numerous. Backward compatible attribute names could become useful. E.g. An attribute called "Subject" which takes on the value from MAIL:subject or NEWS:subject or from the file name, depending on whichever one exists. Another obvious usage is in digital media, where many file types have independent mechanisms for meta-data storage. An abstracted method to gather information from MP3, OGG, WMA, etc would prove invaluable for media developers and users alike.