Rel Data Types
This reference guide describes the various data types in Rel.
Overview
Category | Name | Description | |
---|---|---|---|
Numeric | Primitive | SignedInt[8] , SignedInt[16] , SignedInt[32] , SignedInt[64] , and SignedInt[128] | Signed integers. |
Numeric | Primitive | UnsignedInt[8] , UnsignedInt[16] , UnsignedInt[32] , UnsignedInt[64] , and UnsignedInt[128] | Unsigned integers. |
Numeric | Primitive | Floating[16] , Floating[32] , and Floating[64] | Floating-point numbers. |
Numeric | Primitive | Rational[8] , Rational[16] , Rational[32] , Rational[64] , and Rational[128] | Rational numbers. |
Numeric | Primitive | FixedDecimal[nbits, ndecimals] | Fixed-sized decimals with ndecimals digits of decimal precision and total bit size of nbits . |
Numeric | Abstract | Number | Union of all numeric data types. |
Text | Primitive | Char | UTF-16 characters. |
Text | Primitive | [String ]/rel/ref/data-types/text(#string) | Variable-sized strings. |
Time | Primitive | DateTime | Timestamps containing date and time information. |
Time | Primitive | Date | Date. |
Time | Primitive | Year , Month , Week , and Day | Date periods. |
Time | Primitive | Hour , Minute , Second , Millisecond , Microsecond , and Nanosecond | Time periods. |
Key | Primitive | Hash | Hash value. |
Key | Primitive | AutoNumber | Integer autonumbers. |
Key | Abstract | Entity | Entity key, union of Hash and AutoNumber . |
Meta | Primitive | RelName | Symbols. Can be used to specify names of relations. |
Other | Abstract | Any | Union of all data types. |
Other | Primitive | boolean_true and boolean_false | Boolean data type (for JSON support only). |
Other | Primitive | FilePos | File positions in a data file. |
Other | Primitive | Missing | Singleton representing missing data. |
Rel classifies data types based on their main purpose:
Category | Description |
---|---|
Numeric | Numeric data types. |
Text | Text-based data types. |
Time | Time-related data types. |
Key | Data types for identification purposes, such as UUIDs. |
Meta | Data types referring to metadata information (such as relation names). |
Other | All other supported data types. |
Rel also distinguishes between two kinds of data types:
Description | |
---|---|
Primitive | Data types with no further subtypes. |
Abstract | Data 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:
- A way to construct values of that data type.
- A type relation that tests if a given value belongs to that type.
- Operations specific to the data type.
The following sections describe each supported data type and provide examples of how they can be used:
- Numeric Data Types
- Text Data Types
- Time-Related Data Types
- Entity Data Types
- Metadata Types
- Other Data Types