Property
Represents a single-valued attribute on entities.
A Property is a specialized Relationship that is intended
to behave like an attribute (for example, a person’s age or a pet’s name).
Unlike a general relationship, a property is treated as single-valued:
the non-output fields (all fields except the last) uniquely determine the
output field (the last field). For a typical binary property like
age(person, value), this means a given person can have at most one
age value.
Properties are usually created via Model.Property and assigned as
attributes on a Concept. Calling a property produces an
Expression that you can use in Model.define,
Model.where, and Model.require.
Examples
Section titled “Examples”Declare a property, define a couple of facts, and query:
>>> from relationalai.semantics import Model, Integer, String>>> m = Model()>>> Person = m.Concept("Person")>>> Person.name = m.Property(f"{Person} is named {String:name}")>>> Person.age = m.Property(f"{Person} is {Integer:age} years old>>> m.define(Person.new(name="Alice", age=30), Person.new(name="Bob", age=17))>>> m.where(Person.age >= 18).select(Person.name).to_df()Most users should not instantiate this class directly. Prefer
Model.Property.
The single-valued behavior is enforced by a uniqueness constraint that is added when the model is compiled. “Single-valued” means at most one output value for a given input; a property can still be missing for some entities.
Inheritance Hierarchy
Section titled “Inheritance Hierarchy”Used By
Section titled “Used By”semantics > frontend > base └── Concept └── identify_by
Referenced By
Section titled “Referenced By”RelationalAI Documentation └── Release Notes └── Python API Release Notes └── What’s New in Version 1.0.0 └── Breaking Changes