Skip to content
Data Types

Rel Data Types

This section describes the various data types in Rel.

Introduction

Relations are unordered collections of tuples. A tuple is an ordered collection of individual data values. Each data value has a data type.

In Rel, each data type has an associated unary relation, which includes all the values of that type. Type relations are often infinite, and therefore cannot be listed directly, but are still useful when specifying knowledge graphs, data schemas, and constraints.

Checking types is particularly useful for integrity constraints, as many of the examples in this document show. See Integrity Constraints for more details.

For each data type, Rel generally provides:

  1. A way to construct values of that data type.
  2. A type relation that tests if a given value belongs to that type.
  3. Operations specific to the data type.

Overview

CategoryNameDescription
NumericPrimitiveSignedInt[8], SignedInt[16], SignedInt[32], SignedInt[64], and SignedInt[128]Signed integers.
NumericPrimitiveUnsignedInt[8], UnsignedInt[16], UnsignedInt[32], UnsignedInt[64], and UnsignedInt[128]Unsigned integers.
NumericPrimitiveFloating[16], Floating[32], and Floating[64]Floating-point numbers.
NumericPrimitiveRational[8], Rational[16], Rational[32], Rational[64], and Rational[128]Rational numbers.
NumericPrimitivestd::decimal::FixedDecimal[nbits, ndecimals]Fixed-sized decimals with ndecimals digits of decimal precision and total bit size of nbits.
NumericPrimitivestd::bignum::BigIntegerGMP BigInteger value.
NumericAbstractNumberUnion of all numeric data types.
TextPrimitiveCharUTF-16 characters.
TextPrimitiveStringVariable-sized strings.
TimePrimitivestd::datetime::DateTimeTimestamps containing date and time information.
TimePrimitivestd::datetime::DateDate.
TimePrimitivestd::datetime::Year , std::datetime::Month , std::datetime::Week, and std::datetime::DayDate periods.
TimePrimitivestd::datetime::Hour, std::datetime::Minute, std::datetime::Second, std::datetime::Millisecond, std::datetime::Microsecond, and std::datetime::NanosecondTime periods.
KeyPrimitiveHashHash value.
KeyAbstractEntityEntity key. Superclass of Hash.
KeyPrimitivestd::common::UUIDUUID value.
KeyPrimitivestd::common::SHA1SHA-1 value.
MetaPrimitiveRelNameSymbols. Can be used to specify names of relations.
OtherAbstractAnyUnion of all data types.
OtherPrimitiveboolean_true and boolean_falseBoolean data type (for JSON support only).
OtherPrimitivestd::common::FilePosFile positions in a data file.
OtherPrimitiveMissingSingleton representing missing data.

Rel data types are classified according to their main purpose:

CategoryDescription
NumericNumeric data types.
TextText-based data types.
Time-RelatedTime-related data types.
KeyData types for identification purposes, such as UUIDs.
MetaData types referring to metadata information (such as relation names).
OtherAll other supported data types.

There are two principal kinds of data types:

Description
PrimitiveData types with no further subtypes.
AbstractData types built on top of primitive types, usually unions of multiple primitive data types.

The following sections describe the details of each supported data type and provide examples of how they can be used:

Was this doc helpful?