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

iiif-prezi fixes #151

Merged
merged 3 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions fixtures/3/collection_of_canvases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://example.org/iiif/collection/invalid",
"type": "Collection",
"label": { "en": [ "Invalid collection of canvases and ranges" ] },
"items": [
{
"id": "https://example.org/iiif/canvas/1",
"type": "Canvas",
"label": { "en": [ "Canvas 1" ] },
"thumbnail": [
{
"id": "https://example.org/manifest1/thumbnail.jpg",
"type": "Image",
"format": "image/jpeg"
}
]
},
{
"id": "https://example.org/iiif/2/range/1",
"type": "Range",
"label": { "en": [ "Range example" ] },
"thumbnail": [
{
"id": "https://example.org/manifest2/thumbnail.jpg",
"type": "Image",
"format": "image/jpeg"
}
]
}
]
}
108 changes: 108 additions & 0 deletions fixtures/3/range_range.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "https://example.org/iiif/book1/manifest",
"type": "Manifest",
"label": { "en": [ "Range containng ranges" ] },
"items": [
{
"id": "https://example.org/iiif/book1/canvas/p1",
"type": "Canvas",
"label": { "none": [ "p. 1" ] },
"height": 1000,
"width": 750,
"items": [
{
"id": "https://example.org/iiif/book1/page/p1/1",
"type": "AnnotationPage",
"items": [
{
"id": "https://example.org/iiif/book1/annotation/p0001-image",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://example.org/iiif/book1/page1/full/max/0/default.jpg",
"type": "Image",
"format": "image/jpeg",
"service": [
{
"id": "https://example.org/iiif/book1/page1",
"type": "ImageService3",
"profile": "level2"
}
],
"height": 2000,
"width": 1500
},
"target": "https://example.org/iiif/book1/canvas/p1"
}
]
}
]
},
{
"id": "https://example.org/iiif/book1/canvas/p2",
"type": "Canvas",
"label": { "none": [ "p. 2" ] },
"height": 1000,
"width": 750,
"items": [
{
"id": "https://example.org/iiif/book1/page/p2/1",
"type": "AnnotationPage",
"items": [
{
"id": "https://example.org/iiif/book1/annotation/p0002-image",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://example.org/iiif/book1/page2/full/max/0/default.jpg",
"type": "Image",
"format": "image/jpeg",
"service": [
{
"id": "https://example.org/iiif/book1/page2",
"type": "ImageService3",
"profile": "level2"
}
],
"height": 2000,
"width": 1500
},
"target": "https://example.org/iiif/book1/canvas/p2"
}
]
}
]
}
],

"structures": [
{
"id": "https://example.org/iiif/book1/range/r0",
"type": "Range",
"label": { "en": [ "Table of Contents" ] },
"items": [
{
"id": "https://example.org/iiif/book1/range/r1",
"type": "Range",
"label": { "en": [ "toc2" ] },
"items": [
{
"id": "https://example.org/iiif/book1/canvas/p1",
"type": "Canvas"
},
{
"id": "https://example.org/iiif/book1/range/r1",
"type": "Range",
"label": { "en": [ "toc2" ] },
"items":[{
"id": "https://example.org/iiif/book1/canvas/p2",
"type": "Canvas"
}]
}
]
}
]
}
]
}
4 changes: 2 additions & 2 deletions iiif-presentation-validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ def check_manifest(self, data, version, url=None, warnings=[]):
# Passed!
okay = 1
except KeyError as e:
print ('Failed falidation due to:')
print ('Failed validation due to:')
traceback.print_exc()
err = 'Failed due to KeyError {}, check trace for details'.format(e)
okay = 0
except Exception as e:
# Failed
print ('Failed falidation due to:')
print ('Failed validation due to:')
traceback.print_exc()
err = e
okay = 0
Expand Down
4 changes: 3 additions & 1 deletion schema/error_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def diagnoseWhichOneOf(self, error_path, IIIFJsonPath):
# its not another oneOf error
if addErrors:
# if error is also a oneOf then diagnoise again
#print ('Schema path: {} error path: {}'.format(err.absolute_schema_path, error_path))
if err.absolute_schema_path[-1] == 'oneOf' and err.absolute_schema_path != error_path and 'rights' not in err.absolute_schema_path:
error_path.append(oneOfIndex) # this is is related to one of the original oneOfs at index oneOfIndex
error_path.extend(err.absolute_schema_path) # but we found another oneOf test at this location
Expand Down Expand Up @@ -323,9 +324,10 @@ def isTypeMatch(self, iiifPath, iiif_asset, schemaType, IIIFJsonPath):
indexDelta += len(str(indexes[count])) -1
count += 1

#print ('JsonPath: {} IIIF Path {} '.format(iiifPath, IIIFJsonPath))
#print ('JsonPath: {} IIIF Path {} type: {}'.format(iiifPath, IIIFJsonPath, schemaType))
path = parse(iiifPath)
results = path.find(iiif_asset)
#print ('Path: {} Results: '.format(path, results))
if not results:
# type not found so return True as this maybe the correct error
return True
Expand Down