Skip to content

Commit

Permalink
Adding id to each annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
glenrobson committed Mar 10, 2022
1 parent 335b989 commit abd95d5
Show file tree
Hide file tree
Showing 26 changed files with 107 additions and 0 deletions.
36 changes: 36 additions & 0 deletions zooniverse/with_id/addIds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#! /usr/bin/env python3

import json
import os
from urllib import request

def loadJson(url):
with request.urlopen(url) as data:
return json.loads(data.read())

if __name__ == "__main__":
base = "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id"

annoCount = 0
for file in os.listdir("../split"):
if 'annoPage' in file and file.endswith('.json'):
with open(os.path.join('../split', file)) as json_file:
annoPage = json.load(json_file)
annoPage['id'] = annoPage['id'].replace('split','with_id')

for anno in annoPage['items']:
anno['id'] = "{}/{}".format(base, annoCount)
annoCount += 1

with open(file, 'w') as outfile:
json.dump(annoPage, outfile)

# Update manifest annotation links to links in this directory
with open('../split/manifest.json') as json_file:
manifest = json.load(json_file)
for canvas in manifest['sequences'][0]['canvases']:
if 'annotations' in canvas:
canvas['annotations'][0]['id'] = canvas['annotations'][0]['id'].replace('split','with_id')

with open('manifest.json', 'w') as outfile:
json.dump(manifest, outfile)
1 change: 1 addition & 0 deletions zooniverse/with_id/annoPage-0.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions zooniverse/with_id/annoPage-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"@context": "http://iiif.io/api/presentation/3/context.json", "type": "AnnotationPage", "partOf": {"id": "https://zooniverse.github.io/iiif-annotations/annotations/titles.json", "type": "AnnotationCollection"}, "items": [{"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Grey the Collier", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=369,1189,2049,123", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/138"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Twelve Precisely; or, A Night at the Dover", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=419,1582,1936,195", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/139"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Grey the Collier", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=340,1179,2048,176", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/140"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Twelve Precisley; Or, A Night at Dover", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=396,1566,1975,241", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/141"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Harlequin, Tom, The Piper's Son", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=473,2358,1777,258", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/142"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "GREY THE COLLIER", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=366,1187,2067,139", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/143"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "TWELVE PRECISELY; OR, A NIGHT AT DOVER", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=414,1561,1948,225", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/144"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "HARLEQUIN, TOM, THE PIPER'S SON", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=528,2388,1716,216", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/145"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "HARLEQUIN, TOM, THE PIPER'S SON", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=499,2377,1766,239", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/146"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Grey the collier", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=357,1177,2082,160", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/147"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Twelve Precisely; or, a night at Dover", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=401,1567,2017,229", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/148"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Harlequin, Tom, The Piper's Son", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=482,2359,1796,257", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/149"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "GREY THE COLLIER", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=361,1187,2074,142", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/150"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "TWELVE PRECISELY; OR A NIGHT AT DOVER", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=388,1572,1995,219", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/151"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "HARLEQUIN TOM THE PIPER'S SON", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=496,2362,1754,264", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/152"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "TRY AGAIN; or Counterplots and Countermines", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=439,3904,1867,86", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/153"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Grey the collier", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=358,1193,2088,139", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/154"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Twelve precisely; or, a night at Dover", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=391,1557,2004,237", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/155"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Grey the Collier", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=366,1189,2070,141", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/156"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "GREY THE COLLIER", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=345,1182,2098,157", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/157"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "TWELVE PRECISELY; OR A NIGHT AT DOVER", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=380,1571,2041,209", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/158"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "HARLEQUIN TOM THE PIPERS SO N", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001c4#xywh=467,2394,1796,214", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/159"}], "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/annoPage-1.json"}
1 change: 1 addition & 0 deletions zooniverse/with_id/annoPage-10.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"@context": "http://iiif.io/api/presentation/3/context.json", "type": "AnnotationPage", "partOf": {"id": "https://zooniverse.github.io/iiif-annotations/annotations/titles.json", "type": "AnnotationCollection"}, "items": [{"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "All at Coventry; Or Love and Laugh", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cd#xywh=484,930,2055,305", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/127"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "The Man and the Monkey", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cd#xywh=484,1626,2008,237", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/128"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Harlequin's Hour-Glass; Or Time Works Wonders", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cd#xywh=458,2059,2059,293", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/129"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Joconde, or, Le Prince Troubadour", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cd#xywh=717,3537,1414,131", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/130"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "ALL AT COVENTRY; OR LOVE AND LAUGH", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cd#xywh=493,899,2033,339", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/131"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "The Man & the Monkey", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cd#xywh=472,1612,2043,257", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/132"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Harlequin's Hour-Glass; Or TIME WORKS WONDERS", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cd#xywh=437,2034,2072,329", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/133"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "JOCONDE; ou Le Prince Troubadour", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cd#xywh=711,3498,1460,160", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/134"}], "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/annoPage-10.json"}
1 change: 1 addition & 0 deletions zooniverse/with_id/annoPage-11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"@context": "http://iiif.io/api/presentation/3/context.json", "type": "AnnotationPage", "partOf": {"id": "https://zooniverse.github.io/iiif-annotations/annotations/titles.json", "type": "AnnotationCollection"}, "items": [{"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Touch and Take; Or SATURDAY NIGHT and MONDAY MORNING", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001ce#xywh=111,1915,2487,374", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/135"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Two Spanish Valets", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001ce#xywh=121,3519,2527,239", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/136"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "CONJUROR; Or BLAISE IN AMAZE", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001ce#xywh=160,4353,2446,330", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/137"}], "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/annoPage-11.json"}
1 change: 1 addition & 0 deletions zooniverse/with_id/annoPage-12.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"@context": "http://iiif.io/api/presentation/3/context.json", "type": "AnnotationPage", "partOf": {"id": "https://zooniverse.github.io/iiif-annotations/annotations/titles.json", "type": "AnnotationCollection"}, "items": [{"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "ROCHESTER; Or, King Charles the Second's Merry Days", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cf#xywh=324,2013,2063,333", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/65"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "ACTRESS of ALL WORK", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cf#xywh=334,2689,2004,189", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/66"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "WHERE SHALL I DINE?", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cf#xywh=334,3307,2006,192", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/67"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "THE SINGLES in LONDON", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001cf#xywh=389,3994,1852,129", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/68"}], "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/annoPage-12.json"}
1 change: 1 addition & 0 deletions zooniverse/with_id/annoPage-13.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"@context": "http://iiif.io/api/presentation/3/context.json", "type": "AnnotationPage", "partOf": {"id": "https://zooniverse.github.io/iiif-annotations/annotations/titles.json", "type": "AnnotationCollection"}, "items": [{"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "LODGINGS TO LET", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001d0#xywh=246,2355,1974,187", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/69"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Hans of Iceland; or The Iron Casket", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001d0#xywh=189,2776,2111,348", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/70"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "My Husband's Secret; OR NATURAL MAGIC", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001d0#xywh=183,4191,2174,310", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/71"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "HARLEQUIN & GOLDEN EYES; or THE GOBLIN WOOD", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001d0#xywh=147,4779,2227,104", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/72"}], "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/annoPage-13.json"}
1 change: 1 addition & 0 deletions zooniverse/with_id/annoPage-14.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"@context": "http://iiif.io/api/presentation/3/context.json", "type": "AnnotationPage", "partOf": {"id": "https://zooniverse.github.io/iiif-annotations/annotations/titles.json", "type": "AnnotationCollection"}, "items": [{"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "ALL AT COVENTRY; OR LOVE AND LAUGH", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001d1#xywh=375,2259,2043,281", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/0"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "The Diamond Arrow; Or The Postmaster's Wife and Mayor's Daughter", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001d1#xywh=427,2947,1873,264", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/1"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "Harlequin's Hour-Glass; or TIME WORKS WONDERS", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001d1#xywh=369,3416,2013,274", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/2"}, {"type": "Annotation", "motivation": "tagging", "body": {"type": "TextualBody", "value": "JOCONDE; ou Le Prince Troubadour", "language": "en", "format": "text/plain"}, "target": "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100022589176.0x0001d1#xywh=681,4258,1400,111", "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/3"}], "id": "https://glenrobson.github.io/iiif_stuff/zooniverse/with_id/annoPage-14.json"}
Loading

0 comments on commit abd95d5

Please sign in to comment.