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.

aspect model types

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.

Table 1. Data Types
Data Type Value Range Sample Values String-like value space

Core Types

xsd:string

Character strings

'Hello world', 'Καλημέρα κόσμε', 'コンニチハ'

xsd:boolean

true, false

true, false

xsd:decimal

Arbitrary-precision decimal numbers

-1.23, 126789672374892739424.543233, +100000.00, 210

xsd:integer

Arbitrary-size integer numbers

-1, 0, 126789675432332938792837429837429837429, +100000

IEEE-floating-point numbers

xsd:double

64-bit floating point numbers incl. ±Inf, ±0, NaN

-1.0, +0.0, -0.0, 234.567e8, -INF, NaN

xsd:float

32-bit floating point numbers incl. ±Inf, ±0, NaN

-1.0, +0.0, -0.0, 234.567e8, -INF, NaN

Time and date

xsd:date

Dates (yyyy-mm-dd) with or without timezone

'2000-01-01', '2000-01-01Z', '2000-01-01+12:05'

xsd:time

Times (hh:mm:ss.sss…​) with or without timezone

'14:23:00', '14:23:00.527634Z', '14:23:00+03:00'

xsd:dateTime

Date and time with or without timezone

'2000-01-01T14:23:00', '2000-01-01T14:23:00.66372+14:00'

xsd:dateTimeStamp

Date and time with required timezone

'2000-01-01T14:23:00.66372+14:00'

Recurring and partial dates

xsd:gYear

Gregorian calendar year

'2000', '2000+03:00'

xsd:gMonth

Gregorian calendar month

'--04', '--04+03:00'

xsd:gDay

Gregorian calendar day of the month

'---04', '---04+03:00'

xsd:gYearMonth

Gregorian calendar year and month

'2000-01', '2000-01+03:00'

xsd:gMonthDay

Gregorian calendar month and day

'--01-01', '--01-01+03:00'

xsd:duration

Duration of time

'P30D', '-P1Y2M3DT1H', 'PT1H5M0S'

xsd:yearMonthDuration

Duration of time (months and years only)

'P10M', 'P5Y2M'

xsd:dayTimeDuration

Duration of time (days, hours, minutes, seconds only)

'P30D', 'P1DT5H', 'PT1H5M0S'

Limited-range integer numbers

xsd:byte

-128…+127 (8 bit)

-1, 0, 127

xsd:short

-32768…+32767 (16 bit)

-1, 0, 32767

xsd:int

2147483648…+2147483647 (32 bit)

-1, 0, 2147483647

xsd:long

-9223372036854775808…+9223372036854775807 (64 bit)

-1, 0, 9223372036854775807

xsd:unsignedByte

0…255 (8 bit)

0, 1, 255

xsd:unsignedShort

0…65535 (16 bit)

0, 1, 65535

xsd:unsignedInt

0…4294967295 (32 bit)

0, 1, 4294967295

xsd:unsignedLong

0…18446744073709551615 (64 bit)

0, 1, 18446744073709551615

xsd:positiveInteger

Integer numbers >0

1, 7345683746578364857368475638745

xsd:nonNegativeInteger

Integer numbers ≥0

0, 1, 7345683746578364857368475638745

xsd:negativeInteger

Integer numbers <0

-1, -23487263847628376482736487263847

xsd:nonPositiveInteger

Integer numbers ≤0

-1, 0, -93845837498573987498798987394

Encoded binary data

xsd:hexBinary

Hex-encoded binary data

'6b756d6f77617368657265'

xsd:base64Binary

Base64-encoded binary data

'a3Vtb3dhc2hlcmU='

Miscellaneous types

xsd:anyURI

Absolute or relative URIs and IRIs

'http://example.org/', 'urn:samm:com.mycompany.myapplication:1.0.0#errorState'

samm:curie

Compact URI/IRI (well-known prefix + element name)

'xsd:string', 'unit:hectopascal'

rdf:langString

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.

Table 2. Allowed implicit conversions
Type Type

xsd:byte

can be cast to

xsd:short

xsd:short

can be cast to

xsd:int

xsd:int

can be cast to

xsd:long

xsd:long

can be cast to

xsd:integer

xsd:integer

can be cast to

xsd:decimal

xsd:unsignedByte

can be cast to

xsd:unsignedShort

xsd:unsignedShort

can be cast to

xsd:unsignedInt

xsd:unsignedInt

can be cast to

xsd:unsignedLong

xsd:unsignedLong

can be cast to

xsd:nonNegativeInteger

xsd:positiveInteger

can be cast to

xsd:nonNegativeInteger

xsd:nonNegativeInteger

can be cast to

xsd:integer

xsd:negativeInteger

can be cast to

xsd:nonPositiveInteger

xsd:nonPositiveInteger

can be cast to

xsd:integer

xsd:dateTimeStamp

can be cast to

xsd:dateTime

xsd:yearMonthDuration

can be cast to

xsd:duration

xsd:dayTimeDuration

can be cast to

xsd:duration

Currently, implicit type conversions are allowed for the description of example values of Properties.