Skip to content
Roy Lechich edited this page Jul 26, 2017 · 4 revisions

Data Mapping

ORM Mapping from the IIIF Object (JSON format) to the Relational record

Without listing the schema for the annotation, list and layer models (see /db/schema.rb), it is just noted here that the relational data design was based on an approach attempting to balance simple database normalization techniques with the desire to keep some of the IIIF model data intact in some of the fields. The CRUD methods deal with parsing the passed-in IIIF JSON data for these three objects and serializing them into the db records, and the model.to_iiif methods render them back to IIIF-compliant JSON objects as needed:

  • Annotation#to_iiif
  • AnnotationList#to_iiif
  • AnnotationLayer#to_iiif

Some convenience fields were added to make it easier to get at certain commonly-accessed values, such as label or canvas, without having to parse through several layers of a JSON object. This is potentially an area for optimization, but currently seems adequate.

Clone this wiki locally