class Property

The Property class represents the properties of a Type.


You do not create Property objects directly. Accessing a property as a Type attribute returns a Property object:

import relationalai as rai

model = rai.Model("books")
Book = model.Type("Book")

with model.rule():
    Book.add(title="Foundation", author="Isaac Asimov")

# Output:
# <class 'relationalai.dsl.Property'>

Property objects may not be used as variables in a rule or query. Doing so will raise and exception:

with model.query() as select:
    title = Book.title
    author =
    title == "Foundation"  # This raises an exception.
    response = select(author) # This also raises an exception.

Property objects may be passed as arguments to std.graphs.Edge.extend() in order to add the relationships defined by a property as edges to a Graph.

See Also#