Derived Properties
Property with a value which is being derived/calculated from other properties. E.g.
MVP Option 1 (string concatenation/format strings)
Property("first name", datatype=db.TEXT).insert()
Property("last name", datatype=db.TEXT).insert()
Property("full name", datatype=db.TEXT, derived="{first name} {last name}").insert()
r = Record().add_property("first name", "Anna").add_property("last name", "Lytics").add_property("full name").insert()
assert r.get_property("full name").value == "Anna Lytics"
which results in a property which has a value which is automatically being set by the server during write transactions.
In a first version, this is only possible for string concatenation. But it is is the goal to have more flexible definition involving other string operations and possibly values with other data types, e.g. mean values of doubles, and derived values from the properties of referenced entities
MVP Option 2 (copy properties of referenced entities)
Property("Species", datatype=db.TEXT).insert()
sample = Record("Sample").add_property("Species", "Hering").insert()
r = Record("DNA-Sample").add_property("Sample", sample).add_property("Species", derived="{Sample.Species}).insert()
assert r.get_property("Species").value == "Hering"
- If sample is not readable (current user lacks RETRIEVE permission) the value is None (?)
- The value of "Species" of "DNA-Sample" is calculated on-the-fly during retrieval and not stored persistently
- This change is backwards compatible for read operations. Server will ignore attempts to update the value and issue a warning.
- Edit-mode should be aware that this value cannot be updated (at least).
- No need to touch the mariadbbackend for now.
- Query will not know about derived values for now
First rough estimation (G (pylib, cpplib, grpc-api, webui, server)