FieldRef
FieldRef(root: Chain | Relationship | Expression, field: str | int | Concept)Refer to a specific field of a relationship.
FieldRef objects are created by indexing a Relationship,
Chain, or Expression (for example, Person.pets["pet_name"]).
They are commonly used to select, join, or filter on non-output fields of a relationship.
Parameters
Section titled “Parameters”
(rootChain|Relationship|Expression) - The relationship-like object being indexed.
(fieldstr|int|Concept) - The selector used to identify the field (name, 0-based index, or field concept type).
Most users should not construct FieldRef objects directly. Prefer
indexing helpers such as
Relationship.__getitem__,
Chain.__getitem__, and
Expression.__getitem__.
Methods
Section titled “Methods”.__getattr__()
Section titled “.__getattr__()”FieldRef.__getattr__(item)Return a chained relationship reference for attribute access.
A FieldRef behaves like a variable of its field’s Concept
type. Accessing Person.works_for["company"].name returns a
Chain rooted at this field reference.
If the attribute name starts with an underscore, this method defers to normal Python attribute access so internal attributes remain accessible.
Parameters:
(itemstr) - Relationship/property name to access on the field’s concept type.
Returns:
Chain- A chained value representing the relationship reading.
Raises:
relationalai.util.error.RAIException- Raised in the following cases:- The field’s concept type does not declare the relationship and
implicit properties are disabled (
model.implicit_propertiesconfig flag). - Relationships are accessed on a core concept,
like
CoreConcepts.StringorCoreConcepts.Integer.
- The field’s concept type does not declare the relationship and
implicit properties are disabled (
Inheritance Hierarchy
Section titled “Inheritance Hierarchy”Used By
Section titled “Used By”semantics > frontend > base └── Chain
Returned By
Section titled “Returned By”semantics > frontend > base ├── Chain │ └── __getitem__ ├── Expression │ └── __getitem__ └── Relationship └── __getitem__
Referenced By
Section titled “Referenced By”RelationalAI Documentation
└── Build With RelationalAI
└── Understand how PyRel works > Build a semantic model
└── Query a model
└── Select values with select