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
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)Notes
Most users start from Model and create concepts/relationships from there;
you typically do not instantiate the classes in this module directly.
Attributes
Attributes exposed by this module.
PrimitiveUnion of Python primitive literal types.
ValueUnion of value types.
StatementUnion of statement types.
StatementAndSchemaUnion of statement and schema types.
Functions
Functions exposed by this module.
generates_rules()Mark a function or method that deliberately creates many rules.
Classes
Classes exposed by this module.
DSLBaseBase class for semantics DSL objects.
VariableRepresents a composable value in the semantics DSL.
ConceptRepresents an entity type (concept) in a semantic model.
NumberConceptRepresents a concrete decimal
Number(precision, scale) concept.RefRepresents a named reference variable for entities of a concept.
TableRepresents an external table reference in a semantic model.
TableSchemaRepresents a schema projection derived from a
Table.DerivedTableBase class for table-like query results with derived output columns.
DerivedColumnRepresents one output column of a
DerivedTable.FieldDescribe one named field in a relationship or property.
RelationshipRepresents a relationship between entities in a semantic model.
ReadingRepresents an alternative reading for a relationship.
PropertyRepresents a single-valued attribute on entities.
LiteralWrap a Python value so it can be used in DSL expressions.
ChainRepresents a chained relationship path created by attribute access.
ExpressionRepresents an expression in the DSL.
NewRepresents a "new entity" statement for a concept.
FilterByRepresents a keyword-based filter expression for a concept or reference.
LookupByRepresents a keyword-based lookup expression rooted at a reference.
FieldRefRefer to a specific field of a relationship.
TupleVariableGroup multiple DSL values into a single tuple-like argument.
AsBoolRepresents a boolean-typed wrapper around a DSL expression.
AliasRepresents a DSL value labeled with an output alias.
MatchRepresents a left-to-right fallback across alternative branches.
UnionRepresents a logical OR / union across multiple branches.
NotRepresents a negated condition for use in query filters.
DistinctRepresents a "distinct" wrapper for values in a query.
GroupRepresent grouping keys for an aggregate.
AggregateRepresents an aggregate computation in the DSL.
DataRepresents a temporary table backed by in-memory data.
FragmentRepresents a composable query or rule fragment.
ModelCreate and manage a semantic model.