Attribute structure
All attributes share a common structure based on the platform’s type system:id(number): Unique identifier for the attributename(string): Machine-readable nametype(string): One of the supported types
display_name(string): Human-readable name for UI displaydescription(string): Explanation of the attribute’s purposevalidations(string[]): Array of validation rulesmetadata(object): Additional metadata including co-occurrence data
Primitive types
Primitive types represent basic data values.| Type | Description | NQL equivalent | Example values |
|---|---|---|---|
string | Variable-length text | VARCHAR | "hello", "[email protected]" |
long | Whole numbers (64-bit signed) | BIGINT | 42, -17, 0 |
double | Double-precision decimal | DOUBLE | 3.14159, -0.001 |
boolean | True or false | BOOLEAN | true, false |
timestamptz | Date and time with timezone | TIMESTAMP | 2024-01-15T14:30:00Z |
String
Variable-length Unicode text. Can optionally include anenum property to restrict allowed values.
Basic definition:
enum property, only those values are allowed. Values are case-sensitive.
Long
64-bit signed whole numbers. Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Definition:Double
Double-precision (64-bit) floating-point numbers. Definition:Boolean
True or false values. Definition:Timestamptz
Date and time with timezone, stored in UTC. Follows ISO 8601 format. Definition:Object type
Objects group related fields into a single composite value. Useproperties to define the fields and required to specify which fields are mandatory.
Definition:
properties: Object mapping field names to field definitionsrequired: Array of field names that must be present
Array type
Arrays contain multiple values of the same type. Definition:items: Definition of the element type
Reference type
References link to other attribute definitions using their numeric ID. This enables reuse of standardized definitions. Definition:$ref: The numeric ID of the referenced attribute
- The field inherits the full type definition of the referenced attribute
- Validations from the referenced attribute apply
- Changes to the referenced attribute automatically propagate
- Reusing standardized definitions (like
event_timestamp) - Ensuring consistency across attributes
- Building complex schemas from well-defined components
Validation expressions
Validations are NQL expressions that filter out invalid values. Use$this to reference the value being validated. These expressions are injected into compiled NQL queries to enforce data quality.
Numeric validations
Comparison operators check value ranges:| Expression | Description |
|---|---|
$this >= 0 | Value must be at least 0 |
$this <= 100 | Value must be at most 100 |
$this > 0 AND $this < 1000 | Combined range check |
String length validations
UseLENGTH() to validate string length:
| Expression | Description |
|---|---|
LENGTH($this) >= 1 | At least 1 character |
LENGTH($this) <= 255 | At most 255 characters |
LENGTH($this) = 2 | Exactly 2 characters |
Pattern matching
UseLIKE for pattern validation:
| Expression | Description |
|---|---|
$this LIKE 'A%' | Starts with “A” |
$this LIKE '%@%.%' | Contains @ and . (email-like) |
Examples
Join key attributes
Primitive attributes can be marked as join keys using theis_join_key property:
Related content
Transformation Functions
Functions for mapping transformations
How Rosetta Stone Works
Understand attributes and mappings
The Normalization Model
Type system and validation concepts
Creating Normalized Attributes
Best practices for designing attributes

