Data Types
Type Hierarchy
The system of types used in the Semantic Aspect Meta Model (and subsequently in the models conforming to
the Semantic Aspect Meta Model) is largely based on a subset of the XML Schema Definition 1.1 (XSD,
[xmlschema11-2]), including the types
such as data ranges. In addition to types from XSD, the type langString
is included as described
in the RDF [rdf11] specification; it is used
to represent strings with an explicit language tag. Using these types allows for example the
distinction between a plain string and a dateTime string, unlike in JSON. The JSON data of a
Property with a certain type uses the most convenient corresponding JSON type, i.e. booleans for XSD
boolean, number for all numeric types, JSON object for Entities and string for everying else.
The following figure shows the type hierarchy, in which arrows are interpreted as "is a subtype of
and can therefore be cast to". The types anyType
and anySimpleType
are "special" types of the
XSD type hierarchy and should not be directly used.
All data types inheriting from anySimpleType are called scalar, i.e. every allowed data
type except samm:Entity is scalar.
|
The Entity
type corresponds to the Entity Meta Model element as described in section
Meta Model Elements.
The following table lists the types allowed in the Aspect Models, with references to their definition in the respective standards and an informative description of their value space.
Data Type | Value Range | Sample Values | String-like value space | |
---|---|---|---|---|
Core Types |
Character strings |
'Hello world', 'Καλημέρα κόσμε', 'こんにちは世界' |
||
true, false |
true, false |
|||
Arbitrary-precision decimal numbers |
-1.23, 126789672374892739424.543233, +100000.00, 210 |
|||
Arbitrary-size integer numbers |
-1, 0, 126789675432332938792837429837429837429, +100000 |
|||
IEEE-floating-point numbers |
64-bit floating point numbers incl. ±Inf, ±0, NaN |
-1.0, +0.0, -0.0, 234.567e8, -INF, NaN |
||
32-bit floating point numbers incl. ±Inf, ±0, NaN |
-1.0, +0.0, -0.0, 234.567e8, -INF, NaN |
|||
Time and date |
Dates (yyyy-mm-dd) with or without timezone |
'2000-01-01', '2000-01-01Z', '2000-01-01+12:05' |
||
Times (hh:mm:ss.sss…) with or without timezone |
'14:23:00', '14:23:00.527634Z', '14:23:00+03:00' |
|||
Date and time with or without timezone |
'2000-01-01T14:23:00', '2000-01-01T14:23:00.66372+14:00' |
|||
Date and time with required timezone |
'2000-01-01T14:23:00.66372+14:00' |
|||
Recurring and partial dates |
Gregorian calendar year |
'2000', '2000+03:00' |
||
Gregorian calendar month |
'--04', '--04+03:00' |
|||
Gregorian calendar day of the month |
'---04', '---04+03:00' |
|||
Gregorian calendar year and month |
'2000-01', '2000-01+03:00' |
|||
Gregorian calendar month and day |
'--01-01', '--01-01+03:00' |
|||
Duration of time |
'P30D', '-P1Y2M3DT1H', 'PT1H5M0S' |
|||
Duration of time (months and years only) |
'P10M', 'P5Y2M' |
|||
Duration of time (days, hours, minutes, seconds only) |
'P30D', 'P1DT5H', 'PT1H5M0S' |
|||
Limited-range integer numbers |
-128…+127 (8 bit) |
-1, 0, 127 |
||
-32768…+32767 (16 bit) |
-1, 0, 32767 |
|||
2147483648…+2147483647 (32 bit) |
-1, 0, 2147483647 |
|||
-9223372036854775808…+9223372036854775807 (64 bit) |
-1, 0, 9223372036854775807 |
|||
0…255 (8 bit) |
0, 1, 255 |
|||
0…65535 (16 bit) |
0, 1, 65535 |
|||
0…4294967295 (32 bit) |
0, 1, 4294967295 |
|||
0…18446744073709551615 (64 bit) |
0, 1, 18446744073709551615 |
|||
Integer numbers >0 |
1, 7345683746578364857368475638745 |
|||
Integer numbers ≥0 |
0, 1, 7345683746578364857368475638745 |
|||
Integer numbers <0 |
-1, -23487263847628376482736487263847 |
|||
Integer numbers ≤0 |
-1, 0, -93845837498573987498798987394 |
|||
Encoded binary data |
Hex-encoded binary data |
'6b756d6f77617368657265' |
||
Base64-encoded binary data |
'a3Vtb3dhc2hlcmU=' |
|||
Miscellaneous types |
'http://example.org/', 'urn:samm:com.mycompany.myapplication:1.0.0#errorState' |
|||
Compact URI/IRI (well-known prefix + element name) |
'xsd:string', 'unit:hectopascal' |
|||
Strings with language tags |
"Hello"@en, "Hallo"@de. Note that this is written in RDF/Turtle syntax, and that only "Hello" and "Hallo" are the actual values. |
The following types defined by the XSD and RDF specifications, respectively, are considered unsuitable in Aspect Models and should not be used:
xsd:language
, xsd:normalizedString
, xsd:token
, xsd:NMTOKEN
, xsd:Name
, xsd:NCName
,
xsd:QName
, xsd:ENTITY
, xsd:ID
, xsd:IDREF
, xsd:NOTATION
, xsd:IDREFS
, xsd:ENTITIES
,
xsd:NMTOKENS
, rdf:HTML
and rdf:XMLLiteral
.
Implicit Conversions
The following implicit data type conversions are allowed, i.e. when a type A can be cast to type B according to the following table, A is allowed where B is required. Implicit conversion is transitive, i.e. when A can be cast to B and B can be cast to C then A can also be cast to C.
Type | Type | |
---|---|---|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
|
can be cast to |
|
Currently, implicit type conversions are allowed for the description of example values of Properties.