The ItemTypes, AttributeTypes and AssociationTypes can be annotated. The annotations must be a valid Json object. In fact that is all that DataStore itself checks. The annotations are intended to be used by software that uses DataStore. The convention that should be followed is that a tool uses a name that identifies a member and the value of that member are the annotations it uses. It is important to choose a name that is unlikely to clash with the name used by another tool. So the object model code generator uses "semata.datastore.objectmodel". The following is a typical annotation for an AtributeType. follows:
{ "semata.datastore.objectmodel" : [ "mandatory", "unique" ] }
Object Model Annotations
These are all contained in an array that is the value of the member "semata.datastore.objectmodel". There are default error messages, but these can be overridden.
Annotation | Applicability | Purpose |
property | AssociationType | If an Item will only have at most one association of this type it can be generated as a ValueProperty. |
mandatory | mandatory( <error_message> ) | AttributeType, AssociationType with annotation "property" | Checks that this property is not null when ItemObject is written. |
unique | unique( <error_message> ) | AttributeType | Checks that the value of this property, when not null, is unique. |
associates_prevent_delete | associates_prevent_delete( <error_message> ) | AssociationType | Checks the ItemObject being deleted does not have any associations of this type. |
delete_associates | AssociationType | When an ItemObject is deleted this cause all associated ItemObjects to be deleted. |