An Annotation Collection is a collection of Annotation Pages from the Web Annotation standard. Each Project has at least one Layer, which is encoded as an Annotation Collection, saved to RERUM (db driver "tiny"). This Linked Data standard adds a few requirements and a minimal example will look like this:
In this document, @context, type, and @id are required and will be constant values. The label is provided by the Interface (User input or generated), creator is the authenticated User agent. The list of items provided by the request will determine the values for total (a count), and first and last. The accessory partOf property holds a public pointer back to the TPEN project built from the Project stub or hexString portion of the Project _id and the static TPEN cache.
The @id of this object will be the reference recorded into the Project record in the local "mongo" database. The hex portion of the @id can be generated ahead of time so that you do not have to wait for all the create actions to complete. #93 shows what the Project looks like and updating it can be stubbed and is not in scope for this.
The API expects to save a list of Annotation Pages, aligning with Canvases from the linked Manifest(s) on the Project.
Expected Behavior
The API will be waiting for a POST at /project/{:id}/addLayer with :id as the stub or _id hexString with an effective payload like:
Note: The target property is unusual on an Annotation Page, but is used here appropriately to link the Manifest(s) being annotated and the related Project via their member Canvas and Layer documents.
A valid Layer must have at least 1 Annotation Page, which in turn have 0 or more Annotations. Though an id can be prepopulated, it is not invalid to leave it off the API request. Similarly, a label is optional, however helpful. In this way, the minimal valid request is { "items" : [ "target" : "https://manifest/canvas/1" ] } representing an unannotated singular image without description.
The API service is responsible for building out the various documents in this Collection.
An AnnotationFactory() can mint an _id, validate the target, inherit the @context, and define the type for any included Annotations.
An AnnotationPageFactory() also mints _ids, validates targets, adds a default @context and type, generates a creator (from User) and partOf (from Collection URI), and assigns the correct values for next and previous properties (keeping order from the request).
An AnnotationCollectionFactory() mints the _id, adds the creator, @context, type, counts the total, and generates the partOf like "https://static.t-pen.org/{stud || hex}/project.json" (matching the pattern from the request {:id}.
All new documents (Annotation Collection, Annotation Page(s), Annotations) are saved to "tiny"
Project is updated with a new entry in the layers Array in "mongo"
Make sure tests for these pieces stay in scope; we don't need testing all the way along, but we need to promise that invalid documents error out and that no matter what the final format meets minimum requirements.
An Annotation Collection is a collection of Annotation Pages from the Web Annotation standard. Each Project has at least one Layer, which is encoded as an Annotation Collection, saved to RERUM (db driver "tiny"). This Linked Data standard adds a few requirements and a minimal example will look like this:
In this document,
@context
,type
, and@id
are required and will be constant values. Thelabel
is provided by the Interface (User input or generated),creator
is the authenticated User agent. The list ofitems
provided by the request will determine the values fortotal
(a count), andfirst
andlast
. The accessorypartOf
property holds a public pointer back to the TPEN project built from the Projectstub
or hexString portion of the Project_id
and the static TPEN cache.The
@id
of this object will be the reference recorded into the Project record in the local "mongo" database. The hex portion of the@id
can be generated ahead of time so that you do not have to wait for all the create actions to complete. #93 shows what the Project looks like and updating it can be stubbed and is not in scope for this.The API expects to save a list of Annotation Pages, aligning with Canvases from the linked Manifest(s) on the Project.
Expected Behavior
The API will be waiting for a POST at
/project/{:id}/addLayer
with:id
as thestub
or_id
hexString with an effective payload like:however, since much of this is boilerplate or otherwise available to the API, it simplifies to:
A valid Layer must have at least 1 Annotation Page, which in turn have 0 or more Annotations. Though an
id
can be prepopulated, it is not invalid to leave it off the API request. Similarly, alabel
is optional, however helpful. In this way, the minimal valid request is{ "items" : [ "target" : "https://manifest/canvas/1" ] }
representing an unannotated singular image without description.The API service is responsible for building out the various documents in this Collection.
_id
, validate thetarget
, inherit the@context
, and define thetype
for any included Annotations._id
s, validatestarget
s, adds a default@context
andtype
, generates acreator
(from User) andpartOf
(from Collection URI), and assigns the correct values fornext
andprevious
properties (keeping order from the request)._id
, adds thecreator
,@context
,type
, counts thetotal
, and generates thepartOf
like "https://static.t-pen.org/{stud || hex}/project.json" (matching the pattern from the request{:id}
.layers
Array in "mongo"