base
relationalai.semantics.frontend
Semantics DSL building blocks.
This module defines the core frontend building blocks used to construct
RelationalAI semantics queries in Python. Objects like Variable,
Concept, Relationship, and Expression represent
symbolic expressions: you combine them with Python syntax (attributes, calls,
operators) to build a query, and the query is executed later by the RelationalAI runtime.
Examples
Section titled “Examples”Create a model, a concept, and a simple query:
>>> from relationalai.semantics import Model>>> m = Model()>>> Person = m.Concept("Person")>>> q = m.select(Person).where(Person.age >= 18)Most users start from Model and create concepts/relationships from there;
you typically do not instantiate the classes in this module directly.
Attributes
Section titled “Attributes”Attributes exposed by this module.
Primitive Union of Python primitive literal types.
Value Union of value types.
Statement Union of statement types.
StatementAndSchema Union of statement and schema types.
Classes
Section titled “Classes”Classes exposed by this module.
DSLBase Base class for semantics DSL objects.
Variable Represents a composable value in the semantics DSL.
Concept Represents an entity type (concept) in a semantic model.
NumberConcept Represents a concrete decimal `
Number(precision, scale)` concept. Ref Represents a named reference variable for entities of a concept.
Table Represents an external table reference in a semantic model.
TableSchema Represents a schema projection derived from a
Table. DerivedTable Base class for table-like query results with derived output columns.
DerivedColumn Represents one output column of a
DerivedTable. Field Describe one named field in a relationship or property.
Relationship Represents a relationship between entities in a semantic model.
Reading Represents an alternative reading for a relationship.
Property Represents a single-valued attribute on entities.
Literal Wrap a Python value so it can be used in DSL expressions.
Chain Represents a chained relationship path created by attribute access.
Expression Represents an expression in the DSL.
New Represents a "new entity" statement for a concept.
FilterBy Represents a keyword-based filter expression for a concept or reference.
FieldRef Refer to a specific field of a relationship.
TupleVariable Group multiple DSL values into a single tuple-like argument.
AsBool Represents a boolean-typed wrapper around a DSL expression.
Alias Represents a DSL value labeled with an output alias.
Match Represents a left-to-right fallback across alternative branches.
Union Represents a logical OR / union across multiple branches.
Not Represents a negated condition for use in query filters.
Distinct Represents a "distinct" wrapper for values in a query.
Group Represent grouping keys for an aggregate.
Aggregate Represents an aggregate computation in the DSL.
Data Represents a temporary table backed by in-memory data.
Fragment Represents a composable query or rule fragment.
Model Create and manage a semantic model.