Field
relationalai.semantics.frontend.base
Field( name: str, type_: Concept, is_input: bool = False, is_list: bool = False, source: SourcePos | None = None,)Describe one named field in a relationship or property.
A Field pairs a field name with a Concept type and marks
whether the field is an input and/or list-valued.
Fields are usually created implicitly by parsing a reading string. You
typically construct Field objects only when creating a relationship or
property with the explicit fields= keyword argument via
Model.Relationship or Model.Property.
Parameters
Section titled “Parameters”
(namestr) - Field name used for indexing and display.
(type_Concept) - Concept type of the field.
(is_inputbool, default:False) - Whether this field is an input field. In most relationships/properties, all but the last field are inputs and the final field is the output.
(is_listbool, default:False) - Whether the field represents a list of values.
(sourceSourcePos|None, default:None) - Optional source position used for error reporting.
Examples
Section titled “Examples”Most fields are created implicitly by parsing a reading string:
>>> from relationalai.semantics import Integer, Model, String>>> m = Model()>>> Person = m.Concept("Person", identify_by={"id": Integer})>>> Person.name = m.Property(f"{Person} has {String:name}")>>> # The Property constructor parses the reading string and produces an>>> # input field of type Person and an output field named "name" of type String.You can also declare fields explicitly via fields=. For example,
the following is equivalent to the previous example:
>>> from relationalai.semantics.frontend.base import Field>>> Person.name = m.Property(... fields=[Field("person", Person), Field("name", String)],... short_name="name"... )Attributes
Section titled “Attributes”Used By
Section titled “Used By”semantics > frontend > base ├── FieldRef ├── Model │ ├── Property │ └── Relationship ├── Property ├── Reading ├── Relationship └── Value
Referenced By
Section titled “Referenced By”RelationalAI Documentation └── Build With RelationalAI └── Understand how PyRel works > Build a semantic model └── Declare relationships and properties ├── Declare a property withModel.Property└── Declare a relationship withModel.Relationship