Skip to content

For Content State, targets of Annotations need additional Classes #229

@markpbaggett

Description

@markpbaggett

Right now, it doesn't seem possible to use the library for contentState recipes like:

This is because of https://github.com/iiif-prezi/iiif-prezi3/blob/main/iiif_prezi3/skeleton.py#L304.

I think this needs to be:

target: Union[AnnoTarget, List[AnnoTarget], CanvasRef, List[CanvasRef]]

Example Code and Results

from iiif_prezi3 import Annotation, CanvasRef, config

config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en"

canvas = CanvasRef(
    id="https://iiif.io/api/cookbook/recipe/0009-book-1/canvas/p2#xywh=1528,3024,344,408",
    type="Canvas",
    partOf=[
      {
        "id": "https://iiif.io/api/cookbook/recipe/0009-book-1/manifest.json",
        "type": "Manifest"
      }
    ]
)

annotation = Annotation(
    id="https://example.org/import/1",
    motivation="contentState",
    type="Annotation",
    target=canvas
)

print(annotation.json(indent=2))

Results in:

{
  "@context": "http://iiif.io/api/presentation/3/context.json",
  "id": "https://example.org/import/1",
  "type": "Annotation",
  "motivation": "contentState",
  "target": {
    "id": "https://iiif.io/api/cookbook/recipe/0009-book-1/canvas/p2#xywh=1528,3024,344,408",
    "type": "Canvas",
    "partOf": [
      {
        "id": "https://iiif.io/api/cookbook/recipe/0009-book-1/manifest.json",
        "type": "Manifest"
      }
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions