5.2. Common Concepts in pure::variants Models

This section describes the common, generic structure on which all models are based.

All models store elements (features in Feature Models, components, parts and source elements in Family Models) in a hierarchical tree structure. Elements ( Figure 5.2, “(simplified) element meta model” ) have an associated type and may have any number of associated attributes. An element may also have any number of associated relations. Additionally restrictions and constraints can be assigned to an element.

Figure 5.2. (simplified) element meta model

(simplified) element meta model

Model constraints are used to check the integrity of the configuration (Variant Result Model) during a model evaluation. They can be assigned to model elements for clarity only, i.e. they have no effect on the assigned elements. All defined constraints have to be fulfilled for a resulting configuration to be valid. Detailed information about using constraints is given in Section 5.8, “ Variant Description Evaluation ” .

Element restrictions are used to decide if an element is part of the resulting configuration. During model evaluation, an element cannot become part of a resulting configuration unless one of the restrictions defined on the element evaluates to true. Restrictions can not only be defined for elements but also for element attributes, attribute values, and relations. Detailed information about using restrictions is given in Section 5.8, “ Variant Description Evaluation ” .

pure::variants allows arbitrary 1:n relations between model elements to be expressed. The graphical user interface provides access to the most commonly used relations. The extension interface allows additional relations to be accessed.

Examples of the currently supported relations are requires , required_for , conflicts , recommends , discourages , cond_requires , and influences . Use the Relations page in the property dialog of a feature to specify feature relations. Table 9.2, “Supported relations between elements (I)” documents the supported relations and their meanings.

pure::variants uses attributes to specify additional information associated with an element. An attribute is a typed and named model element that can represent any kind of information (according to the values allowed by the type). An element may have any number of associated attributes. The attributes of a selected model element are evaluated and their values calculated during the model evaluation process. A simplified version of the element attribute meta-model is shown below.


Element attributes may be fixed (indicated with the checked column in the GUI) or non-fixed . The difference between a fixed and a non-fixed attribute is the location of the attribute value. The values of fixed attributes are stored together with the model element and are considered to be part of the model. A non-fixed element attribute value is stored in a VDM, so the value may be different in other VDMs.

A non-fixed attribute must not, but can have values that are used by default when the element is selected and no value has been specified in the VDM.

Guarding restrictions control the availability of attributes to the model evaluation process. If the restrictions associated with an attribute evaluate to false , the attribute is considered to be unavailable and may not be accessed during model evaluation.

A fixed attribute may have multiple value definitions assigned to it. A value definition may also have a restriction. In the evaluation process the value of the attribute is that of the first value definition that has a valid restriction (or no restriction) and successfully evaluates to true .

Instead of selecting one value from a list of possible values, it is also possible to provide attributes which have a configurable collection of values. Each value in the collection is available in a variant if the corresponding restriction holds true. Two types of collections are available for use: Lists and Sets. List attributes mean to maintain an order of the values and allow multiple equal entries. Set attributes instead require each value to be unique. An order is not ensured. To use this feature, either square brackets ("[]") for lists or curly brackets ("{}") for sets have to be added after the data type, e.g. ps:string{} , ps:boolean[] , or ps:integer[] .

Each attribute of type ps:integer or ps:float may define a range which the attribute values have to fit in. The Syntax of a valid range is as follows.

The list of value types supported in pure::variants is defined in the pure::variants meta-model. Currently all types except ps:integer and ps:float are treated as string types internally. However, the transformation phase and some plug-ins may use the type information for an attribute value to provide special formatting etc..

The list of types provided by pure::variants is given in the reference section in table Table 9.1, “Supported Attribute Types” . Users may define their own types by entering the desired type name instead of choosing one of the predefined types.

By adding square brackets ("[]") or curly brackets ("{}") to the name of a value type a list or set type can be specified, e.g. ps:string[] , ps:boolean[] , or ps:integer{} . A list or set type can hold a list of values of the same data type. In contrast to normal types each of the given values is available in a variant if its restriction holds true or it doesn't have a restriction.

When using pvSCL for value calculation, the following examples are a good starting point. For a detailed description of the pvSCL syntax, refer to Section 9.7, “Expression Language pvSCL” .

Attribute calculation in pvSCL requires the returned value to be of the defined attribute type. Thus, to assign the value 1 to an attribute of type ps:integer use the following calculation expression:

    1      

To assign an attribute the value of another attribute OtherAttribute of an element OtherElement , use the following expression:

    OtherElement->OtherAttribute

To return the half of the product of the value of two attributes, use:

    (OtherElement->OtherAttribute * AnotherElement->AnotherAttribute) / 2

Only the value of attributes of type ps:float and ps:integer should be used in arithmetic expressions.

Use the following expression to return a string based on another attribute.

    'Text ' + OtherElement->OtherAttribute + ' more Text'