There are cases where you might need to have an attribute reference an item from another attribute. For example in hydrology you may want have one attribute (A) represent a set of sediments as an extensible list of items that will be defined by the user. Another attribute (B) would then represent a bed layer structure where each layer in B would refer to one of the sediments stored in A along with a bed layer thickness.
In this case we need an attribute item that can refer to another item. Its definition would be analogous to reference item in that it would represent the constraints determining which items it can refer to.
For the second use case, let’s assume that we have a valid simulation and want to represent variations of the original. We could just copy the base and change what we want. The drawbacks with this approach would include:
- Difficulty in knowing what has been changed in the variant with respect to the base
- If you want change the base and have those changes reflected in each variant you would need to manually copy those changes (except in the places where you’ve explicitly changed the values)
- You would have no means of restricting which items the user should be allowed to change within a variant
This case is slightly different from the first that in addition to referring to an item you also need to store a new value for the item.
The Variant Item would have an Item Definition pretty similar to the above Item Reference Definition. The item itself would be a bit more complicated. It would use the referenced item’s definition to create a copy of the referenced item. This copy would be used to store the variant’s new value. We should be able to use the existing qt classes to view the internal variant value.