翻译者:宋杰
原文链接:https://iiif.io/api/cookbook/recipe/0269-embedded-or-referenced-annotations/
用例
你想使用大量的注释,但要分别存储它们,以确保清单不会变得太大。
实现说明
画布的注释以注释页对象的形式存储在画布的注释属性中,其中包含符合 W3C 网络注释数据模型的注释对象列表。
注释页和注释既可以嵌入到清单中(如最简单的注释示例),也可以通过将注释页存储在一个单独的文档中并将该文档的 URI 放到清单中来引用(如下面的示例)。
将清单和注解分开的好处是,清单可以是一个较小的文件,加载速度更快,这样查看器就可以更快地开始显示其内容,另外还可以根据用户的互动和当前视图决定是否以及何时加载Canvas的注解。
另一方面,嵌入式注解的优点是,查看器不必进行额外的HTTPS请求,因此可以更快地显示注解。查看器应该同样对待嵌入式注释和引用的注释,但是IIIF Presentation API 3提到查看器应该按照Manifest中给出的顺序来处理注释,发布者可以将嵌入式注释页排在引用页之前,以加快其处理速度。
外部注释页在 Canvas 的注释 annotations 属性中被一个引用对象引用,该对象的 id 属性包含外部文档的 URI,type 属性包含 “AnnotationPage”。该引用对象不能包含一个项目 items 属性。
外部的注释页文档必须有:
- 一个包含 “http://iiif.io/api/presentation/3/context.json “的@context属性
- 一个带有URI的id属性
- 一个 “AnnotationPage “的类型
- 和一个包含注解列表的 items 属性。
注释页中的每个注释必须有一个带有唯一标识符的 id 属性、一个 “注释 “类型 type、一个目标 target 和一个正文 body 。所有注释的目标 target 应该是Canvas的URI,它包含对注释页的引用(见IIIF Presentation API 3)。这意味着,你想注释的每个 Canvas 都应该有一个(或多个)注释页文件。
注释的目标 target 可以是画布的URI,如果你想注释整个画布(如最简单的注释),或者是URI,如果你想注释画布的一个区域(如简单注释—标签),在最后加上一个媒体片段,或者是更复杂的选择器(如用非矩形多边形注释)。
主体 body 可以是一个URI,也可以是一个遵循W3C网络注释规范的更复杂的对象。一个常用的模型是嵌入式文本主体,如下面的例子。
示例
这个例子的Manifest包含一个被引用的注释 commenting ,其中包含 “Göttinger Marktplatz mit Gänseliesel Brunnen “的文字,其动机是针对整个Canvas的注释。注释是包含在额外的注释页文件中的注释页的单一项目,该文件在 Canvas 的注释 annotations 属性中被引用。
注释的主体 body 是一个类型为 “TextualBody “的对象,它在值 value 属性中包含文本,在格式 format 属性中指定文本字符串的格式(”text/plain”),在语言 language 属性中指定语言(德语为 “de”)。
注释的目标 target 只是Canvas的URI,所以注释指的是整个Canvas。
这个引用的注释的渲染应该与最简单的注释中的嵌入式注释几乎没有区别。请注意,当你把鼠标放在侧边栏中的注释上时,Mirador不会在图像上加亮,因为注释是以整个画布为目标的。
清单文件
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://iiif.io/api/cookbook/recipe/0269-embedded-or-referenced-annotations/manifest.json",
"type": "Manifest",
"label": {
"en": [
"Picture of Göttingen taken during the 2019 IIIF Conference"
]
},
"items": [
{
"id": "https://iiif.io/api/cookbook/recipe/0269-embedded-or-referenced-annotations/canvas-1",
"type": "Canvas",
"height": 3024,
"width": 4032,
"items": [
{
"id": "https://iiif.io/api/cookbook/recipe/0269-embedded-or-referenced-annotations/canvas-1/annopage-1",
"type": "AnnotationPage",
"items": [
{
"id": "https://iiif.io/api/cookbook/recipe/0269-embedded-or-referenced-annotations/canvas-1/annopage-1/anno-1",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://iiif.io/api/image/3.0/example/reference/918ecd18c2592080851777620de9bcb5-gottingen/full/max/0/default.jpg",
"type": "Image",
"format": "image/jpeg",
"height": 3024,
"width": 4032,
"service": [
{
"id": "https://iiif.io/api/image/3.0/example/reference/918ecd18c2592080851777620de9bcb5-gottingen",
"profile": "level1",
"type": "ImageService3"
}
]
},
"target": "https://iiif.io/api/cookbook/recipe/0269-embedded-or-referenced-annotations/canvas-1"
}
]
}
],
"annotations": [
{
"id": "https://iiif.io/api/cookbook/recipe/0269-embedded-or-referenced-annotations/annotationpage.json",
"type": "AnnotationPage"
}
]
}
]
}
标注页文件
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://iiif.io/api/cookbook/recipe/0269-embedded-or-referenced-annotations/annotationpage.json",
"type": "AnnotationPage",
"items": [
{
"id": "https://iiif.io/api/cookbook/recipe/0269-embedded-or-referenced-annotations/canvas-1/annopage-2/anno-1",
"type": "Annotation",
"motivation": "commenting",
"body": {
"type": "TextualBody",
"language": "de",
"format": "text/plain",
"value": "Göttinger Marktplatz mit Gänseliesel Brunnen"
},
"target": "https://iiif.io/api/cookbook/recipe/0269-embedded-or-referenced-annotations/canvas-1"
}
]
}
相关专题
- 最简单的注解—简单的嵌入式注解,对整个Canvas进行注解
- 简单的注释 - 标记注释一个矩形的Canvas区域
- 使用非矩形多边形的注释,注释画布上的不规则形状