Does TypeDB support calculated properties?

Hey, team, I am just beginning to TypeDB, I want to deal with the follows:
To say Person has Property Height (kg), Weight(cm), and BMI = Weight/Height^2,
if BMI >26 then Person.BodyType = “Fat”
else if BMI <22 then Person.BodyType = “Thin”
else Person.BodyType = “Normal”
So, if an instance of person (name=“Bob”, Weight=80, Height=1.85) is inserted, We can automatically get bob’s BMI and BodyType property, I don’t know if this can be done easily with TypeDB.
Thanks a lot!

In short, TypeDB does not currently support calculated properties.

However, you could certainly use the reasoning rules to infer the body-type attribute based on the BMI with comparators, see Match Clause | Vaticle. You would have to do the BMI calculation outside of TypeDB before inserting it, though.

1 Like