Annotations

NOTE! This document is outdated and has been replaced with newer documentation. See The database schema and the Data Layer API

This document explains how annotations are implemented in BASE.

See also

Last updated: $Date: 2009-04-06 14:52:39 +0200 (må, 06 apr 2009) $


AnnotationSets

The AnnotationSetData [API] class holds all annotations for a single item. An item must implement the AnnotatableData [API] interface which defines the annotationSet property for that item.

Each annotation set can contain annotations that are directly associated with the item (primary annotations). These annotations are available in the annotations property. This property is a map with an AnnotationType as the key. Thus an annotation set can contain only one annotation of a specific annotation type.

The annotation set can also contain inherited annotations and annotation sets. These are found in the inherited and inheritedSets properties. Logically the inherited annotations should come from one of the parent items, but this is more or less impossible to check. There are no restrictions on the annotation types of the inherited annotations.

Annotations

The AnnotationData [API] class is the placeholder for an annotation. It must have a type and belong to an annotation set. The actual annotation values are stored as ParameterValueData objects. Note that it is possible for an annotation to have multiple values.

AnnotationTypes

The AnnotationTypeData [API] class defines the various annotations. It must have a valueType property which cannot be changed. The value of this property controls which ParameterValueData subclass is used to store annotation values, ie. IntegerParameterValueData, StringParameterValueData. The multiplicity property holds the maximum allowed number of values for an annotation, or 0 if an unlimited number is allowed.

The itemTypes collection holds the codes for the types of items the annotation type can be used on. This is checked when new annotations are created but already existing annotations are not affected if the collection is modified.

Annotation types with the protocolParameter flag set are treated a bit differently. They will not show up as annotations to items with a type found in the itemTypes collection. A protocol parameter should be attached to a Protocol. Then, when an item is using that protocol it becomes possible to add annotation values for the annotation types specified as protocol parameters. It doesn't matter if the item's type is found in the itemTypes collection or not.

The options collection is used to store additional options required by some of the value types, for example a max string length for string annotations or the max and min allowed value for integer annotations.

The enumeration property is a boolean flag indicating if the allowed values are predefined as an enumeration. In that case those values are found in the enumerationValues property. The actual subclass is determined by the valueType property.

Most of the other properties are hints to client applications how to render the input field for the annotation.

AnnotationTypeCategories

The AnnotationTypeCategory [API] class defined categories that are used to group annotation types that are related to each other. This information is mainly useful for client applications when displaying forms for annotating items, that wish to provide a clearer interface when there are many (say 50+) annotations type for an item.

An annotation type can belong to more than one category.