Literal Values
Overview
With a typical formal model, there is a need for formal representation of literal values. This is needed to support constant declarations, 'default values' (a UML concept), enumeration literals and literal routine calls (see next section). In BMM, all such values have as their meta-type the type BMM_LITERAL_VALUE<T> or a descendant. The type hierarchy mostly mimicks parts of the BMM_TYPE meta-type hierarchy, allowing for literal values of any of the meta-types in that part of the model. The UML model is shown below.
base.bmm.core.literal_value package - Literal ValuesGeneral Model
When a BMM model is instantiated in its in-memory form, e.g. in a BMM modelling tool, any literal values in the model such as constant values (e.g. Real Pi = 3.1415926), default values (e.g. Person.name: String = "(unknown)") etc are instances of 'two types':
-
their declared types withing the model, e.g.
Real,String,Observation; -
the meta-type
BMM_LITERAL_VALUE<T>(or a matching descendant if there is one), which is instantiated to represent the value object within the model.
The value of any such instance is represented by the value_literal field within its BMM_LITERAL_VALUE object. This is assumed to carry a serialised form of the value expressed in a syntax known to the model processing environment within which the BMM model is being used. This may be a programming language syntax, JSON, or any other serialisable format, and is specified by BMM_LITERAL_VALUE.syntax.
Container Literals
Literals representing Lists or Sets of values of objects of other types have as their BMM meta-type BMM_CONTAINER_VALUE<T>. For example, if the serialised value ["Feyerabend", "Lakatos", "Popper"] (which happens to be a JSON Array of Strings) were parsed as a List<String> instance, its meta-type would be a BMM_CONTAINER_VALUE instance whose value_literal was the same string, assuming JSON were used as the syntax, and whose type will be BMM_CONTAINER_TYPE. Similarly a syntax that supported literal Sets using braces, e.g. {"Feyerabend", "Lakatos", "Popper"} may be parsed to a Set<String> instance, with the same meta-type as for the List.
In a similar way, a Hash table (aka 'map', 'dictionary' etc) with a formal type of Hash<K, V> has as its meta-type BMM_INDEXED_CONTAINER_VALUE.
Literal Tuples
Literal tuples may be expressed in BMM, but are not instances of BMM_LITERAL_VALUE; instead they are instances (at the meta level) of EL_TUPLE, an expression-related meta-type. This is a consequence of the fact that Tuple is considered a BMM built-in meta-type rather than a model-provided type, and also that a Tuple instance may contain items of any meta-type, not just literal values. Tuple instances are used in BMM expressions and described in [_tuples].
Type Extensions
If it were desired to create a full set of 'native' types for BMM, in the way supplied for UML in the UML Standard Profile, specific descendants would be added to the meta-type classes BMM_SIMPLE_TYPE and BMM_GENERIC_TYPE, as well as BMM_LITERAL_VALUE, which would allow such instances to be directly representable in the internal BMM type system. This would still need to be ultimately mapped to the types actually available in any language in which BMM is implemented.
Class Definitions
BMM_LITERAL_VALUE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
BMM_LITERAL_VALUE (abstract) |
|
|---|---|---|
Description |
Meta-type for literal instance values declared in a model. Instance values may be inline values of primitive types in the usual fashion or complex objects in syntax form, e.g. JSON. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
value_literal: `String ` |
A serial representation of the value. |
0..1 |
value: `Any ` |
A native representation of the value, possibly derived by deserialising |
0..1 |
syntax: `String ` |
Optional specification of formalism of the |
| BMM_LITERAL_VALUE (abstract) | |
|---|---|
Meta-type for literal instance values declared in a model. Instance values may be inline values of primitive types in the usual fashion or complex objects in syntax form, e.g. JSON. |
|
Inherits: BMM_TYPED |
|
Attributes |
|
type: |
Declared or inferred static type of the entity. |
value_literal: `String ` [1..1] |
A serial representation of the value. |
value: `Any ` [0..1] |
A native representation of the value, possibly derived by deserialising |
syntax: `String ` [0..1] |
Optional specification of formalism of the |
Functions |
|
is_boolean (): |
True if |
{
"name": "BMM_LITERAL_VALUE",
"documentation": "Meta-type for literal instance values declared in a model. Instance values may be inline values of primitive types in the usual fashion or complex objects in syntax form, e.g. JSON.",
"is_abstract": true,
"ancestors": [
"BMM_TYPED"
],
"properties": {
"value_literal": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "value_literal",
"documentation": "A serial representation of the value.",
"is_mandatory": true,
"type": "String"
},
"value": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "value",
"documentation": "A native representation of the value, possibly derived by deserialising `_value_literal_`.",
"type": "Any"
},
"syntax": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "syntax",
"documentation": "Optional specification of formalism of the `_value_literal_` attribute for complex values. Value may be any of `json | yawl | xml | odin | rdf` or another value agreed by the user community. If not set, `json` is assumed.",
"type": "String"
}
}
}
BMM_CONTAINER_VALUE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
BMM_CONTAINER_VALUE |
|
|---|---|---|
Description |
Meta-type for literals whose concrete type is a linear container type, i.e. array, list or set. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type: |
Declared or inferred static type of the entity. |
| BMM_CONTAINER_VALUE | |
|---|---|
Meta-type for literals whose concrete type is a linear container type, i.e. array, list or set. |
|
Inherits: BMM_TYPED, BMM_LITERAL_VALUE |
|
Attributes |
|
type: |
Declared or inferred static type of the entity. |
value_literal: `String ` [1..1] |
A serial representation of the value. |
value: `Any ` [0..1] |
A native representation of the value, possibly derived by deserialising |
syntax: `String ` [0..1] |
Optional specification of formalism of the |
Functions |
|
is_boolean (): |
True if |
{
"name": "BMM_CONTAINER_VALUE",
"documentation": "Meta-type for literals whose concrete type is a linear container type, i.e. array, list or set.",
"ancestors": [
"BMM_LITERAL_VALUE"
],
"properties": {
"type": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type",
"documentation": "Declared or inferred static type of the entity.",
"is_mandatory": true,
"type": "BMM_CONTAINER_TYPE"
}
}
}
BMM_INDEXED_CONTAINER_VALUE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
BMM_INDEXED_CONTAINER_VALUE |
|
|---|---|---|
Description |
Meta-type for literals whose concrete type is an indexed container, i.e. Hash table, Map etc. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
Declared or inferred static type of the entity. |
|
| BMM_INDEXED_CONTAINER_VALUE | |
|---|---|
Meta-type for literals whose concrete type is an indexed container, i.e. Hash table, Map etc. |
|
Inherits: BMM_TYPED, BMM_LITERAL_VALUE, BMM_CONTAINER_VALUE |
|
Attributes |
|
type: |
Declared or inferred static type of the entity. |
value_literal: `String ` [1..1] |
A serial representation of the value. |
value: `Any ` [0..1] |
A native representation of the value, possibly derived by deserialising |
syntax: `String ` [0..1] |
Optional specification of formalism of the |
Functions |
|
is_boolean (): |
True if |
{
"name": "BMM_INDEXED_CONTAINER_VALUE",
"documentation": "Meta-type for literals whose concrete type is an indexed container, i.e. Hash table, Map etc.",
"ancestors": [
"BMM_CONTAINER_VALUE"
],
"properties": {
"type": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type",
"documentation": "Declared or inferred static type of the entity.",
"is_mandatory": true,
"type": "BMM_INDEXED_CONTAINER_TYPE"
}
}
}
BMM_UNITARY_VALUE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
BMM_UNITARY_VALUE (abstract) |
|
|---|---|---|
Description |
Meta-type for literals whose concrete type is a unitary type in the BMM sense. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type: |
Declared or inferred static type of the entity. |
| BMM_UNITARY_VALUE (abstract) | |
|---|---|
Meta-type for literals whose concrete type is a unitary type in the BMM sense. |
|
Inherits: BMM_TYPED, BMM_LITERAL_VALUE |
|
Attributes |
|
type: |
Declared or inferred static type of the entity. |
value_literal: `String ` [1..1] |
A serial representation of the value. |
value: `Any ` [0..1] |
A native representation of the value, possibly derived by deserialising |
syntax: `String ` [0..1] |
Optional specification of formalism of the |
Functions |
|
is_boolean (): |
True if |
{
"name": "BMM_UNITARY_VALUE",
"documentation": "Meta-type for literals whose concrete type is a unitary type in the BMM sense.",
"is_abstract": true,
"ancestors": [
"BMM_LITERAL_VALUE"
],
"properties": {
"type": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type",
"documentation": "Declared or inferred static type of the entity.",
"is_mandatory": true,
"type": "BMM_UNITARY_TYPE"
}
}
}
BMM_PRIMITIVE_VALUE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
BMM_PRIMITIVE_VALUE |
|
|---|---|---|
Description |
Meta-type for literals whose concrete type is a primitive type. |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
type: |
Declared or inferred static type of the entity. |
| BMM_PRIMITIVE_VALUE | |
|---|---|
Meta-type for literals whose concrete type is a primitive type. |
|
Inherits: BMM_TYPED, BMM_LITERAL_VALUE, BMM_UNITARY_VALUE |
|
Attributes |
|
type: |
Declared or inferred static type of the entity. |
value_literal: `String ` [1..1] |
A serial representation of the value. |
value: `Any ` [0..1] |
A native representation of the value, possibly derived by deserialising |
syntax: `String ` [0..1] |
Optional specification of formalism of the |
Functions |
|
is_boolean (): |
True if |
{
"name": "BMM_PRIMITIVE_VALUE",
"documentation": "Meta-type for literals whose concrete type is a primitive type.",
"ancestors": [
"BMM_UNITARY_VALUE"
],
"properties": {
"type": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "type",
"documentation": "Declared or inferred static type of the entity.",
"is_mandatory": true,
"type": "BMM_SIMPLE_TYPE"
}
}
}
BMM_STRING_VALUE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
BMM_STRING_VALUE |
|
|---|---|---|
Description |
Meta-type for a literal String value, for which |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
value: `String ` |
Native String value. |
| BMM_STRING_VALUE | |
|---|---|
Meta-type for a literal String value, for which |
|
Inherits: BMM_TYPED, BMM_LITERAL_VALUE, BMM_UNITARY_VALUE, BMM_PRIMITIVE_VALUE |
|
Attributes |
|
type: |
Declared or inferred static type of the entity. |
value_literal: `String ` [1..1] |
A serial representation of the value. |
value: `String ` [1..1] |
Native String value. |
syntax: `String ` [0..1] |
Optional specification of formalism of the |
Functions |
|
is_boolean (): |
True if |
{
"name": "BMM_STRING_VALUE",
"documentation": "Meta-type for a literal String value, for which `_type_` is fixed to the `BMM_TYPE` representing `String` and `_value_` is of type `String`.",
"ancestors": [
"BMM_PRIMITIVE_VALUE"
],
"properties": {
"value": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "value",
"documentation": "Native String value.",
"is_mandatory": true,
"type": "String"
}
}
}
BMM_INTEGER_VALUE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
BMM_INTEGER_VALUE |
|
|---|---|---|
Description |
Meta-type for a literal Integer value, for which |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
value: `Integer ` |
Native Integer value. |
| BMM_INTEGER_VALUE | |
|---|---|
Meta-type for a literal Integer value, for which |
|
Inherits: BMM_TYPED, BMM_LITERAL_VALUE, BMM_UNITARY_VALUE, BMM_PRIMITIVE_VALUE |
|
Attributes |
|
type: |
Declared or inferred static type of the entity. |
value_literal: `String ` [1..1] |
A serial representation of the value. |
value: `Integer ` [1..1] |
Native Integer value. |
syntax: `String ` [0..1] |
Optional specification of formalism of the |
Functions |
|
is_boolean (): |
True if |
{
"name": "BMM_INTEGER_VALUE",
"documentation": "Meta-type for a literal Integer value, for which `_type_` is fixed to the `BMM_TYPE` representing `Integer` and `_value_` is of type `Integer`.",
"ancestors": [
"BMM_PRIMITIVE_VALUE"
],
"properties": {
"value": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "value",
"documentation": "Native Integer value.",
"is_mandatory": true,
"type": "Integer"
}
}
}
BMM_BOOLEAN_VALUE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
BMM_BOOLEAN_VALUE |
|
|---|---|---|
Description |
Meta-type for a literal Boolean value, for which |
|
Inherit |
||
Attributes |
Signature |
Meaning |
1..1 |
value: `Boolean ` |
Native Boolean value. |
| BMM_BOOLEAN_VALUE | |
|---|---|
Meta-type for a literal Boolean value, for which |
|
Inherits: BMM_TYPED, BMM_LITERAL_VALUE, BMM_UNITARY_VALUE, BMM_PRIMITIVE_VALUE |
|
Attributes |
|
type: |
Declared or inferred static type of the entity. |
value_literal: `String ` [1..1] |
A serial representation of the value. |
value: `Boolean ` [1..1] |
Native Boolean value. |
syntax: `String ` [0..1] |
Optional specification of formalism of the |
Functions |
|
is_boolean (): |
True if |
{
"name": "BMM_BOOLEAN_VALUE",
"documentation": "Meta-type for a literal Boolean value, for which `_type_` is fixed to the `BMM_TYPE` representing `Boolean` and `_value_` is of type `Boolean`.",
"ancestors": [
"BMM_PRIMITIVE_VALUE"
],
"properties": {
"value": {
"_type": "P_BMM_SINGLE_PROPERTY",
"name": "value",
"documentation": "Native Boolean value.",
"is_mandatory": true,
"type": "Boolean"
}
}
}
BMM_INTERVAL_VALUE Class
-
Definition
-
Effective
-
BMM
-
UML
Class |
BMM_INTERVAL_VALUE |
|
|---|---|---|
Description |
Meta-type for literal intervals of type |
|
Inherit |
||
| BMM_INTERVAL_VALUE | |
|---|---|
Meta-type for literal intervals of type |
|
Inherits: BMM_TYPED, BMM_LITERAL_VALUE |
|
Attributes |
|
type: |
Declared or inferred static type of the entity. |
value_literal: `String ` [1..1] |
A serial representation of the value. |
value: `Any ` [0..1] |
A native representation of the value, possibly derived by deserialising |
syntax: `String ` [0..1] |
Optional specification of formalism of the |
Functions |
|
is_boolean (): |
True if |
{
"name": "BMM_INTERVAL_VALUE",
"documentation": "Meta-type for literal intervals of type `Interval<Ordered>`.",
"ancestors": [
"BMM_LITERAL_VALUE"
]
}