Annotation
The Annotation
interface represents an annotation in Annotorious.
The Annotorious model aligns closely with the W3C Web Annotation Data Model, but has a few key differences and simplifications which are explained in detail in this guide.
Example
Here’s an example of a typical annotation object:
Properties
id
- Type: string
A unique identifier for the annotation. Note that Annotorious will automatically insert a UUID if you supply annotations without ID to the loadAnnotations, setAnnotations or addAnnotation methods.
target
- Type: AnnotationTarget
Describes the part of the image that is being annotated.
bodies
- Type: AnnotationBody[]
An array of bodies associated with this annotation. Bodies carry the payload of the annotation, such as comments, tags, or other metadata.
properties
- Type:
{ [key: string]: any }
- Optional
An object that can hold any custom properties you want to associate with the annotation.
AnnotationTarget
The AnnotationTarget
interface represents the part of the image being annotated.
annotation
- Type: string
For the purpose of internal state management, Annotorious records the ID of the parent
annotation in this field. Note that Annotorious will fill this field automatically if
you provide an AnnotationTarget without an annotation
field through the
loadAnnotations,
setAnnotations or
addAnnotation methods.
selector
- Type: Shape
Describes the exact area of the image being annotated. The structure of the selector depends on the shape type (e.g., rectangle, polygon).
creator
- Type: User
- Optional
The creator of this annotation target.
created
- Type: Date
- Optional
The timestamp of the target’s creation.
updatedBy
- Type: User
- Optional
The user who last updated this annotation target.
updated
- Type: Date
- Optional
The timestamp the annotation target was last updated.
AnnotationBody
The AnnotationBody
interface represents a piece of content associated with an annotation.
id
- Type: string
A globally unique UUID for the body.
annotation
- Type: string
For the purpose of internal state management, Annotorious records the ID of the parent
annotation in this field. Note that Annotorious will fill this field automatically if
you provide an AnnotationBody without an annotation
field through the
loadAnnotations,
setAnnotations or
addAnnotation methods.
type
- Type: string
- Optional
The type of the body content (e.g., TextualBody
).
purpose
- Type: Purpose | string
- Option
The purpose of the body. Can be one of the predefined purposes, or any custom string.
value
- Type: string
- Optional
The content of the body (e.g. a comment text or tag).
creator
- Type: User
- Optional
The creator of this annotation body.
created
- Type: Date
- Optional
The timestamp of the body’s creation.
updatedBy
- Type: User
- Optional
The user who last updated this annotation body.
updated
- Type: Date
- Optional
The timestamp the annotation body was last updated.
Purpose
You can use any string of your choice for the purpose
field of the
AnnotationBody
. However, it is recommended to use the purpose values
predefined in the W3C model for better interoperability with other
systems.
For convenience, Annotorious provides IDE auto-complete support for these standard purposes: