What datatypes are supported in DFRNT

What datatypes are supported in DFRNT

The data types supported for DFRNT record values in data products follows what is supported in TerminusDB.

Data Products have schema and records, called documents in TerminusDB. A record can contain properties and a property can be either a defined value type, or a nested internal record. Each record, whether nested or not, has an address. The difference is that nested records are deleted together with its main record.

The data values that a property may have follows what is supported by TerminusDB (code reference). They are outlined in this article for completeness and what is exposed through the data product builder user interface. You may also want to review the The DFRNT data structures overview to learn more about how to construct data products.

Data types in TerminusDB mostly follow the data types (part 2) defined in the XML Schema Definition Language. It's an excellent reference to understand the details of them.

Base types

xsd:string

A string can be any text that follows the conventions of xsd:string and is represented in the same way as JSON strings. Newlines are supported and encoded as \n, "\" are encoded as \\.
Example in a JSON-LD object where string property has a string value:
{
"string_property": "This is a string\n\nNew string after two new lines and a \\ is encoded as \\\\"
}

xsd:boolean

Boolean values can be either true or false, following the xsd:boolean conventions and aligning with the semantics of JSON booleans.
Example in a JSON-LD object where string property has a string value:
{
"bool_property": true
}

xsd:integer

Integers can be positive or negative whole numbers of any size. They adhere to the xsd:integer conventions and can be encoded as either JSON numbers (limited in JavaScript to Number.MAX_SAFE_INTEGER, which is equivalent to 2^53-1) or as strings to accommodate arbitrary length.
Starting from TerminusDB 11, DFRNT always returns xsd:integer values as strings to ensure proper processing by clients.
Example saving a JSON-LD object property with a negative integer value:
{
"int_property": "-12345"
}

xsd:decimal

Decimals are supported with arbitrary precision and are positive or negative. They adhere to the xsd:decimal conventions and can be stored as JSON decimals or strings to support high precision. Since TerminusDB 11, decimals are always returned as strings following conventions.
Example saving a JSON-LD object property with a negative decimal value:
{
"decimal_property": "-0.534"
}

IEEE floating-point

xsd:float

Floats follow the conventions of xsd:float and can be represented as JSON numbers or strings. However, they are always returned as strings. It's important to note that float precisions in TerminusDB align with IEEE semantics.
Example in a JSON-LD object:
{
"float_property": 0.1
}

xsd:double

Floats adhere to the conventions of xsd:double and can be represented as JSON numbers or strings, but they are always returned as strings. It's important to note that double precision in TerminusDB aligns with IEEE semantics.
Example in a JSON-LD object:
{
"double_property": -0.1
}

Time and date (ISO8601)

xsd:date

Date values encode the initial timestamp of a date according to ISO8601, following the xsd:date conventions and serialised as strings, with an optional timezone.
Example in a JSON-LD object:
{
"date_property": "2023-12-24"
}

xsd:time

Time values encode the initial timestamp of a specific time according to ISO8601, following the xsd:time conventions and serialised as strings, with an optional timezone.
Example in a JSON-LD object:
{
"date_property": "23:59:59"
}

xsd:dateTime

DateTime values are encoded according to ISO8601, following the xsd:dateTime conventions and serialised as strings. This means that T is the separator between date and time. The timezone is not required in a dateTime but recommended, it is required though in an xsd:dateTimeStamp. Milliseconds are optional (.123)
Example in a JSON-LD object:
{
"date_property": "2023-12-24T23:59:59.123Z"
}

xsd:dateTimeStamp

DateTimeStamp values are encoded according to ISO8601, following the xsd:dateTimeStamp conventions and serialised as strings. This means that T is the separator between date and time. The timezone is required in a xsd:dateTimeStamp.
Example in a JSON-LD object:
{
"date_property": "2023-12-24T23:59:59Z"
}

Recurring and partial dates, and periods

xsd:gYear

gYear values specifies a specific year according to the Gregorian calendar (ISO8601). More specifically it is an encoding that specifies the period of that specific year, following the xsd:gYear conventions and are serialised as integers. The timezone is optional.
Example in a JSON-LD object:
{
"period_property": "2023"
}

xsd:gMonth

gYear values specifies a the duration of a specific month according to the Gregorian calendar (ISO8601).
More specifically it is an encoding that specifies the recurring period of that specific month of the year, following the xsd:gMonth conventions and are serialised as strings. The timezone is optional.
Example in a JSON-LD object:
{
"period_property": "--05"
}

xsd:gDay

gDay values specifies a specific day of the month according to the Gregorian calendar (ISO8601).
More specifically, it is an encoding that specifies the recurring period of that specific day of the month, following the xsd:gDay conventions and are serialised as strings. The timezone is optional.
Example in a JSON-LD object:
{
"period_property": "---01"
}

xsd:gYearMonth

gYearMonth values specifies a specific month of a specific year, according to the Gregorian calendar (ISO8601).
More specifically, it is an encoding that specifies the period of that specific month of the year, following the xsd:gYearMonth conventions and are serialised as strings. The timezone is optional, here UTC timezone is specified with Z.
Example in a JSON-LD object:
{
"period_property": "2023-12Z"
}

xsd:gMonthDay

gMonthDay values specifies a specific day of a specific month according to the Gregorian calendar (ISO8601).
More specifically, it is an encoding that specifies the yearly recurring period of that specific day of the specific month, following the xsd:gMonthDay conventions and are serialised as strings. The timezone is optional.
Example in a JSON-LD object:
{
"period_property": "--05-01"
}

xsd:duration

Duration values specifies a length of time according to ISO8601.
It follows the xsd:duration conventions and are serialised as strings.
Example in a JSON-LD object for a duration (period) of 3 years and 6 months, 9 days, 6 hours, 30 minutes and 30 seconds. Note the P (period) prefix, and the T (time) separator.
{
"period_property": "P3Y6M9DT6H30M30S"
}

xsd:yearMonthDuration

YearMonthDuration values specifies a length of time according to ISO8601 for time that is one day or longer.
It follows the xsd:yearMonthDuration conventions and are serialised as strings.
Example in a JSON-LD object for a duration (period) of 6 hours, 30 minutes and 30 seconds. Note the P (period) prefix.
{
"period_property": "P3Y6M9D"
}

xsd:dayTimeDuration

DayTimeDuration values specifies a length of time according to ISO8601 for time that is one day or longer.
It follows the xsd:dayTimeDuration conventions and are serialised as strings.
Example in a JSON-LD object for a duration (period) of 6 hours, 30 minutes and 30 seconds, note the P (period) prefix.
{
"period_property": "P6H30M30S"
}

Limited-range integer numbers

Each of the limited-range integer numbers have min and max values that are enforced by the data product engine. Numbers are accepted as JSON integers and strings, and always returned as strings unless noted to be differently.

xsd:byte

Signed 8-bit values, returned as integers, with sign when needed in representation.
Min: -128
Max: 127
{
"int_property": -128
}

xsd:short

Signed 16-bit values, returned as integers, with sign when needed in representation.
Min: -32768
Max: 32767
{
"int_property": -32768
}

xsd:int

Signed 32-bit values, returned as integers, with sign when needed in representation.
Min: -2,147,483,648
Max: 2,147,483,647
{
"int_property": -2147483648
}

xsd:long

Signed 64-bit values, returned as strings, with sign when needed in representation. Note that longs in Javascript clients must be less than 2^53-1, unless a BigInt library is used. It's recommended to encode all longs as strings to ensure conversion errors are avoided.
Min: --9,223,372,036,854,775,808
Max: 9,223,372,036,854,775,807
{
"int_property": "-9223372036854775808"
}

xsd:unsignedByte

Unsigned 8-bit values, returned as integers.
Min: 0
Max: 255
{
"int_property": 255
}

xsd:unsignedShort

Unsigned 16-bit values, returned as integers.
Min: 0
Max: 32768
{
"int_property": 32768
}

xsd:unsignedInt

Unsigned 32-bit values, returned as integers.
Min: 0
Max: 4,294,967,295
{
"int_property": 4294967295
}

xsd:unsignedLong

Unsigned 64-bit values, returned as strings. Note that longs in Javascript clients must be less than 2^53-1, unless a BigInt library is used. It's recommended to encode all longs as strings to ensure conversion errors are avoided.
Min: 0
Max: 18,446,744,073,709,551,615
{
"int_property": "18446744073709551615"
}

xsd:positiveInteger

PositiveIntegers must be larger than zero (>0) and of any size. They adhere to the xsd:positiveInteger conventions and can be encoded as either JSON numbers (limited in JavaScript to Number.MAX_SAFE_INTEGER, which is equivalent to 2^53-1) or as strings to accommodate arbitrary positive length.
Starting from TerminusDB 11, DFRNT always returns xsd:positiveInteger values as strings to ensure proper processing by clients.
Min: 1
Example saving a JSON-LD object property with a positive integer value:
{
"int_property": "195"
}

xsd:nonNegativeInteger

NonNegativeIntegers must be larger than or equal to zero (>=0) and of any size. They adhere to the xsd:nonNegativeInteger conventions and can be encoded as either JSON numbers (limited in JavaScript to Number.MAX_SAFE_INTEGER, which is equivalent to 2^53-1) or as strings to accommodate arbitrary positive length.
Min: 0
Starting from TerminusDB 11, DFRNT always returns xsd:nonNegativeInteger values as strings to ensure proper processing by clients.
Example saving a JSON-LD object property with a positive integer or zero value:
{
"int_property": "0"
}

xsd:negativeInteger

NegativeIntegers must be less than zero (<0) and of any size. They adhere to the xsd:negativeInteger conventions and can be encoded as either JSON numbers (limited in JavaScript to Number.MAX_SAFE_INTEGER, which is equivalent to 2^53-1) or as strings to accommodate arbitrary positive length.

Max: -1

Starting from TerminusDB 11, DFRNT always returns xsd:negativeInteger values as strings to ensure proper processing by clients.
Example saving a JSON-LD object property with a negative integer value:
{
"int_property": "-195"
}

xsd:nonPositiveInteger

NonPositiveIntegers must be less than or equal to zero (<=0) and of any size. They adhere to the xsd:nonPositiveInteger conventions and can be encoded as either JSON numbers (limited in JavaScript to Number.MAX_SAFE_INTEGER, which is equivalent to 2^53-1) or as strings to accommodate arbitrary positive length.

Starting from TerminusDB 11, DFRNT always returns xsd:nonPositiveInteger values as strings to ensure proper processing by clients.

Max: 0

Example saving a JSON-LD object property with a negative integer or zero value:

{
"int_property": "0"
}

Encoded binary data

xsd:hexBinary

A hexBinary string may only contain 0-9 and a-f values with a length divisible by two. It encodes a byte by byte representation of binary data in pairs of hexadecimal values. It follows the conventions of xsd:hexBinary and is represented in the same way as JSON strings.
Example in a JSON-LD object encoding 8 bytes:
{
"binary_value": "0123456789abcdef"
}

xsd:base64Binary

A hexBinary string may only contain base64-encoded values with padded endings. It follows the conventions of xsd:base64Binary and is represented in the same way as JSON strings.
Example in a JSON-LD object encoding 8 bytes:
{
"binary_value": "eyJiaW5hcnlfdmFsdWUiOiAiMDEyMzQ1Njc4OWFiY2RlZiJ9Cg=="
}

Miscellaneous XSD types

xsd:anyURI

An anyURI string may only contain IRI strings. A URL is a subset of an URI (non-internationalized IRI). TerminusDB works with International Resource Identifiers and anyURI supports IRI conventions. It effectively follows the conventions of xsd:anyURI and is represented in the same way as JSON strings.
Example in a JSON-LD object:
{
"anyURI_value": "https://dfrnt.com"
}

xsd:language

A BCP37 language tag

xsd:normalizedString

A whitespace-normalized string.

xsd:token

Tokenized strings

xsd:NMTOKEN

Strings following xsd:NMTOKEN conventions.

xsd:Name

Strings following xsd:Name conventions.

xsd:NCName

Strings following xsd:NCName conventions.

Special types

xdd:json

Supports storing arbitrary JSON objects as string representations of JSON objects.

sys:JSON

Supports storing arbitrary JSON objects as objects (beta).

 

  

    • Related Articles

    • Custom class metadata configuration

      Colours, link directions, class labels, the property display order can be altered by setting custom class metadata. DFRNT provides a special section called "metadata" to define custom behaviours for types and traits. Although these behaviours cannot ...
    • Changing the default display label property

      Apply specific @metadata to make DFRNT use a different property than "label" for search and display purposes. The system has a default property called "label" that is used for record labels. However, it is possible to change which property is used. ...
    • Overview of DFRNT data modelling

      The data model in DFRNT data products follows the TerminusDB graph metamodel 1:1, and enables easy data modelling and advanced visualisation The data modelling capabilities of DFRNT.com involves five categories of data structures: Records, ...
    • How can I learn more about DFRNT

      Learning about DFRNT is closely connected to leveraging the open source TerminusDB data product engine, for which DFRNT is a UI and hosting provider. DFRNT is a user interface and hosting provider for the open source TerminusDB data product ...
    • The DFRNT Data Product Builder

      DFRNT is a data product builder with knowledge graph visualisation, modelling and management, with version control, API access and a datalog engine. With DFRNT data products, digital architects, cybersecurity professionals, data practitioners and ...