Skip to content
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

0540 link for opening multiple canvases #564

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
80676a1
Draft of 0540
giacomomarchioro Oct 25, 2024
1aeef8c
Update index
giacomomarchioro Oct 25, 2024
962abae
Update link
giacomomarchioro Oct 25, 2024
0fd8792
Merge pull request #549 from giacomomarchioro/0540-link-for-opening-m…
giacomomarchioro Oct 25, 2024
1c5c0b6
Fix typos and add link
giacomomarchioro Nov 12, 2024
762b247
Merge pull request #553 from giacomomarchioro/0540-link-for-opening-m…
giacomomarchioro Nov 12, 2024
bf8908b
Removed inline JSON
giacomomarchioro Nov 22, 2024
04e0555
Merge pull request #558 from giacomomarchioro/0540-link-for-opening-m…
giacomomarchioro Nov 22, 2024
16de24b
changes id.url to id.path
giacomomarchioro Nov 22, 2024
d91f760
Merge pull request #559 from giacomomarchioro/0540-link-for-opening-m…
giacomomarchioro Nov 22, 2024
ac0d98f
fix broken link
giacomomarchioro Nov 29, 2024
1a2f689
Merge pull request #563 from giacomomarchioro/0540-link-for-opening-m…
giacomomarchioro Nov 29, 2024
2ebc063
corrects manifest
giacomomarchioro Dec 6, 2024
1144ac4
Update recipe/0540-link-for-opening-multiple-canvases/index.md
giacomomarchioro Dec 6, 2024
9de7f42
add second manifest
giacomomarchioro Dec 6, 2024
2be4d55
add restrictions and editor comments
giacomomarchioro Dec 6, 2024
6e98a26
change links to the new manifests
giacomomarchioro Dec 6, 2024
f180566
add image
giacomomarchioro Dec 6, 2024
c1da98f
Merge pull request #567 from giacomomarchioro/0540-link-for-opening-m…
giacomomarchioro Dec 6, 2024
d562a10
change related recipes and corrects typos
giacomomarchioro Dec 6, 2024
0f0f06f
Merge pull request #568 from giacomomarchioro/0540-link-for-opening-m…
giacomomarchioro Dec 6, 2024
3b01668
change url formatting and correct typo
giacomomarchioro Dec 13, 2024
e90cd5e
Merge pull request #569 from giacomomarchioro/0540-link-for-opening-m…
giacomomarchioro Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _includes/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@

[0434]: {{ site.cookbook_url | absolute_url }}/recipe/0434-choice-av/ "Multiple Choice of Audio Formats in a Single View (Canvas)"
[0489]: {{ site.cookbook_url | absolute_url }}/recipe/0489-multimedia-canvas/ "Rendering Multiple Media Types on a Time-Based Canvas"
[0540]: {{ site.cookbook_url | absolute_url }}/recipe/0540-link-for-opening-multiple-canvases/ "Sharing a link for opening two or more Canvases"

[cookbook-process]: {{site.cookbook_url | absolute_url }}/recipe

Expand Down
4 changes: 3 additions & 1 deletion index.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ _(leading on to segmentation examples later)_
* [Linking to Structured Metadata][0053] (8)


## Sharing IIIF content
## Sharing IIIF content
Recipes using [Content State API](https://iiif.io/api/content-state/1.0/)

* [Loading a manifest with a viewer using a link][0466]
* [Open a specific region of a canvas in a viewer][0485]
* [Sharing a link for opening two or more Canvases][0540]



## Technical
Expand Down
28 changes: 28 additions & 0 deletions recipe/0540-link-for-opening-multiple-canvases/annotation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "{{ id.url }}",
"type": "Annotation",
"motivation": ["contentState"],
"target": [
{
"id": "https://iiif.io/api/cookbook/recipe/0318-navPlace-navDate/canvas/2",
"type": "Canvas",
"partOf": [
{
"id": "https://iiif.io/api/cookbook/recipe/0318-navPlace-navDate/manifest-2.json",
"type": "Manifest"
}
]
},
{
"id": "{{ id.path }}/canvas/p2",
"type": "Canvas",
"partOf": [
{
"id": "{{ id.path }}/manifest",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This results in a 404 and this property in the json:

"id": "https://preview.iiif.io/cookbook/0540-link-for-opening-multiple-canvases/recipe/0540-link-for-opening-multiple-canvases/canvas/p2",

I think we need this:

Suggested change
"id": "{{ id.path }}/manifest",
"id": "{{ id.path }}/manifest.json",

"type": "Manifest"
}
]
}
]
}
49 changes: 49 additions & 0 deletions recipe/0540-link-for-opening-multiple-canvases/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Sharing a link for opening two or more Canvases
id: 540
layout: recipe
tags: [annotation, content-state]
summary: "Allows users to use Content State API to open two canvases at the same time."
viewers:
topic:
- content-state
---

## Use Case

I want to compare pages from two different manuscripts and share a link to open both on the same view. I want to share a link to a colleague showing two similar paintings in two different collections. I want to save my current workspace (open Canvases in the current viewer) for later use. I want to open my current workspace with another viewer.

## Implementation Notes

Some viewers already implement custom formats for exporting the current workspace for sharing or later use. Content State API could be used for the same purpose, adding the advantage of direct loading of the workspace using a crafted link with the `iiif-content` query parameter. The [multiple targets for a comparison view section](https://iiif.io/api/content-state/1.0/#53-multiple-targets-for-a-comparison-view) describes a method for targetting two Canvases at the same time; each Canvas could be from a different Manifest.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestion:

Suggested change
Some viewers already implement custom formats for exporting the current workspace for sharing or later use. Content State API could be used for the same purpose, adding the advantage of direct loading of the workspace using a crafted link with the `iiif-content` query parameter. The [multiple targets for a comparison view section](https://iiif.io/api/content-state/1.0/#53-multiple-targets-for-a-comparison-view) describes a method for targetting two Canvases at the same time; each Canvas could be from a different Manifest.
Some viewers already implement custom formats for exporting the current workspace for sharing or later use. The Content State API could be used for the same purpose, adding the advantage of direct loading of the workspace using a crafted link with the `iiif-content` query parameter. The [multiple targets for a comparison view section](https://iiif.io/api/content-state/1.0/#53-multiple-targets-for-a-comparison-view) describes a method for targetting two Canvases at the same time; each Canvas could be from a different Manifest.


For this purpose, we create an Annotation with `motivation` set to `["contentState"]`.
The value of the the `target` attribute of the Annotation is a list containing the `id` of the Canvases and a `partOf` attribute with the `id` of the Manifests they belong to.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would property be better than attribute here?

Suggested change
The value of the the `target` attribute of the Annotation is a list containing the `id` of the Canvases and a `partOf` attribute with the `id` of the Manifests they belong to.
The value of the the `target` property of the Annotation is a list containing the `id` of the Canvases and a `partOf` property with the `id` of the Manifests they belong to.


We can hence encode the Annotation as explained in the [Content State encoding guidelines](https://iiif.io/api/content-state/1.0/#6-content-state-encoding), and then pass the encoded string to the viewer as the value of the `iiif-content` query parameter.

giacomomarchioro marked this conversation as resolved.
Show resolved Hide resolved
## Restrictions

None known.

## Example
In this example we want to compare two painting of the Colosseum from two different Manifests.
One of the two Manifest is available at the following [link](manifest.json). We can notice that the Colosseum painting is in the second Canvas. The other Manifest is from another recipe, and can be [accessed here](https://iiif.io/api/cookbook/recipe/0318-navPlace-navDate/manifest-2.json).

The Annotation will target the `id` of the two Canvases we want to compare and contain a reference to the two Manifests as shown in the example:

{% include content-state-viewers.html iiif-content="annotation.json" viewers="" %}

{% include jsonviewer.html src="annotation.json" %}

The expected result should show the two Canvases of the two Manifest depicting the Colosseum.

## Related Recipes

* [Simplest Manifest - Image][0001] shows the basic structure of a IIIF Manifest using Presentation API 3.0.
* [A simple book][0009] shows the manifest structure.
* [Link for loading a manifest][0466] another example of Content State API.

{% include acronyms.md %}
{% include links.md %}

76 changes: 76 additions & 0 deletions recipe/0540-link-for-opening-multiple-canvases/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "{{ id.url }}/manifest.json",
"type": "Manifest",
"label": {
"en": [
"Two monuments in Rome"
]
},
"items": [
{
"id": "{{ id.path }}/canvas/p1",
"type": "Canvas",
"label": {
"en": [
"The Temple of Vesta Rome"
]
},
"height": 1464,
"width": 2048,
"items": [
{
"id": "{{ id.path }}/page/p1/1",
"type": "AnnotationPage",
"items": [
{
"id": "{{ id.path }}/annotation/p0001-image",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://fixtures.iiif.io/images/Yale/ycba/The_Temple_of_Vesta_Rome.jpg",
"type": "Image",
"format": "image/jpeg",
"height": 1464,
"width": 2048
},
"target": "{{ id.path }}/canvas/p1"
}
]
}
]
},
{
"id": "{{ id.path }}/canvas/p2",
"type": "Canvas",
"label": {
"en": [
"The Colosseum"
]
},
"height": 1302,
"width": 2048,
"items": [
{
"id": "{{ id.path }}/page/p2/1",
"type": "AnnotationPage",
"items": [
{
"id": "{{ id.path }}/annotation/p0002-image",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://fixtures.iiif.io/images/Yale/ycba/The_Colosseum_Rome2.jpg",
"type": "Image",
"format": "image/jpeg",
"height": 1302,
"width": 2048
},
"target": "{{ id.path }}/canvas/p2"
}
]
}
]
}
]
}
Loading