-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recipe #309 annotation collections #521
Open
robcast
wants to merge
28
commits into
master
Choose a base branch
from
309-annotation-collections
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
764b5e5
first half of annotation collections.
robcast 84657f3
first half of annotation collections recipe.
robcast 947c13a
in progress.
robcast fae2109
merge from master branch.
robcast c002dc6
first example with json.
robcast c8629e8
Update preview.yml
glenrobson c858ffa
working on annotations.
robcast 84cc61b
Merge branch '309-annotation-collections' of [email protected]:IIIF/cook…
robcast b4a5b08
more annotations.
robcast 15ce65e
small fixes.
robcast 363c005
more complete version.
robcast 89cae76
add page linking information to reference stub.
robcast e6e65f1
add missing "prev" links.
robcast 37b664f
updated with feedback from editors.
robcast 038efda
fixed json highlight.
robcast 3d38d59
reworked the part about embedded properties in the manifest.
robcast a1b5bb4
fix manifest json viewer highlighting.
robcast ad13968
fix highlighting again.
robcast c38ff45
fix highlighting again.
robcast a5ce41b
Enabling validation
glenrobson 3c5baaf
Turning next into a resource
glenrobson 9077a76
Turning prev into resource
glenrobson 9aaa55b
add data model diagram.
robcast 8827f8e
try diagram with white background.
robcast 6328c22
Merge branch 'master' into 309-annotation-collections
robcast 2131874
Restoring back to a string
glenrobson 35fb52d
Restoring prev to string
glenrobson 4a6c51f
Merge pull request #552 from IIIF/glenrobson-patch-2
glenrobson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"@context": "http://iiif.io/api/presentation/3/context.json", | ||
"id": "{{ id.url }}", | ||
"type": "AnnotationCollection", | ||
"label": { | ||
"en": [ | ||
"Newspaper layout markup" | ||
] | ||
}, | ||
"total": 8, | ||
"first": "{{ id.path }}/anno_p1.json", | ||
"last": "{{ id.path }}/anno_p2.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"@context": "http://iiif.io/api/presentation/3/context.json", | ||
"id": "{{ id.url }}", | ||
"type": "AnnotationPage", | ||
"partOf": [{ | ||
"id": "{{ id.path }}/anno_coll.json", | ||
"type": "AnnotationCollection" | ||
}], | ||
"next": "{{ id.path }}/anno_p2.json", | ||
"items": [ | ||
{ | ||
"id": "{{ id.url }}-1", | ||
"type": "Annotation", | ||
"motivation": "tagging", | ||
"body": { | ||
"type": "TextualBody", | ||
"format": "text/plain", | ||
"value": "text-1-1" | ||
}, | ||
"target": { | ||
"type": "SpecificResource", | ||
"source": { | ||
"id": "{{ id.path }}/canvas/p1", | ||
"type": "Canvas", | ||
"partOf": [{ | ||
"id": "{{ id.path }}/manifest.json", | ||
"type": "Manifest" | ||
}] | ||
}, | ||
"selector": { | ||
"type": "FragmentSelector", | ||
"conformsTo": "http://www.w3.org/TR/media-frags/", | ||
"value": "xywh=88,957,2768,248" | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "{{ id.url }}-2", | ||
"type": "Annotation", | ||
"motivation": "tagging", | ||
"body": { | ||
"type": "TextualBody", | ||
"format": "text/plain", | ||
"value": "text-1-2" | ||
}, | ||
"target": { | ||
"type": "SpecificResource", | ||
"source": { | ||
"id": "{{ id.path }}/canvas/p1", | ||
"type": "Canvas", | ||
"partOf": [{ | ||
"id": "{{ id.path }}/manifest.json", | ||
"type": "Manifest" | ||
}] | ||
}, | ||
"selector": { | ||
"type": "FragmentSelector", | ||
"conformsTo": "http://www.w3.org/TR/media-frags/", | ||
"value": "xywh=80,1181,928,3384" | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "{{ id.url }}-3", | ||
"type": "Annotation", | ||
"motivation": "tagging", | ||
"body": { | ||
"type": "TextualBody", | ||
"format": "text/plain", | ||
"value": "text-1-3" | ||
}, | ||
"target": { | ||
"type": "SpecificResource", | ||
"source": { | ||
"id": "{{ id.path }}/canvas/p1", | ||
"type": "Canvas", | ||
"partOf": [{ | ||
"id": "{{ id.path }}/manifest.json", | ||
"type": "Manifest" | ||
}] | ||
}, | ||
"selector": { | ||
"type": "FragmentSelector", | ||
"conformsTo": "http://www.w3.org/TR/media-frags/", | ||
"value": "xywh=1000,2693,1880,1824" | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "{{ id.url }}-4", | ||
"type": "Annotation", | ||
"motivation": "tagging", | ||
"body": { | ||
"type": "TextualBody", | ||
"format": "text/plain", | ||
"value": "text-2" | ||
}, | ||
"target": { | ||
"type": "SpecificResource", | ||
"source": { | ||
"id": "{{ id.path }}/canvas/p1", | ||
"type": "Canvas", | ||
"partOf": [{ | ||
"id": "{{ id.path }}/manifest.json", | ||
"type": "Manifest" | ||
}] | ||
}, | ||
"selector": { | ||
"type": "FragmentSelector", | ||
"conformsTo": "http://www.w3.org/TR/media-frags/", | ||
"value": "xywh=992,1213,1904,1472" | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"@context": "http://iiif.io/api/presentation/3/context.json", | ||
"id": "{{ id.url }}", | ||
"type": "AnnotationPage", | ||
"partOf": [{ | ||
"id": "{{ id.path }}/anno_coll.json", | ||
"type": "AnnotationCollection" | ||
}], | ||
"prev": "{{ id.path }}/anno_p1.json", | ||
"items": [ | ||
{ | ||
"id": "{{ id.url }}-1", | ||
"type": "Annotation", | ||
"motivation": "tagging", | ||
"body": { | ||
"type": "TextualBody", | ||
"format": "text/plain", | ||
"value": "text-3-1" | ||
}, | ||
"target": { | ||
"type": "SpecificResource", | ||
"source": { | ||
"id": "{{ id.path }}/canvas/p2", | ||
"type": "Canvas", | ||
"partOf": [{ | ||
"id": "{{ id.path }}/manifest.json", | ||
"type": "Manifest" | ||
}] | ||
}, | ||
"selector": { | ||
"type": "FragmentSelector", | ||
"conformsTo": "http://www.w3.org/TR/media-frags/", | ||
"value": "xywh=856,381,928,4200" | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "{{ id.url }}-2", | ||
"type": "Annotation", | ||
"motivation": "tagging", | ||
"body": { | ||
"type": "TextualBody", | ||
"format": "text/plain", | ||
"value": "text-3-2" | ||
}, | ||
"target": { | ||
"type": "SpecificResource", | ||
"source": { | ||
"id": "{{ id.path }}/canvas/p2", | ||
"type": "Canvas", | ||
"partOf": [{ | ||
"id": "{{ id.path }}/manifest.json", | ||
"type": "Manifest" | ||
}] | ||
}, | ||
"selector": { | ||
"type": "FragmentSelector", | ||
"conformsTo": "http://www.w3.org/TR/media-frags/", | ||
"value": "xywh=1784,2461,952,2064" | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "{{ id.url }}-3", | ||
"type": "Annotation", | ||
"motivation": "tagging", | ||
"body": { | ||
"type": "TextualBody", | ||
"format": "text/plain", | ||
"value": "text-3-3" | ||
}, | ||
"target": { | ||
"type": "SpecificResource", | ||
"source": { | ||
"id": "{{ id.path }}/canvas/p2", | ||
"type": "Canvas", | ||
"partOf": [{ | ||
"id": "{{ id.path }}/manifest.json", | ||
"type": "Manifest" | ||
}] | ||
}, | ||
"selector": { | ||
"type": "FragmentSelector", | ||
"conformsTo": "http://www.w3.org/TR/media-frags/", | ||
"value": "xywh=2736,2485,816,2064" | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "{{ id.url }}-4", | ||
"type": "Annotation", | ||
"motivation": "tagging", | ||
"body": { | ||
"type": "TextualBody", | ||
"format": "text/plain", | ||
"value": "text-4" | ||
}, | ||
"target": { | ||
"type": "SpecificResource", | ||
"source": { | ||
"id": "{{ id.path }}/canvas/p2", | ||
"type": "Canvas", | ||
"partOf": [{ | ||
"id": "{{ id.path }}/manifest.json", | ||
"type": "Manifest" | ||
}] | ||
}, | ||
"selector": { | ||
"type": "FragmentSelector", | ||
"conformsTo": "http://www.w3.org/TR/media-frags/", | ||
"value": "xywh=1792,373,1744,2064" | ||
} | ||
} | ||
} | ||
] | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
title: Grouping Annotations into Collections | ||
id: 309 | ||
layout: recipe | ||
tags: [tbc] | ||
summary: "tbc" | ||
viewers: | ||
topic: | ||
- basic | ||
--- | ||
|
||
## Use Case | ||
|
||
You have a large number of Annotations covering multiple Canvases in a Manifest, for example crowd-sourced transcriptions or the output from a layout analysis algorithm, and you want the Annotations to be displayed in a viewer as a recognizable group over the document with a label and a common color. | ||
|
||
## Implementation Notes | ||
|
||
The [IIIF Presentation API 3](https://iiif.io/api/presentation/3.0/#58-annotation-collection) defines Annotation Collections as a mechanism to represent groupings of Annotation Pages that should be managed as a single whole, regardless of which Canvas or resource they target. The Annotation Collection is a separate document that references a chain of one or more separate Annotation Pages which contain the Annotations. The Annotation Pages contain a reference to the parent Annotation Collection and a reference to the next page in the chain. | ||
|
||
The Annotation Collection must have a `type` of "AnnotationCollection" and should have a `label` property that can be shown to the user and it can optionally contain additional properties as specified in the [IIIF Presentation API 3](https://iiif.io/api/presentation/3.0/#a-summary-of-property-requirements). | ||
|
||
The Annotation Collection has a `first` property that contains the URI of the first Annotation Page in the sequence, a `last` property that contains the URI of the last Annotation Page and it should have a `total` property that contains the total number of Annotations in the collection. | ||
|
||
The IIIF Manifest requires that Annotations that are intended to be shown on a Canvas are contained in Annotation Pages referenced in the `annotations` property of that Canvas. This means that all Annotations need to be grouped by Canvas and put into one or more Annotation Pages per Canvas. An Annotation Page can not contain Annotations for more than one Canvas. | ||
|
||
<p style="float: right"> | ||
<img src="diagram-309.png" alt="Annotation Collection Data Model" width="359"><br/> | ||
</p> | ||
|
||
The Annotation Pages must have a `type` of "AnnotationPage" and have an `items` property containing the list of Annotations, a `partOf` property that contains the URI of the parent Annotation Collection, and `next` and `prev` properties that contain the URIs of the next and previous Annotation Pages in the sequence. Annotation Pages are often separate documents that are [referenced][0269] in the manifest using a reference object with an `id` property containing the URI of the external document and `type` containing its type. The reference object can also provide copies of other properties from the external document for access inside the Manifest. | ||
|
||
For an Annotation Page you can provide the `partOf`, `next`, `prev` property in the reference object in the `annotations` property of the Canvas. In the `partOf` property of the Annotation Page you can provide a reference object for the Annotation Collection and its `label`, `total`, `first`, and `last` properties as in the example below. In the case of the Annotation Collection it is strongly suggested that you provide these properties in the Manifest to make it possible for the IIIF viewer to know that the Annotations are part of a Collection and display its label without having to load any of the external documents. If the information is not in the Manifest the viewer has to load all Annotation Pages referenced in the Canvases to find and load the Annotation Collections. | ||
|
||
## Example | ||
|
||
We use a Manifest containing two pages from a newspaper (Berliner Tageblatt, February 16, 1925, from Staatsbibliothek Berlin via Europeana) and a set of Annotations concerning layout and reading order. | ||
|
||
The Annotations select rectangular regions on the Canvases in the Manifest and add textual tags describing layout elements. They are contained in two AnnotationPages "anno_p1.json" for Annotations on the first Canvas and "anno_p2.json" for Annotations on the second Canvas. "anno_p1.json" contains a `next` reference to "anno_p2.json", "anno_p2.json" contains a `prev` reference to "anno_p1.json", and both pages contain a `partOf` reference to the AnnotationCollection. | ||
|
||
The Annotation Collection is in the file "anno_coll.json". It has a `label` and references "anno_p1.json" as the `first` and "anno_p2.json" as the `last` page and contains the `total` number of Annotations. | ||
|
||
The Annotation Collection referencing the Annotation Pages: | ||
|
||
{% include jsonviewer.html src="anno_coll.json" %} | ||
|
||
The first AnnotationPage with Annotations on the first Canvas: [anno_p1.json](anno_p1.json) | ||
|
||
The second AnnotationPage with Annotations on the second Canvas: [anno_p2.json](anno_p2.json) | ||
|
||
The Manifest containing the two Canvases and referencing the Annotation Pages: | ||
|
||
{% include manifest_links.html viewers="" manifest="manifest.json" %} | ||
|
||
{% include jsonviewer.html src="manifest.json" config='data-line="66-80,124-138"' %} | ||
|
||
## Related Recipes | ||
|
||
* [Embedded or Referenced Annotations][0269] for referencing Annotations in external Annotation Pages | ||
* [Simple Annotation - Tagging][0021] annotating a rectangular Canvas region | ||
|
||
{% include acronyms.md %} | ||
{% include links.md %} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a lot to take in. I wouldn't delay posting it, but a diagram may be helpful here, in the flavor of those provided in the APIs.