From 16239a823a21bc3e8273bacf3c37a55434415c17 Mon Sep 17 00:00:00 2001 From: Glen Robson Date: Fri, 12 Jul 2024 17:58:42 +0100 Subject: [PATCH 1/7] Checking for Annotations with label --- scripts/validate.py | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/scripts/validate.py b/scripts/validate.py index 70dcb7bfd..ac94657f2 100755 --- a/scripts/validate.py +++ b/scripts/validate.py @@ -54,6 +54,37 @@ def validateIIIF(jsonData, filepath): else: return True +def checkForNonValidationIssues(data, filename): + type = data["type"] + # Look for label in annotation + if type == 'Manifest': + anyFailed = False + if 'items' in data: + for canvas in data['items']: + if 'items' in canvas: + for page in canvas['items']: + result = checkAnnotationPage(page) + if result: + anyFailed = True + print (f'Manifest {filename} contains a annotation in canvas {canvas['id']} which has a label in the annotation') + if anyFailed: + return False + + elif type == 'AnnotationPage': + result = checkAnnotationPage(data) + if result: + print (f'AnnotationPage {filename} has a label in the annotation') + return False + return True + +def checkAnnotationPage(page): + for annotation in page['items']: + if 'label' in annotation: + print ('Found label in:') + print (annotation) + return True + return False + def loadYAML(location): with open(location, "r") as stream: try: @@ -94,9 +125,6 @@ def loadYAML(location): if not ignoreViewer: print ('Recipe {} is missing a `viewers` entry either add it or add the name of the recipe to _data.viewer_ignore.yml'.format(recipepath)) allPassed = False - - - files = findFilesToValidate("../_site", ".json") # Get JSON Schema @@ -116,6 +144,9 @@ def loadYAML(location): if not passed: allPassed = False # else it passed + passed = checkForNonValidationIssues(jsonData, jsonFilename) + if not passed: + allPassed = False else: print ('{}: Do not know how to validate JSON with type: {}'.format(errorJsonFilename, jsonData['type'])) else: From 6d66c446dece3be81865db0ac03c49548aef9e57 Mon Sep 17 00:00:00 2001 From: Glen Robson Date: Fri, 12 Jul 2024 18:05:19 +0100 Subject: [PATCH 2/7] Checking annotations --- scripts/validate.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/validate.py b/scripts/validate.py index ac94657f2..cbae577ab 100755 --- a/scripts/validate.py +++ b/scripts/validate.py @@ -66,7 +66,14 @@ def checkForNonValidationIssues(data, filename): result = checkAnnotationPage(page) if result: anyFailed = True - print (f'Manifest {filename} contains a annotation in canvas {canvas['id']} which has a label in the annotation') + print (f'Manifest {filename} contains a painting annotation in canvas {canvas['id']} which has a label in the annotation') + if 'annotations' in canvas: + for page in canvas['annotations']: + result = checkAnnotationPage(page) + if result: + anyFailed = True + print (f'Manifest {filename} contains an annotation in canvas {canvas['id']} which has a label in the annotation') + if anyFailed: return False From cdef5d6168088506030522d77a56d59af0508641 Mon Sep 17 00:00:00 2001 From: Glen Robson Date: Fri, 12 Jul 2024 18:07:48 +0100 Subject: [PATCH 3/7] Adding check for empty annotations prop --- scripts/validate.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/validate.py b/scripts/validate.py index cbae577ab..e588e009b 100755 --- a/scripts/validate.py +++ b/scripts/validate.py @@ -85,11 +85,12 @@ def checkForNonValidationIssues(data, filename): return True def checkAnnotationPage(page): - for annotation in page['items']: - if 'label' in annotation: - print ('Found label in:') - print (annotation) - return True + if 'items' in page: + for annotation in page['items']: + if 'label' in annotation: + print ('Found label in:') + print (annotation) + return True return False def loadYAML(location): From 5f38f2d3aca76384c09be3399eac302c45b3ad95 Mon Sep 17 00:00:00 2001 From: Glen Robson Date: Thu, 15 Aug 2024 18:43:15 +0100 Subject: [PATCH 4/7] Removing label from annotation --- recipe/0135-annotating-point-in-canvas/manifest.json | 5 ----- recipe/0139-geolocate-canvas-fragment/manifest.json | 10 ---------- 2 files changed, 15 deletions(-) diff --git a/recipe/0135-annotating-point-in-canvas/manifest.json b/recipe/0135-annotating-point-in-canvas/manifest.json index bfc8d0b17..2138e56b8 100644 --- a/recipe/0135-annotating-point-in-canvas/manifest.json +++ b/recipe/0135-annotating-point-in-canvas/manifest.json @@ -59,11 +59,6 @@ { "id": "{{ id.path }}/annotation/p0002-tag", "type": "Annotation", - "label": { - "en": [ - "Annotation containing the name of the place annotated using the PointSelector." - ] - }, "motivation": "tagging", "body": { "type": "TextualBody", diff --git a/recipe/0139-geolocate-canvas-fragment/manifest.json b/recipe/0139-geolocate-canvas-fragment/manifest.json index 196679b6b..cb69dd9ce 100644 --- a/recipe/0139-geolocate-canvas-fragment/manifest.json +++ b/recipe/0139-geolocate-canvas-fragment/manifest.json @@ -35,11 +35,6 @@ "id":"{{ id.path }}/content.json", "type":"Annotation", "motivation":"painting", - "label":{ - "en":[ - "Pamphlet Cover" - ] - }, "body":{ "id":"https://iiif.io/api/image/3.0/example/reference/43153e2ec7531f14dd1c9b2fc401678a-88695674/full/max/0/default.jpg", "type":"Image", @@ -68,11 +63,6 @@ "id":"{{ id.path }}/geoAnno.json", "type":"Annotation", "motivation":"tagging", - "label":{ - "en":[ - "Annotation containing GeoJSON-LD coordinates that place the map depiction onto a Leaflet web map." - ] - }, "body":{ "id":"{{ id.path }}/geo.json", "type":"Feature", From 118a59fbe917e2c013078845777a784348e7a06b Mon Sep 17 00:00:00 2001 From: Glen Robson Date: Thu, 15 Aug 2024 18:43:28 +0100 Subject: [PATCH 5/7] Removing debug --- scripts/validate.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/validate.py b/scripts/validate.py index e588e009b..e2c0fbf53 100755 --- a/scripts/validate.py +++ b/scripts/validate.py @@ -88,8 +88,6 @@ def checkAnnotationPage(page): if 'items' in page: for annotation in page['items']: if 'label' in annotation: - print ('Found label in:') - print (annotation) return True return False From 57d8d931a7132cb99d84d1055175ea77310a6c73 Mon Sep 17 00:00:00 2001 From: Glen Robson Date: Thu, 15 Aug 2024 19:09:43 +0100 Subject: [PATCH 6/7] Updating hightlighting --- recipe/0135-annotating-point-in-canvas/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/0135-annotating-point-in-canvas/index.md b/recipe/0135-annotating-point-in-canvas/index.md index cf21fbab6..777a9133e 100644 --- a/recipe/0135-annotating-point-in-canvas/index.md +++ b/recipe/0135-annotating-point-in-canvas/index.md @@ -27,7 +27,7 @@ This example uses a leaflet with a map and a guide supplied by the Library of Co {% include manifest_links.html viewers="Glycerine Viewer" manifest="manifest.json" %} -{% include jsonviewer.html src="manifest.json" config='data-line="74-82"' %} +{% include jsonviewer.html src="manifest.json" config='data-line="69-76"' %} # Related recipes From 36bf7ac9deed0d17c99c9b23ae21d08888ec44f0 Mon Sep 17 00:00:00 2001 From: Glen Robson Date: Thu, 15 Aug 2024 19:19:23 +0100 Subject: [PATCH 7/7] Update highlighting and mention of annotation label --- recipe/0139-geolocate-canvas-fragment/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipe/0139-geolocate-canvas-fragment/index.md b/recipe/0139-geolocate-canvas-fragment/index.md index 1fbada18e..1b70772b9 100644 --- a/recipe/0139-geolocate-canvas-fragment/index.md +++ b/recipe/0139-geolocate-canvas-fragment/index.md @@ -22,7 +22,7 @@ A Canvas has a region of interest that contains a map. You would like to associa ### Implementation Notes The third party [GeoJSON-LD](https://geojson.org/geojson-ld/) context is included in addition to the IIIF Presentation API 3.0 context. The GeoJSON-LD context supplies the vocabulary terms for the Annotation bodies since the IIIF Presentation API 3.0 context does not describe those terms. When there are multiple contexts, the `@context` property can be an array which is processed as a set. Typically order does not matter for a set. However, when the IIIF context is used in these arrays it must be the last item in the set. -The GeoJSON `properties` object is generic and [can be nearly anything](https://tools.ietf.org/html/rfc7946#section-3.2). It is used to pass metadata along with the geocoordinates. This has implications on clients and parsers that must discern what data to use. For example, if the targeted resource has a `label` property and the `properties` object has a `label` property, the consuming interface must make a choice on which to prioritize for presentation purposes. In the image from the Use Case section, the "Label" uses the GeoJSON `properties` object's `label` property (lines 80-83) instead of the `label` property from the Annotation or Canvas. This is because web mapping clients are designed to look for metadata in GeoJSON `properties` for display. +The GeoJSON `properties` object is generic and [can be nearly anything](https://tools.ietf.org/html/rfc7946#section-3.2). It is used to pass metadata along with the geocoordinates. This has implications on clients and parsers that must discern what data to use. For example, if the targeted resource had a `label` property and the `properties` object has a `label` property, the consuming interface must make a choice on which to prioritize for presentation purposes. In the image from the Use Case section, the "Label" uses the GeoJSON `properties` object's `label` property (lines 69-75) instead of the `label` property from the Annotation or Canvas. This is because web mapping clients are designed to look for metadata in GeoJSON `properties` for display. Note that [`geometry` has more types besides `Polygon`.](https://tools.ietf.org/html/rfc7946#section-3.1) @@ -34,7 +34,7 @@ The Manifest has one Canvas with one Image, and the Canvas has the same size dim {% include manifest_links.html viewers="Annona" manifest="manifest.json" %} -{% include jsonviewer.html src="manifest.json" config='data-line="2-5, 67-111"' %} +{% include jsonviewer.html src="manifest.json" config='data-line="2-5, 62-101"' %} ## Related Recipes * [Fragment Selectors][0020]