-
Notifications
You must be signed in to change notification settings - Fork 3
AnnotationModelObjects

These are the objects used to form and handle the components of the different Web Annotation Models.
This defines the behaviour of groups of Polyanno objects to ensure consistency and checks, especially if importing objects from an external source rather than those generated within the package.
// Creating a colection that can only accept Polyanno.annotation objects:
var myAnnotationCollection = new Polyanno.collections(Polyanno.annotation);
// So now if a valid annotation is added, it is added to the array:
myAnnotationCollection.add(anAnnotation);
//// -->
// But a Polyanno.vector object is rejected:
myAnnotationCollection.add();
//// --> | Property | Type | Default | Description |
|---|---|---|---|
| type | Object |
Generic Javascript Object | The type of object that is to be stored in this collection, so that it can be checked. |
| array | Array |
[] | The array that the objects are stored in. |
| Method | Returns | Description |
|---|---|---|
| on( event ) | this |
Use to add event listeners for the Polyanno object. |
| trigger( event ) | this |
Use to trigger Polyanno events from this object. |
| unbind() | this |
Removes all event listeners for this object. |
| add( object ) | this |
If the object is of the type property for htis collection then it is added to the array. |
| replaceOne( object ) | this |
Replaces the object in the collection with this one's id, with the object submitted. |
| getById( the_id ) | Object |
Returns the object in this collection with this id value. |
| deleteAll() | this |
Empties the array property of the collection. |
| getAll( object, type, action ) | Array |
Returns array property for this Polyanno.collection |
| Event | Data | Description |
|---|---|---|
| polyanno_created | Triggered when a new object has been added to the collection. | |
| polyanno_updating | Triggered when an object in this collection is being updated. | |
| polyanno_deleting | Triggered when the collection is being deleted. |
These objects are the annotations as outlined and defined by the W3C Web Annotation Model standards.
var myAnnotation = new Polyanno.annotation({
body: {},
target: [
{}
]
});Basic Annotation Properties
| Property | Type | Default | Description |
|---|---|---|---|
| id | String |
Random Number String | The unique id property used to identify annotation. |
| _id | String |
Random Number String | The unique id property used to identify annotation. |
| body | Object |
null | The content of the the annotation, e.g. the transcription text. MUST be defined as an Annotation SubObject as defined below. |
| target | Array |
null | The thing(s) that the annotation is annotating e.g. the image. Each object contained MUST be defined as an Annotation SubObject as defined below. |
| creator | Object |
See the Creator Annotation Object Properties below for more information. |
Annotation Creator Object Properties
| Property | Type | Default | Description |
|---|---|---|---|
| name | String |
The unique id property used to identify annotation. | |
| motivation | String |
"identifying" |
Annotation SubObject Properties
| Property | Type | Default | Description |
|---|---|---|---|
| format | String |
||
| language | Array |
||
| processingLanguage | String |
||
| type | Array |
An array of the types, as defined by the Web Annotation Model framework. | |
| textDirection | String |
MUST be one of : "auto", "ltr", "rtl". |
| Method | Returns | Description |
|---|---|---|
| update( options ) | this |
Updates the values of the Polyanno.annotation object. |
| delete() | this |
Deletes the Polyanno.annotation object. |
| getBody() | Object |
Returns the Polyanno object that the body property of this Polyanno.annotation is referring to. |
| getTargets() | Array |
Returns array of the Polyanno objects that the target property of this Polyanno.annotation are referring to. |
| addTargets( targets ) | this |
Accepts an array of Polyanno objects and updates the target property of the annotation, automatically completing the Annotation SubObject. |
| Event | Data | Description |
|---|---|---|
| polyanno_deleting | Triggered before the object is deleted. | |
| polyanno_deleted | Triggered after the object has been deleted. | |
| polyanno_updating | Triggered before the object's properties have been updated. | |
| polyanno_updated | Triggered after the object's properties have been updated. |
The collection of Polyanno.annotation objects.
Polyanno.annotations.add(myAnnotation);- Methods inherited from Polyanno.collections with the type property set to Polyanno.annotation.
- Methods inherited from Polyanno.collections
| Method | Returns | Description |
|---|---|---|
| Polyanno.getAnnotationsByTarget( object, type, expanded ) | Array |
Returns an array of the Polyanno.annotation objects with the given target. If expanded is true then it returns the annotation object with the linking Polyanno objects as well. |
| Polyanno.getAnnotationByBody( object, expanded ) | Object |
Returns the Polyanno.annotation object with the given object as body. If expanded is true then it returns the annotation object with the linking Polyanno objects as well. |
- Events inherited from Polyanno.collections
This defines the shared characteristics of objects that are bodies or targets in annotation models.
| Property | Type | Default | Description |
|---|---|---|---|
| @context | Array |
[ "http://www.w3.org/ns/anno.jsonld" ] | Context property required for JSON-LD |
| type | Array |
An array of the types, as defined by the Web Annotation Model framework here... | |
| metadata | Array |
||
| format | String |
||
| language | Array |
||
| processingLanguage | String |
||
| textDirection | String |
MUST be one of : "auto", "ltr", "rtl". | |
| creator | Object |
See the Creator Annotation Object Properties below for more information. |
Annotation Creator Object Properties
| Property | Type | Default | Description |
|---|---|---|---|
| name | String |
The unique id property used to identify annotation. | |
| motivation | String |
"identifying" |
| Method | Returns | Description |
|---|---|---|
| on( event ) | this |
Use to add event listeners for the Polyanno object |
| trigger( event ) | this |
Use to trigger Polyanno events from this object |
| unbind() | this |
Removes all event listeners for this object |
| isAnnotationBody() | Object |
If this Polyanno object is the body of an annotation then the corresponding annotation object is returned. |
| isAnnotationTarget( type ) | Array |
If this Polyanno object is the target of annotations then the corresponding annotation objects are returned. |
| getAnnosTargetingThis( type ) | Array |
If this Polyanno object is the target of annotations then the Polyanno objects corresponding to the bodies of these annotations are returned. |
None.
This defines the shared characteristics of objects that are bodies or targets in annotation models and are primarily of textual content.
- Properties inherited from Polyanno.baseAnnotationObject
| Property | Type | Default | Description |
|---|---|---|---|
| text | String |
The textual body. | |
| vector | String |
undefined | The id property of a Polyanno.vector that identifies the same area of an image as the text. |
| parent | String |
undefined | The id property of another object of the same type that contains this text. |
| voting.up | Number |
0 | The number of up votes given to this object. |
| voting.up | Number |
0 | The number of up votes given to this object. |
- Methods inherited from Polyanno.baseAnnotationObject
- Events inherited from Polyanno.baseAnnotationObject
var myTranscription = new Polyanno.annotation({
});- Properties inherited from Polyanno.baseAnnotationObject
- Properties inherited from Polyanno.baseTextObject
| Property | Type | Default | Description |
|---|---|---|---|
| translation | String |
undefined | The id property of the Polyanno object of "the" translation into English of this transcription. |
| voting.rank | Number |
0 | How this object ranks in the voting system for its "parent" translation, if one exists, compared against alternative "children". See How It Works: Polyanno Voting for more information. |
- Methods inherited from Polyanno.baseAnnotationObject
- Methods inherited from Polyanno.baseTextObject
| Method | Returns | Description |
|---|---|---|
| update( options ) | this |
Updates the values of the Polyanno.transcription object. |
| delete() | this |
Deletes the Polyanno.transcription object. |
- Events inherited from Polyanno.baseAnnotationObject
- Events inherited from Polyanno.baseTextObject
| Event | Data | Description |
|---|---|---|
| polyanno_deleting | Triggered before the object is deleted. | |
| polyanno_deleted | Triggered after the object has been deleted. | |
| polyanno_updating | Triggered before the object's properties have been updated. | |
| polyanno_updated | Triggered after the object's properties have been updated. |
##Polyanno.transcriptions
The collection of Polyanno.transcription objects.
Polyanno.transcriptions.findById();- Methods inherited from Polyanno.collections
- Events inherited from Polyanno.collections
Currently the setup for Polyanno is working towards translations of the transcriptions into one single language but support for multiple languages may be implemented in the future. However, there are not yet anything strictly defining the language itself, will be application specific.
- Properties inherited from Polyanno.baseAnnotationObject
- Properties inherited from Polyanno.baseTextObject
| Property | Type | Default | Description |
|---|---|---|---|
| transcription | String |
undefined | The id property of the Polyanno object of the transcription of the image. |
| voting.rank | Number |
0 | How this object ranks in the voting system for its "parent" translation, if one exists, compared against alternative "children". See How It Works: Polyanno Voting for more information. |
- Methods inherited from Polyanno.baseAnnotationObject
- Methods inherited from Polyanno.baseTextObject
| Method | Returns | Description |
|---|---|---|
| update( options ) | this |
Updates the values of the Polyanno.translation object. |
| delete() | this |
Deletes the Polyanno.translation object. |
- Events inherited from Polyanno.baseAnnotationObject
- Events inherited from Polyanno.baseTextObject
| Event | Data | Description |
|---|---|---|
| polyanno_deleting | Triggered before the object is deleted. | |
| polyanno_deleted | Triggered after the object has been deleted. | |
| polyanno_updating | Triggered before the object's properties have been updated. | |
| polyanno_updated | Triggered after the object's properties have been updated. |
##Polyanno.translations
The collection of Polyanno.translation objects.
- Methods inherited from Polyanno.collections
- Events inherited from Polyanno.collections
The vectors are the shapes that select the region of the image containing the text. They are created and defined through the Leaflet Draw package but for the purposes of linking them consistently in the annotation models they can be handled as Polyanno objects, that are "notGeoJSONs" (the basic GeoJSON structure but with the term "not" appended to the beginning of the fields due to the lack of support for GeoJSONs using a simple coordinate system) with additional properties added.
- Properties inherited from Polyanno.baseAnnotationObject
| Property | Type | Default | Description |
|---|---|---|---|
| notFeature | notFeature Object |
See the properties of the notFeature Object below. | |
| coordinates | Array |
[] | The coordinates of the polygon as defined in the GeoJSON format. |
| OCD | Array |
[] | An array of the coordinate arrays of the polygons that make up the Optimal Convex Decomposition breakdown of the vector shape if it is not fully convex. |
| parent | String |
undefined | The id property of the next largest shape vector to contain this one inside, if it exists. |
| transcription_fragment | String |
undefined | The id property of the transcription of the area of the image covered by this vector, if it exists. |
| translation_fragment | String |
undefined | The id property of "the" translation into English of the area of the image covered by this vector, if it exists. |
| layer | String |
undefined | The id of the Leaflet layer defining the vector shape. |
| coordinates | Array |
undefined | Alternative method of accessing the coordinate information. |
Properties of the notFeature Object
| Property | Type | Default | Description |
|---|---|---|---|
| notType | String |
"Feature" | The type of GeoJSON format. |
| notGeometry | Object |
{ notType: "Polygon" } | The Geometry object as defined by the GeoJSON format. |
| notCrs | Object |
{ notType: "name", notProperties: "L.CRS.Simple" } | The Coordinate reference system used by Leaflet to define the location of the vectors relative to the IIIF image. |
- Methods inherited from Polyanno.baseAnnotationObject
- Events inherited from Polyanno.baseAnnotationObject
| Event | Data | Description |
|---|---|---|
| polyanno_deleting | Triggered before the object is deleted. | |
| polyanno_deleted | Triggered after the object has been deleted. | |
| polyanno_updating | Triggered before the object's properties have been updated. | |
| polyanno_updated | Triggered after the object's properties have been updated. |
- Methods inherited from Polyanno.collections
- Events inherited from Polyanno.collections