Skip to content
REL
REFERENCE
Data Types
Overview

Rel Data Types

This reference guide describes the various data types in Rel.

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.
NumericPrimitiveFixedDecimal[nbits, ndecimals]Fixed-sized decimals with ndecimals digits of decimal precision and total bit size of nbits.
NumericAbstractNumberUnion of all numeric data types.
TextPrimitiveCharUTF-16 characters.
TextPrimitive[String]/rel/ref/data-types/text(#string)Variable-sized strings.
TimePrimitiveDateTimeTimestamps containing date and time information.
TimePrimitiveDateDate.
TimePrimitiveYear , Month , Week, and DayDate periods.
TimePrimitiveHour, Minute, Second, Millisecond, Microsecond, and NanosecondTime periods.
KeyPrimitiveHashHash value.
KeyPrimitiveAutoNumberInteger autonumbers.
KeyAbstractEntityEntity key, union of Hash and AutoNumber.
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).
OtherPrimitiveFilePosFile positions in a data file.
OtherPrimitiveMissingSingleton representing missing data.

Rel classifies data types based on their main purpose:

CategoryDescription
NumericNumeric data types.
TextText-based data types.
TimeTime-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.

Rel also distinguishes between two 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.

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.

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

Was this doc helpful?