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.
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.
Related Posts
Dovetail Join
Dovetail Join is a WCOJ (Worst Case Optimal Join) algorithm, meaning we can mathematically prove that the more complicated the problem is, the faster we will go.
OAuth Client Self-Service
Account administrators in the RelationalAI Console can now manage OAuth Client credentials for use with the SDKs. Admins can create, edit, and delete OAuth Clients.