Rule-Based Processing of Connectivity Data

Introduction

The pixel connectivity is modelled in the CoralDB connectivity database as a series of connections between different nodes. These connections represent a graph. In order to extract information from this graph, one starts at a given node and follows a certain prescription (or rule) to extract the desired information.

For example, in order to extract the name of the optoboard to which a given module is connected, one can start at the node corresponding to that module and use the following prescription:

  1. Go up to the parent node using the slot named UP
  2. Go up again to its parent node using the slot named OB
  3. Get the ID of the resulting node
In the "table view", the CoralDB browser allows to extract information for a given set of objects ("primary objects") into a table where each row contains the information for one of the primary objects. Each column of the table contains the information extracted using a particular rule, starting at the primary object used in the corresponding row. The syntax for writing such rules is explained in the next section, but to give an example, the above prescription would be written as
U=UP U=OB ID
The fields labelled "Define column ..." (in the table view of the CoralDB browser) allow to assign a title and specify the rule to be used for each column. Rules can be specified either by choosing from a set of predefined rules, or by entering the rule directly in the corresponding field.

If all the objects for which the table should be assembled have the same type, a predefined set of rules defined specifically for that type of object is available. To use this feature you need to use the selector "Search only objects of type" when searching for the primary objects to be included into the table.

The information to be displayed for a given type of object will often be similar. As a starting point, you can choose one of the predefined tables from a pulldown menu (again, to see predefined tables you need to use the selector "Search only objects of type"). After you click "Update table", the corresponding table definition will be filled in and the default table will have been created. You can then modify this definition as desired.

Rule Syntax

Each rule consists of a series of commands separated by white space. Each command is used to either navigate from the current node to another node, or to output some information about the current node. The processing of all nodes starts at the object for which the current row of the table is built, ie. at the primary object. The processing of a rule continues until either one arrives at the end of the rule, or until one of the commands cannot be executed, for example because a specified connection doesn't exist. In the latter case, depending on the form of the command used, the rule terminates silently (rules using '='), or outputs an error message (rules using '!').

Some commands may lead to several nodes. In this case, rule processing continues for each of the nodes, and each of the selected paths can result in some output. Thus the corresponding cell in the table will contain more than one entry which will be displayed on several lines.

The following commands are available.

Commands for retrieving information

IDOutput ID of current node
TYPEOutput type of current node
SLOTName of SLOT on current node that was used to arrive at current node
FROMIDID of node from which one arrived at the current node
FROMSLOTName of SLOT used on node from which one arrived at the current node
NUNumber of upward connections
NU!nError message if number of upward connections is not equal to n
NU>nError message if number of upward connections is not greater than n
NU<nError message if number of upward connections is not less than n
NDNumber of downward connections
ND!nError message if number of downward connections is not equal to n
ND>nError message if number of downward connections is not greater than n
ND<nError message if number of downward connections is not less than n
"word"Write out a word (can not contain any white space)
A=conventionOutput alias for convention of current node (no output if no such alias exists)
A!conventionOutput alias for convention of current node (output error if no such alias exists)

Commands for navigation

The directions "up" and "down" in the following are meant to refer to travelling along incoming and outgoing connections, respectively. Rules containing a '=' ('!') terminate silently (output an error message) if they can't be satisfied. Wildcards are allowed in the specification of both slots and object type.

U=slot,
U!slot
Go up using slot
UF=slot,
UF!slot
Go up using connection from slot
D=slot,
D!slot
Go down using slot
DE=slot,
DE!slot
Go down using connection to slot
T=type,
T!type
Go to node(s) of type type (both up and down nodes are searched)
TU=type,
TU!type
Go to node(s) of type type (only up nodes are searched)
TD=type,
TD!type
Go to node(s) of type type (only down nodes are searched)

Commands for formatting

HTMLBOLDWrite subsequent text in bold font
HTMLITALICWrite subsequent text in italic font
HTMLREDWrite subsequent text in red

Examples

The sample output below is give for applying rules to module D1A_B01_S1_M1.

RuleSample outputDescription
IDD1A_B01_S1_M1ID of current object
U=UP A=GEOIDSQP-A12-OP-C2-P4L-TName of parent node using GEOID alias
U=UP A=GEOINo output, because A= is used and there is no alias GEOI
U=UP A!GEOIERROR: No alias for convention GEOI for D1A_B01_S1Error, because A! is used and there is no alias GEOI
U=UP D=% FROMSLOTM1
M2
M3
M4
M5
M6
List of outgoing slots on parent node
T=PP0 T=% TYPECONTAINER
OPTOBOARD
HV-PP1
LV-PP1
OPTO-PP1
MODULE
MODULE
MODULE
MODULE
MODULE
MODULE
List of the type of all objects connected to a PP0 (which is the parent of a module; you could equally use U=UP instead of T=PP0)
U=UP U=OB T=RODBOC ID T=RODCRATE IDROD_C1_S11 ROD_CRATE_1Get ROD slot and crate (note that you can output several pieces of information in the same rule)

Predefining Rules and Tables

It is convenient to predefine frequently used rules and tables. Because the rule needed for extracting a particular piece of information obviously depends on the type of the starting node, different sets of rules and table are defined for each type of object. In order to use the predefined type-specific rules and tables, you need to indicate the desired type of object by limiting your search for primary objects with the selector labelled "Search only objects of type". In this case you will see a list of predefined tables in the selector "Start with a predefined table", and a list of predefined rules in the selectors for defining the column contents.

It is possible to build a table for primary objects with different types. In this case only a number of generic rules is available. This is also true for object types where no predefined rules (or tables) are available.

Predefined tables are used as a starting point to preset the column contents. Afterwards, the table can be further customized as desired.

Predefined rules and tables are stored in configuration files in package CoralDB in subdirectory rules with file names of the form TYPE.rules (definition of rules for objects of type TYPE) and TYPE-TABLENAME.table (definition of a table TABLENAME for objects of type TYPE). The first column in the file is the name of the rule or the column title. The second column is separated by a single tab character ('\t') and contains the rule or column definition. To define the column contents, both the names of rules defined for that type of object and individual commands as described above may be used.