Skip to content

Commit b039194

Browse files
authored
Merge pull request #151 from IIIF/issue-150
iiif-prezi fixes
2 parents 063d493 + d3d6b04 commit b039194

File tree

6 files changed

+260
-47
lines changed

6 files changed

+260
-47
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"@context": "http://iiif.io/api/presentation/3/context.json",
3+
"id": "https://example.org/iiif/collection/invalid",
4+
"type": "Collection",
5+
"label": { "en": [ "Invalid collection of canvases and ranges" ] },
6+
"items": [
7+
{
8+
"id": "https://example.org/iiif/canvas/1",
9+
"type": "Canvas",
10+
"label": { "en": [ "Canvas 1" ] },
11+
"thumbnail": [
12+
{
13+
"id": "https://example.org/manifest1/thumbnail.jpg",
14+
"type": "Image",
15+
"format": "image/jpeg"
16+
}
17+
]
18+
},
19+
{
20+
"id": "https://example.org/iiif/2/range/1",
21+
"type": "Range",
22+
"label": { "en": [ "Range example" ] },
23+
"thumbnail": [
24+
{
25+
"id": "https://example.org/manifest2/thumbnail.jpg",
26+
"type": "Image",
27+
"format": "image/jpeg"
28+
}
29+
]
30+
}
31+
]
32+
}

fixtures/3/range_range.json

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"@context": "http://iiif.io/api/presentation/3/context.json",
3+
"id": "https://example.org/iiif/book1/manifest",
4+
"type": "Manifest",
5+
"label": { "en": [ "Range containng ranges" ] },
6+
"items": [
7+
{
8+
"id": "https://example.org/iiif/book1/canvas/p1",
9+
"type": "Canvas",
10+
"label": { "none": [ "p. 1" ] },
11+
"height": 1000,
12+
"width": 750,
13+
"items": [
14+
{
15+
"id": "https://example.org/iiif/book1/page/p1/1",
16+
"type": "AnnotationPage",
17+
"items": [
18+
{
19+
"id": "https://example.org/iiif/book1/annotation/p0001-image",
20+
"type": "Annotation",
21+
"motivation": "painting",
22+
"body": {
23+
"id": "https://example.org/iiif/book1/page1/full/max/0/default.jpg",
24+
"type": "Image",
25+
"format": "image/jpeg",
26+
"service": [
27+
{
28+
"id": "https://example.org/iiif/book1/page1",
29+
"type": "ImageService3",
30+
"profile": "level2"
31+
}
32+
],
33+
"height": 2000,
34+
"width": 1500
35+
},
36+
"target": "https://example.org/iiif/book1/canvas/p1"
37+
}
38+
]
39+
}
40+
]
41+
},
42+
{
43+
"id": "https://example.org/iiif/book1/canvas/p2",
44+
"type": "Canvas",
45+
"label": { "none": [ "p. 2" ] },
46+
"height": 1000,
47+
"width": 750,
48+
"items": [
49+
{
50+
"id": "https://example.org/iiif/book1/page/p2/1",
51+
"type": "AnnotationPage",
52+
"items": [
53+
{
54+
"id": "https://example.org/iiif/book1/annotation/p0002-image",
55+
"type": "Annotation",
56+
"motivation": "painting",
57+
"body": {
58+
"id": "https://example.org/iiif/book1/page2/full/max/0/default.jpg",
59+
"type": "Image",
60+
"format": "image/jpeg",
61+
"service": [
62+
{
63+
"id": "https://example.org/iiif/book1/page2",
64+
"type": "ImageService3",
65+
"profile": "level2"
66+
}
67+
],
68+
"height": 2000,
69+
"width": 1500
70+
},
71+
"target": "https://example.org/iiif/book1/canvas/p2"
72+
}
73+
]
74+
}
75+
]
76+
}
77+
],
78+
79+
"structures": [
80+
{
81+
"id": "https://example.org/iiif/book1/range/r0",
82+
"type": "Range",
83+
"label": { "en": [ "Table of Contents" ] },
84+
"items": [
85+
{
86+
"id": "https://example.org/iiif/book1/range/r1",
87+
"type": "Range",
88+
"label": { "en": [ "toc2" ] },
89+
"items": [
90+
{
91+
"id": "https://example.org/iiif/book1/canvas/p1",
92+
"type": "Canvas"
93+
},
94+
{
95+
"id": "https://example.org/iiif/book1/range/r1",
96+
"type": "Range",
97+
"label": { "en": [ "toc2" ] },
98+
"items":[{
99+
"id": "https://example.org/iiif/book1/canvas/p2",
100+
"type": "Canvas"
101+
}]
102+
}
103+
]
104+
}
105+
]
106+
}
107+
]
108+
}

iiif-presentation-validator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ def check_manifest(self, data, version, url=None, warnings=[]):
111111
# Passed!
112112
okay = 1
113113
except KeyError as e:
114-
print ('Failed falidation due to:')
114+
print ('Failed validation due to:')
115115
traceback.print_exc()
116116
err = 'Failed due to KeyError {}, check trace for details'.format(e)
117117
okay = 0
118118
except Exception as e:
119119
# Failed
120-
print ('Failed falidation due to:')
120+
print ('Failed validation due to:')
121121
traceback.print_exc()
122122
err = e
123123
okay = 0

schema/error_processor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def diagnoseWhichOneOf(self, error_path, IIIFJsonPath):
116116
# its not another oneOf error
117117
if addErrors:
118118
# if error is also a oneOf then diagnoise again
119+
#print ('Schema path: {} error path: {}'.format(err.absolute_schema_path, error_path))
119120
if err.absolute_schema_path[-1] == 'oneOf' and err.absolute_schema_path != error_path and 'rights' not in err.absolute_schema_path:
120121
error_path.append(oneOfIndex) # this is is related to one of the original oneOfs at index oneOfIndex
121122
error_path.extend(err.absolute_schema_path) # but we found another oneOf test at this location
@@ -323,9 +324,10 @@ def isTypeMatch(self, iiifPath, iiif_asset, schemaType, IIIFJsonPath):
323324
indexDelta += len(str(indexes[count])) -1
324325
count += 1
325326

326-
#print ('JsonPath: {} IIIF Path {} '.format(iiifPath, IIIFJsonPath))
327+
#print ('JsonPath: {} IIIF Path {} type: {}'.format(iiifPath, IIIFJsonPath, schemaType))
327328
path = parse(iiifPath)
328329
results = path.find(iiif_asset)
330+
#print ('Path: {} Results: '.format(path, results))
329331
if not results:
330332
# type not found so return True as this maybe the correct error
331333
return True

0 commit comments

Comments
 (0)