Skip to content

Rel Data Types Reference


We are excited to add a new reference guide to our rapidly growing documentation. The Rel Data Types Guide (opens in a new tab) describes the various built-in data types in Rel along with examples of how they can be used.

Rel Data Types

The guide shows for each data type:

  • how to construct values of that data type,
  • how to test if a given value belongs to that type, and
  • common operations specific to the data type.

For instance, we can write relations with different data types, and filter on entries that have specific types:

// read query
def R = {1; 0.5; :a; 'C'; "abc"}
def output(x) = R(x) and (Char(x) or Int(x))

A Rel model does not have to specify the types of all relations in advance, since they are inferred and tracked automatically, but we still have the option to specify and enforce typed schemas using Integrity Constraints, if we choose to do so.

For example, we can specify that the relation price always relates an integer ID with a price that is stored as fixed–decimal with 2 decimals places:

ic price_types_constraint {
    subset(price, (Int, FixedDecimal[64, 2]))

These constraints can be added, removed or adjusted as your model or knowledge graph grows.

Get Started!

Start your journey with RelationalAI today! Sign up to receive our newsletter, invitations to exclusive events, and customer case studies.

The information you provide will be used in accordance with the terms of our Privacy Policy. By submitting this form, you consent to allow RelationalAI to store and process the personal information submitted above to provide you the content requested.