Parameterized Properties¶
In a normal Flora “triple” such as:
Greg [ child -> Louisa ].
we essentially have a relation child with two arguments: the parent and the child. But sometimes a relation involves more than two entities. For example,
BankAccount [| monthBalance(\integer,\integer) {0..1} => \double |].
MyBankAccount : BankAccount [
monthBalance(2014,1) -> 3000000,
monthBalance(2014,2) -> -3200000
].
The first statement declares a class BankAccount, with a property monthBalance. Unlike our previous examples, the property is not an atomic term like child. Instead, the property is now a compound term. The schema frame asserts that the property takes two parameters, both of type \integer, and the property value is of type \double (two built-in Flora types). The intended use is that the first parameter represents a year, and the second a month. Note that the cardinality restriction refers to each “instantiation” of the property. In other words, there can be at most one balance for each year-month pair.
The second statement declares an instance of the BankAccount class, with two values for the monthBalance property, for two given year-month pairs.
Boolean properties can also be parameterized. For example, consider a property positiveBalance, that takes a year-month pair like the previous example:
BankAccount [| =>positiveBalance(\integer,\integer) |].
MyBankAccount : BankAccount [ positiveBalance(2014,1) ].
Sometimes it is not clear whether something should be a parameterized boolean property or a regular property, i.e. which one of these two forms should be used:
a [b(c)]. // parameterized boolean property
a [b -> c]. // regular property
In most cases the second form is preferable.