Replies: 3 comments
-
This was a sticking point, as ideally the normalization step into Vault should be reversible. To completely avoid the issue Vault/parser currently doesn't touch Annotation targets (or services). That's good to know that the types may be wrong, I think that can be solved quite quickly. The main issue is with the media frags. Originally it ended up creating a whole bunch of junk {
"target": "https://iiif.io/api/cookbook/recipe/0036-composition-from-multiple-images/canvas/p1#xywh=3949,994,1091,1232"
} So if we were to normalize the annotation targets, we'd need to make a more drastic change to the structure. One option could be to expand within the W3C spec (and update the types to reflect) {
"target": [{
"type": "SpecificResource",
"source": {"id": "https://iiif.io/api/cookbook/recipe/0036-composition-from-multiple-images/canvas/p1", "type": "Canvas"},
"selector": { "type": "FragmentSelector", "value": "#xywh=3949,994,1091,1232" }
}]
} So even simple string targets get expanded out - and then possibly "compress" on the way out back to a single value. This would be the first case of drastically changing the structure of the IIIF on the way in, so eventually removed for now. The code to expand does exist here: https://github.com/digirati-co-uk/react-iiif-vault/blob/a9b743693fda066d12d727603cf54da8920ea837/src/utility/expand-target.ts#L15 if that felt like the way to go. The traversal is also available to re-enable: Very interested to get your thoughts on this "expanded" version of the annotation target, and if that would help your use cases. |
Beta Was this translation helpful? Give feedback.
-
Thank you for writing up the reasoning behind the current approach!! |
Beta Was this translation helpful? Give feedback.
-
Yes, it's a bit of a tough one! I think a good candidate for Vault helpers to make it a bit easier to parse with type-safety. There is a similar issue with Range targets too, as they can contain canvases, other ranges or media-frags too. Fix for incorrect type published in:
I'll convert this to a discussion for the other half |
Beta Was this translation helpful? Give feedback.
-
When loading the manifest https://iiif.io/api/cookbook/recipe/0036-composition-from-multiple-images/manifest.json with vault and drilling down into the canvas' annotations via
vault.get
, thetarget
key is not being normalized into an array as specified by the type annotations onAnnotationNormalized
:Expected Output (
Array<ContentResource>
):Actual Output: (
ContentResourceString
?)I'm also a bit confused as to why
AnnotationNormalized#target
has the typeArray<Reference<"ContentResource">>
, shouldn't it be a unionArray<Reference<"ContentResource"> | ContentResourceString
>? Although that's probably more of a question for https://github.com/IIIF-Commons/presentation-3-types.Beta Was this translation helpful? Give feedback.
All reactions