Structure Types¶
Most product definitions require deeper feature hierarchies. In COOM you can define a structure type, that can contain enumerations or primitive types, but also another structure types.
Most often these hierarchies are interpreted as partonomies, i.e., a hierarchy defined by part-of relations.
Coding Convention: We encourage to use upper case identifier for custom types and lower case identifier for feature names.
Furthermore, we do not encourage the use of spaces in type identifier or feature names.
If this is necessary, quotes ("..."
) are needed everywhere where the identifier is referenced.
We extend the product definition by the structure type Carrier
.
product {
Color color
bool withStand
Wheel frontWheel
Wheel rearWheel
Carrier carrier
}
The structure Wheel was already defined before.
The type Carrier
is defined as a structure consisting of definitions of the carrier's color (reusing the enumeration type Color) and a new type Bag
.
structure Carrier {
Color color
Bag bag
}
structure Bag {
Capacity capacity
Material material
}
enumeration Capacity {
attribute num/l volume
attribute num/gr weight
B10 = ( 10, 100 )
B20 = ( 20, 250 )
B50 = ( 50, 600 )
B100 = ( 100, 1200 )
}
enumeration Material {
Cotton
Leather
Polyester
}
We see, that Bag
is again a structure with the enumerations Material
and Capacity
.
This example builds a partonomic hierarchy of three levels product
, Carrier
, and Bag
.
COOM supports the formation of hierarchies of arbitrary depth.
Scope of terms: Type names (enumerations and structures) have a global scope, hence the type names need to be unique over the entire knowledge base. Feature names, on the other hand, have a local scope within the structure that they are defined in. That is, for example, the feature names „color“ and „bag“ with in the structure type „Bag“ only need to be unique within this structure (but not globally).