Skip to content

Configuring Annotations in Mirador

Jack Reed edited this page May 19, 2020 · 1 revision

Annotations in Mirador

Displaying Annotations Linked from the Manifest

Manifests that contain valid Annotation Lists will automatically be displayed in Mirador

Setting Up a Backend Annotation Store

You can use any annotation database to store/retrieve annotations for Mirador. This requires writing an adaptor in Mirador to communicate with your database (see Enabling Mirador to Communicate With a Backend)

Available Backends

Enabling Mirador to Communicate With a Backend

If you are using an annotation database that does not already have an available adaptor module, you will need to write an adaptor by extending endpoint.js. Mirador requires all annotations to use the Open Annotation Data Model. If your database does not use this model, your adaptor will need to handle converting between OA and the database format.

Required Adaptor Properties

  • annotationsList - a current list of open annotations
  • dfd - a Deferred object that is resolved when searches are complete

Required Adaptor Methods

  • init() : initializes any adaptor-specific properties
  • search(options, successCallback, errorCallback) : searches the endpoint given a set of key/value pair options. On success of the AJAX call, this function updates annotationsList with the latest set of open annotations and resolves the dfd object. If the endpoint does not return open annotations, use the optional method getAnnotationInOA.
    • Currently, Mirador only passes in {"uri" : "[canvas-id]"} as the options object
  • create(oaAnnotation, successCallback, errorCallback) : passes a new annotation to the endpoint. If the endpoint does not use the OA model, use the optional method getAnnotationInEndpoint. Upon successful creation of the annotation, this method passes the open annotation to successCallback. Mirador supplies success and error callbacks when it calls this method.
  • update(oaAnnotation, successCallback, errorCallback) : passes an existing OA annotation that needs to be updated in the endpoint. If the endpoint does not use the OA model, use the optional method getAnnotationInEndpoint. Mirador supplies success and error callbacks when it calls this method.
  • deleteAnnotation(annotationID, successCallback, errorCallback) : deletes an existing annotation in the endpoint by the annotation's id. Mirador supplies success and error callbacks when it calls this method.
  • set(prop, value, options) : setter for adaptor properties.

Optional Adaptor Methods

If your database does not use OA, you will need to write the following methods

  • getAnnotationInOA(annotation) : converts an endpoint annotation to OA
  • getAnnotationInEndpoint(oaAnnotation) : converts an open annotation to the endpoint model
  • any other methods your endpoint needs

Available Adaptor Modules

Configuration Options

Required Options

"annotationEndpoint" :
{
 "name" : "Name of backend",
 "module" : "NameEndpoint" (e.g. CatchEndpoint)
}

Module-specific Options

"annotationEndpoint" :
{
 "name" : "Name of backend",
 "module" : "NameEndpoint", //e.g. CatchEndpoint
 "options" : {
   key1 : value1, //whatever the endpoint needs, such as URL, API Key, etc
   key2 : value2
 }
}