Skip to content

Instantly share code, notes, and snippets.

@zimeon
Created September 6, 2018 09:39
Show Gist options
  • Save zimeon/221ab481ee9110a6ca690eadb126736c to your computer and use it in GitHub Desktop.
Save zimeon/221ab481ee9110a6ca690eadb126736c to your computer and use it in GitHub Desktop.
{
"@context": "https://ocfl.io/v1.0/",
"id": "urn:ark:/12345/bbb11ccc22",
"type": "Object",
"hashAlgorithm": "sha512",
"versions": [{
"type": "Version",
"id": "#v1",
"created": "2014-01-01T12:00:00Z",
"message": "Initial version",
"client": "OCFL Python Library 1.1.0",
"user": {
"name": "Andrew Hankinson",
"email": "[email protected]"
},
// # Member paths are local to the root of all locations. For zip files, this means
// # that the zip file must expand to have these files in the base directory, i.e.,
// # effectively "v1.zip/data/blah.txt", "v1.zip/metadata/foo.xml"
"members": {
"v1/data/blah.txt": "sha512-1",
"v1/metadata/foo.xml": "sha512-2"
},
"state": {
"v1/data/blah.txt": "sha512-1",
"v1/metadata/foo.xml": "sha512-2"
}
}, {
// Add new files; replace
"type": "Version",
"id": "#v2",
"created": "2015-05-01T12:00:00Z",
"message": "Updated foo",
"client": "OCFL Python Library 1.1.0",
"user": {
"name": "Andrew Hankinson",
"email": "[email protected]"
},
"locations": [{
"type": "Location",
"path": "v2/"
}],
"members": {
"v2/data/nnn/ppp1.tiff": "sha512-3",
"v2/metadata/foo.xml": "sha512-4",
"v2/metadata/empty.txt": "sha512-5"
},
"state": {
"v1/data/blah.txt": "sha512-1", // from v1
"v2/data/nnn/ppp1.tiff": "sha512-3", // from v2
"v2/metadata/foo.xml": "sha512-4", // from v2
"v2/metadata/empty.txt": "sha512-5" // from v2
}
}, {
// Add a duplicate hash, different filename
"type": "Version",
"id": "#v3",
"created": "2015-01-01T12:00:00Z",
"message": "Problem with bar",
"client": "OCFL Python Library 1.1.0",
"user": {
"name": "Andrew Hankinson",
"email": "[email protected]"
},
"members": {
"v3/metadata/empty2.txt": "sha512-5" // <-- same sha512 as empty.txt
},
"state": {
"v1/data/blah.txt": "sha512-1",
"v2/data/nnn/ppp1.tiff": "sha512-3",
"v2/metadata/foo.xml": "sha512-4",
"v2/metadata/empty.txt": "sha512-5",
"v3/metadata/empty2.txt": "sha512-6"
}
}, {
// Delete empty2.txt; no 'members'
"type": "Version",
"id": "#v4",
"created": "2016-01-01T12:00:00Z",
"message": "Deleted empty2.txt",
"client": "OCFL Python Library 1.2.0",
"user": {
"name": "Andrew Hankinson",
"email": "[email protected]"
},
"state": {
"v1/data/blah.txt": "sha512-1",
"v2/data/nnn/ppp1.tiff": "sha512-3",
"v2/metadata/foo.xml": "sha512-4",
"v2/metadata/empty.txt": "sha512-5"
}
}, {
// Rename and Replace foo.xml
"type": "Version",
"id": "#v5",
"created": "2016-01-01T12:00:00Z",
"message": "Replaced foo.xml",
"client": "OCFL Python Library 1.2.0",
"user": {
"name": "Andrew Hankinson",
"email": "[email protected]"
},
# Files in this version = additions + excludes, could remove leading "v5" in key
"additions": {
"v5/metadata/foo.xml": "sha512-6"
},
"includes": {
"v5/data/blah.txt": "v1/data/blah.txt",
"v5/data/nnn/ppp1.tiff": "v2/data/nnn/ppp1.tiff",
"v5/metadata/foo-old.xml": "v2/metadata/foo.xml", #rename
"v5/metadata/empty.txt": "v2/metadata/empty.txt",
"v5/metadata/copy-of-foo.xml": "v5/metadata/foo.xml" #copy of file in this same version
}
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment