Extension to models syntax: attach

As of ACEDB 3.1, an extension to the models syntax makes it possible to "attach" (for purposes of display only) a branch from a donor onto a recipient object. In a text window the grafted branch looks like an ordinary part of the recipient. It includes sub-branches and links to other objects and appears at the point of attachment.

Attach can also be specified interactively by the user via a tag chooser, available from a pull-down menu in any text window. Interactive attach is not described here.

The current (4.5) implementation of attach is bugged but is still useful.

How to specify an attachment

An attachment site is specified in a model with an "@" symbol followed by a query in quotes. Attach applies the query to the first object it finds as a path is traced from the attachment site back towards the root of the recipient object. This path always ends with the recipient object itself which therefore acts as the target of last resort for the query. The query determines what the donor will be and which part of it will be grafted.

The attachment site must be the last structure on the line, i.e. it cannot be followed by additional tags, fields, or attachments.

Examples

Example 1: The queried object is a Paper. The query specifies: after each Paper listed in the Author object, graft the entire Paper tree. "WHOLE" is a special extension of the query language for this purpose. A very wide window may be required to view the whole object. Note that ACEDB 3.1 includes horizontal scrolling in text windows.

?Author Paper ?Paper XREF Author @"WHOLE"


Example 2: The queried object is a Paper. The query specifies: after each Paper listed in an Author object, graft the Year tag from the Paper and what follows it. A sample text window shows the effect.

?Author Paper ?Paper XREF Author @"Year"


Example 3: The path from @ back to the root hits the root itself (?B). B is therefore the queried object. The query specifies: in B, follow tag YYY which returns the A object; then from A attach tag XXX and what follows it. Note that the A object and the attached data will appear on different lines. This is practical because a single (UNIQUE) A object is involved. If UNIQUE were missing and there were multiple A objects, it would be difficult for the user to associate each A object with its grafted XXX branch. The form shown in example 2 would be better (because Paper and Year are unambiguously associated).

?A XXX Int Int

?B YYY UNIQUE ?A
   ZZZ @">YYY ; XXX"


Example 4: The queried object is Author. The query specifies: within Author, follow the Image tag to gather Image objects. Within each Image, attach tag Pick_me_to_call and what follows it. Users will thus have the opportunity to view images of authors from within a Paper. This example shows it is possible to attach indirectly linked objects (?Paper does not directly reference ?Image).

?Paper Author ?Author @">Image ; Pick_me_to_call"

?Author Image ?Image

?Image Pick_me_to_call UNIQUE Text Text

Additional notes

1. A text dump of a window with an attached branch will include the attached data, but an ace dump will not unless the environment variable ACEDB_DUMP_ATTACH is set.

Paper : "Jones-1997-1"
Author   "Jones, J. W." "xv" "jones.gif"
While the dump can be read back in again as a data (.ace) file, the attached branch from ?Paper will not accept any data in this context. Any "extra" information--i.e., any data beyond the last "legitimate" field--will not be entered. Furthermore, no error will be signaled.

Therefore, an accidental event that brings data into this position may pass unnoticed.

2. There is no visual cue distinguishing attached from "normal" data in a text window.

3. Attached information cannot be queried or extracted by the TableMaker. Users may need guidance to understand why some information in a text window can be queried and some cannot.

4. A very wide window may be necessary to see all the attached data. ACEDB 3.1 includes horizontal scrolling in text windows.

5. You cannot specify a "recursive" attachement in the models (see notes on interactive attachments for more detail).