next up previous contents
Next: Pre-defined variables Up: User-defined Answer Formats Previous: Basic definitions

Simple expressions in patterns

We first concentrate on the pattern attribute, i.e. they are not applicable in the head or tail attribute of an answer format. The following expressions are allowed. Capital letters indicate that the term is a placeholder for some label occuring in the query definition or the answer objects.

{this}
denotes the object name of an answer object (e.g. `A')

{this.ATTRIBUTE_CAT}
denotes the value(s) of the attribute `ATTRIBUTE_CAT' of the current answer object `this'. The attribute must be defined in the query class (retrieved_attribute, computed_attribute) or view (inherited_attribute). Note that some attributes are multi-valued. For the answer object `A', {this.cat1} evaluates to v11,v12 and {this.cat2} evaluates to v21. For the complex object `B', a path expression like {this.cat2.cat21} is allowed and yields v21. Note that all such expressions are set-valued.

{this^ATTRIBUTE_LABEL}
denotes the value of the attribute `ATTRIBUTE_LABEL' of the current answer object `this'. The attribute_label is at the level of the answer object, i.e. not at the class level but at the instance level. Therefore, this expression is rarely used because the instance level attribute labels are usually unknown at query definition time. Example A and B: {this^label12} evaluates to v12.

{this tex2html_wrap_inline4643 ATTRIBUTE_CAT}
denotes all attribute labels of the answer object `this' that are grouped under the category `ATTRIBUTE_CAT' (defined in the query class). Example: {this|cat1} evaluates to label11,label12.

The derivation of pattern is performed for each answer object that is in the result set of a query. The answer object `A' induces the following substition rules:

tabular1783

Extended examples for these simple expressions are given in simple_answerformats1.sml and simple_answerformats2.sml in the directory $CB_HOME/examples/AnswerFormat/.

Note that only objects that match the query constraint are in the answer. Particularly, computed_attribute and retrieved_attribute require that at least one filler for the respective attribute is present in an answer object! Use ConceptBase views (`View') and inherited_attribute in case that zero fillers are also allowed for answers.

There are few other simple expressions that may be useful. They just list attributes without having to refer to specific attributes.

{this.attrCategory}
denotes all attribute categories that are present in an answer object. Example: For answer object `A' {this.attrCategory} evaluates to cat1,cat2.

{this tex2html_wrap_inline4643 attribute}
lists all attribute labels occuring in an answer object. Example: for answer object `A', {this|attribute} evaluates to label11,label12,label21.

{this.attribute}
lists all attribute values occuring in an answer object. Example: for answer object `A', {this.attribute} evaluates to v11,v12,v21.

{this.oid}
displays the internal object identifier of the answer object {this}.

For the answer object A, these expressions induce the following additional substitution rules:

tabular1804


next up previous contents
Next: Pre-defined variables Up: User-defined Answer Formats Previous: Basic definitions

ConceptBase Team