Verified Commit 329c1379 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

add collection id prefix to binary id

parent d7634e53
Pipeline #35360 passed with stages
in 6 minutes and 48 seconds
......@@ -79,9 +79,14 @@ object BinaryResourceMetadata extends RecordUtils {
v.obj match {
case v if isLocalRecord(v) && isProcessableMimeType(v) =>
val instantiation = MemobaseResource(v("type").str)
val locator = v("locator").str.split("/").last.split("\\.")(0).replaceAll(" ", "_")
val binaryObjectId = v("@id").str.substring(s"$baseUrl/digital/".length - 1)
val locator = {
val basename = v("locator").str.split("/").last.split("\\.")(0).replaceAll(" ", "_")
val recordSetId = binaryObjectId.substring(1, 8)
s"$recordSetId-$basename"
}
BinaryResourceMetadata(
v("@id").str.substring(s"$baseUrl/digital/".length - 1),
binaryObjectId,
buildDistributorUrl(locator, distributorHost, instantiation),
Conversions.getMediaFileType(v("hasMimeType").str).get,
instantiation)
......
......@@ -3,7 +3,7 @@
},
"@graph": [
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1",
"@type": [
"ldp:RDFSource",
"ldp:Container",
......@@ -16,44 +16,44 @@
"createdBy": "fedoraAdmin",
"lastModified": "2020-06-30T10:07:26.563Z",
"lastModifiedBy": "fedoraAdmin",
"contains": "https://memobase.ch/digital/BAZ-MEI_77466-1/binary",
"contains": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1/binary",
"hasMimeType": "{{mimeType}}",
"locator": "{{locator}}",
"identifiedBy": [
"https://memobase.ch/digital/BAZ-MEI_77466-1#genidd1c6f2c6-99a9-407a-970a-1ec31a8e0292",
"https://memobase.ch/digital/BAZ-MEI_77466-1#genidada014e8-ead3-459f-a7ea-ac0aaf02b392"
"https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genidd1c6f2c6-99a9-407a-970a-1ec31a8e0292",
"https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genidada014e8-ead3-459f-a7ea-ac0aaf02b392"
],
"instantiates": "https://memobase.ch/record/BAZ-MEI_77466",
"isDerivedFromInstantiation": "https://memobase.ch/physical/BAZ-MEI_77466-0",
"regulatedBy": [
"https://memobase.ch/digital/BAZ-MEI_77466-1#genid03e8a0c8-2164-4608-93b9-14a2361b90d2",
"https://memobase.ch/digital/BAZ-MEI_77466-1#genid5abe8161-110a-429f-a6b7-9e7e10dafe0d"
"https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genid03e8a0c8-2164-4608-93b9-14a2361b90d2",
"https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genid5abe8161-110a-429f-a6b7-9e7e10dafe0d"
],
"type": "digitalObject"
},
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1#genid03e8a0c8-2164-4608-93b9-14a2361b90d2",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genid03e8a0c8-2164-4608-93b9-14a2361b90d2",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"sameAs": "http://rightsstatements.org/vocab/InC/1.0/",
"name": "In Copyright (InC)",
"regulates": "https://memobase.ch/digital/BAZ-MEI_77466-1",
"regulates": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1",
"type": "usage"
},
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1#genid5abe8161-110a-429f-a6b7-9e7e10dafe0d",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genid5abe8161-110a-429f-a6b7-9e7e10dafe0d",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "public",
"regulates": "https://memobase.ch/digital/BAZ-MEI_77466-1",
"regulates": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1",
"type": "access"
},
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1#genidada014e8-ead3-459f-a7ea-ac0aaf02b392",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genidada014e8-ead3-459f-a7ea-ac0aaf02b392",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "MEI_77466",
"type": "original"
},
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1#genidd1c6f2c6-99a9-407a-970a-1ec31a8e0292",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genidd1c6f2c6-99a9-407a-970a-1ec31a8e0292",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "http://127.0.0.1:8080/fcrepo/rest/digital/BAZ-MEI_77466-1",
"type": "main"
......@@ -167,7 +167,7 @@
"type": "Fotograf"
},
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1/binary",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1/binary",
"@type": [
"ldp:NonRDFSource",
"fedora:Binary",
......@@ -175,13 +175,13 @@
],
"created": "2020-06-30T10:07:26.621Z",
"createdBy": "fedoraAdmin",
"hasFixityService": "https://memobase.ch/digital/BAZ-MEI_77466-1/binary/fcr:fixity",
"hasFixityService": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1/binary/fcr:fixity",
"lastModified": "2020-06-30T10:07:26.621Z",
"lastModifiedBy": "fedoraAdmin",
"filename": "Nicolas_Muller_snowboard_wallpaper_1920x1080.jpg",
"hasMimeType": "{{mimeType}}",
"eventType": "{{eventType}}",
"describedby": "https://memobase.ch/digital/BAZ-MEI_77466-1/binary/fcr:metadata",
"describedby": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1/binary/fcr:metadata",
"hasMessageDigest": "urn:sha1:884adf9882fd76cc1c863f527bcde9cc45d7cfc0",
"hasSize": "244220"
}
......
......@@ -3,7 +3,7 @@
},
"@graph": [
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1",
"@type": [
"ldp:RDFSource",
"ldp:Container",
......@@ -16,43 +16,43 @@
"createdBy": "fedoraAdmin",
"lastModified": "2020-06-30T10:07:26.563Z",
"lastModifiedBy": "fedoraAdmin",
"contains": "https://memobase.ch/digital/BAZ-MEI_77466-1/binary",
"contains": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1/binary",
"hasMimeType": "{{mimeType}}",
"identifiedBy": [
"https://memobase.ch/digital/BAZ-MEI_77466-1#genidd1c6f2c6-99a9-407a-970a-1ec31a8e0292",
"https://memobase.ch/digital/BAZ-MEI_77466-1#genidada014e8-ead3-459f-a7ea-ac0aaf02b392"
"https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genidd1c6f2c6-99a9-407a-970a-1ec31a8e0292",
"https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genidada014e8-ead3-459f-a7ea-ac0aaf02b392"
],
"instantiates": "https://memobase.ch/record/BAZ-MEI_77466",
"isDerivedFromInstantiation": "https://memobase.ch/physical/BAZ-MEI_77466-0",
"regulatedBy": [
"https://memobase.ch/digital/BAZ-MEI_77466-1#genid03e8a0c8-2164-4608-93b9-14a2361b90d2",
"https://memobase.ch/digital/BAZ-MEI_77466-1#genid5abe8161-110a-429f-a6b7-9e7e10dafe0d"
"https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genid03e8a0c8-2164-4608-93b9-14a2361b90d2",
"https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genid5abe8161-110a-429f-a6b7-9e7e10dafe0d"
],
"type": "digitalObject"
},
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1#genid03e8a0c8-2164-4608-93b9-14a2361b90d2",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genid03e8a0c8-2164-4608-93b9-14a2361b90d2",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"sameAs": "http://rightsstatements.org/vocab/InC/1.0/",
"name": "In Copyright (InC)",
"regulates": "https://memobase.ch/digital/BAZ-MEI_77466-1",
"regulates": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1",
"type": "usage"
},
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1#genid5abe8161-110a-429f-a6b7-9e7e10dafe0d",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genid5abe8161-110a-429f-a6b7-9e7e10dafe0d",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "public",
"regulates": "https://memobase.ch/digital/BAZ-MEI_77466-1",
"regulates": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1",
"type": "access"
},
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1#genidada014e8-ead3-459f-a7ea-ac0aaf02b392",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genidada014e8-ead3-459f-a7ea-ac0aaf02b392",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "MEI_77466",
"type": "original"
},
{
"@id": "https://memobase.ch/digital/BAZ-MEI_77466-1#genidd1c6f2c6-99a9-407a-970a-1ec31a8e0292",
"@id": "https://memobase.ch/digital/baz-001-BAZ-MEI_77466-1#genidd1c6f2c6-99a9-407a-970a-1ec31a8e0292",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "http://127.0.0.1:8080/fcrepo/rest/digital/BAZ-MEI_77466-1",
"type": "main"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment