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.
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 10.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[].
For each attribute of the types ps:integer or ps:float and its subtypes, a value range can be defined, which restricts the valid attribute values to a subset. The syntax of the range expression is defined by following rules:
A range expression consists of a non-empty set of subranges separated by comma character: subrange_1, subrange_2, ... , subrange_n. The subranges are united, i.e., a valid value has to match at least one of the subranges.
Using single value subranges, single valid values can be defined. Such values can be numeric values (e.g. “0,10,100”) or the special values “NaN” and “*”. The value “NaN” corresponds to the not-a-number value, which needs to be explicitly listed when a range is used and the not-a-number value should be allowed. The value “*” corresponds to any value including positive and negative infinity, but except the not-a-number value. Examples: “1,2,3”, “1,2,3,NaN”, “*”.
Using interval subranges, an interval of valid values can be defined. For lower and higher bounds of the interval each a numeric value or the special value “*” can be used. The value “*” used as lower and higher bound represents negative and positive infinity, respectively. Using characters “[” / “(” and “]” / “)” the bounds are defined as including and excluding, respectively. Examples: “[0,10]”, “[0,*]”, “(-1.0,1.0)”.
The single value and interval subranges can be freely mixed. Examples: “[0,10],NaN”, “1,2,[8,10),20,[100,*]”.
The valid numeric values within single value and interval ranges depend on the used attribute type: For attributes of type ps:integer any decimal and any positive hexadecimal (prefixed with 0x) numbers can be used. For attributes of type ps:float any floating-point number can be used. Examples: “[0x00,0xFF],NaN”, “[0.0,1e300]”.
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 and its valid values is given in the reference section in table Table 10.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.
Attribute values can be constant or calculated. Calculations are performed by providing a calculation expression instead of the constant value. The result of evaluating the calculation expression is the value of the attribute in a variant. Pure Variants uses the built-in expression language pvSCL to express calculations.
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 10.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'