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:
- 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.
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 | std::decimal::FixedDecimal[nbits, ndecimals] | Fixed-sized decimals with ndecimals digits of decimal precision and total bit size of nbits . |
Numeric | Primitive | std::bignum::BigInteger | GMP BigInteger value. |
Numeric | Abstract | Number | Union of all numeric data types. |
Text | Primitive | Char | UTF-16 characters. |
Text | Primitive | String | Variable-sized strings. |
Time | Primitive | std::datetime::DateTime | Timestamps containing date and time information. |
Time | Primitive | std::datetime::Date | Date. |
Time | Primitive | std::datetime::Year , std::datetime::Month , std::datetime::Week , and std::datetime::Day | Date periods. |
Time | Primitive | std::datetime::Hour , std::datetime::Minute , std::datetime::Second , std::datetime::Millisecond , std::datetime::Microsecond , and std::datetime::Nanosecond | Time periods. |
Key | Primitive | Hash | Hash value. |
Key | Abstract | Entity | Entity key. Superclass of Hash . |
Key | Primitive | std::common::UUID | UUID value. |
Key | Primitive | std::common::SHA1 | SHA-1 value. |
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 | std::common::FilePos | File positions in a data file. |
Other | Primitive | Missing | Singleton representing missing data. |
Rel data types are classified according to their main purpose:
Category | Description |
---|---|
Numeric | Numeric data types. |
Text | Text-based data types. |
Time-Related | 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. |
There are two principal 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. |
The following sections describe the details of each supported data type and provide examples of how they can be used:
- Numeric Data Types
- Text Data Types
- Time-Related Data Types
- Value Types
- Entity Data Types
- Metadata Types
- Other Data Types