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

accept another date format

parent 627b2141
Pipeline #43562 passed with stages
in 5 minutes and 44 seconds
......@@ -230,6 +230,7 @@ class Manifest {
}
private lazy val onlyYear = "^(\\d{4})$".r // e.g. 1931
private lazy val onlyMonth = "^(\\d{4}-\\d{2})$".r // e.g. 1931-12
private lazy val date = "^(\\d{4}-\\d{2}-\\d{2})$".r // e.g. 1931-12-30
private lazy val yearRange = "^(\\d{4}/\\d{4})$".r // e.g. 1931/1964
private lazy val monthRange = "^(\\d{4}-\\d{2}/\\d{4}-\\d{2})$".r // e.g. 1931-12/1964-01
......@@ -256,6 +257,8 @@ class Manifest {
parseTimestamp(LocalDate.parse(value, dateTimeFormatter))
case onlyYear(value) =>
parseTimestamp(LocalDate.parse(s"$value-01-01", dateTimeFormatter))
case onlyMonth(value) =>
parseTimestamp(LocalDate.parse(s"$value-01", dateTimeFormatter))
case yearRange(value) =>
val dateRangeStart = value.split("/")(0)
val dateRangeEnd = value.split("/")(1)
......
{
"@graph": [
{
"@id": "_:b0",
"@type": "https://www.ica.org/standards/RiC/ontology#Activity",
"hasBeginningDate": "_:b2",
"performedBy": "_:b1"
},
{
"@id": "_:b1",
"@type": "https://www.ica.org/standards/RiC/ontology#Mechanism",
"name": "06-media-metadata-extractor"
},
{
"@id": "_:b10",
"@type": "https://www.ica.org/standards/RiC/ontology#Place",
"name": "Aarau"
},
{
"@id": "_:b11",
"@type": "https://www.ica.org/standards/RiC/ontology#Title",
"title": "Aare und Jura, vom Aarensand aus",
"type": "main"
},
{
"@id": "_:b12",
"@type": "https://www.ica.org/standards/RiC/ontology#DateRange",
"normalizedDateValue": "1889-04"
},
{
"@id": "_:b13",
"@type": "http://www.w3.org/2004/02/skos/core#Concept",
"prefLabel": "Wasserfluh"
},
{
"@id": "_:b14",
"@type": "http://www.w3.org/2004/02/skos/core#Concept",
"prefLabel": "Telli"
},
{
"@id": "_:b15",
"@type": "http://www.w3.org/2004/02/skos/core#Concept",
"prefLabel": "Jura"
},
{
"@id": "_:b16",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "public",
"regulates": "https://memobase.ch/digital/maa-003-SF_2019-0282-1",
"type": "access"
},
{
"@id": "_:b17",
"@type": "https://www.ica.org/standards/RiC/ontology#CarrierType",
"name": "Gelatinetrockenplatte Glasplattennegativ"
},
{
"@id": "_:b18",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "",
"resultsFrom": "_:b0",
"type": "exifCopyright"
},
{
"@id": "_:b19",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "maa-003-SF_2019-0282-1",
"type": "main"
},
{
"@id": "_:b2",
"@type": "https://www.ica.org/standards/RiC/ontology#SingleDate",
"normalizedDateValue": "2022-02-23T09:16:13.562Z"
},
{
"@id": "_:b20",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"sameAs": "http://creativecommons.org/licenses/by-nc-nd/4.0/",
"name": "Creative Commons - Attribution, Non-Commercial, No Derivatives (BY-NC-ND)",
"regulates": "https://memobase.ch/digital/maa-003-SF_2019-0282-1",
"type": "usage"
},
{
"@id": "_:b21",
"@type": "https://www.ica.org/standards/RiC/ontology#SingleDate",
"normalizedDateValue": "2020-06-05T14:43:29.000Z",
"resultsFrom": "_:b25"
},
{
"@id": "_:b22",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"sameAs": "http://rightsstatements.org/vocab/InC-EDU/1.0/",
"name": "In Copyright - Educational Use Permitted (InC-EDU)",
"regulates": "https://memobase.ch/physical/maa-003-SF_2019-0282-1",
"type": "usage"
},
{
"@id": "_:b23",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "maa-003-SF_2019-0282-1",
"type": "main"
},
{
"@id": "_:b24",
"@type": "https://www.ica.org/standards/RiC/ontology#Agent",
"agentIsTargetOfCreationRelation": "_:b9",
"name": "Friedrich Hans August Frey (1871 - 1931)"
},
{
"@id": "_:b25",
"@type": "https://www.ica.org/standards/RiC/ontology#Activity",
"hasBeginningDate": "_:b27",
"performedBy": "_:b26"
},
{
"@id": "_:b26",
"@type": "https://www.ica.org/standards/RiC/ontology#Mechanism",
"name": "06-media-metadata-extractor"
},
{
"@id": "_:b27",
"@type": "https://www.ica.org/standards/RiC/ontology#SingleDate",
"normalizedDateValue": "2022-02-23T09:16:13.562Z"
},
{
"@id": "_:b28",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "onsite",
"regulates": "https://memobase.ch/physical/maa-003-SF_2019-0282-1",
"type": "access"
},
{
"@id": "_:b3",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "maa-003-SF_2019-0282",
"type": "main"
},
{
"@id": "_:b4",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "SF_2019-0282",
"type": "original"
},
{
"@id": "_:b5",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "Stadtmuseum Aarau",
"regulates": "https://memobase.ch/record/maa-003-SF_2019-0282",
"type": "holder"
},
{
"@id": "_:b6",
"@type": "https://www.ica.org/standards/RiC/ontology#Person",
"firstName": "Friedrich Hans",
"lastName": "August Frey",
"agentIsTargetOfCreationRelation": "_:b7",
"name": "Friedrich Hans, August Frey"
},
{
"@id": "_:b7",
"@type": "https://www.ica.org/standards/RiC/ontology#CreationRelation",
"creationRelationHasSource": "https://memobase.ch/record/maa-003-SF_2019-0282",
"creationRelationHasTarget": "_:b6",
"type": "creator"
},
{
"@id": "_:b8",
"@type": "http://www.w3.org/2004/02/skos/core#Concept",
"prefLabel": "Aarensand"
},
{
"@id": "_:b9",
"@type": "https://www.ica.org/standards/RiC/ontology#CreationRelation",
"creationRelationHasSource": "https://memobase.ch/record/maa-003-SF_2019-0282",
"creationRelationHasTarget": "_:b24",
"type": "contributor"
},
{
"@id": "https://memobase.ch/digital/maa-003-SF_2019-0282-1",
"@type": "https://www.ica.org/standards/RiC/ontology#Instantiation",
"http://purl.org/dc/terms/1.0/created": {
"@id": "_:b21"
},
"P60558": "Grayscale",
"hasFormat": "fmt/1507",
"hasMimeType": "image/jpeg",
"height": "4565.0",
"isDistributedOn": "image",
"locator": "sftp:/swissbib_index/mb_sftp/stage/maa-003/media/SF_2019-0282.jpg",
"orientation": "TopLeft",
"width": "6299.0",
"componentColor": [
"000000",
"A9A9A9",
"C0D9D9",
"A8A8A8",
"545454",
"C0C0C0",
"E6E6FA"
],
"proxyType": "proxydirect",
"hasDerivedInstantiation": "https://memobase.ch/digital/maa-003-SF_2019-0282-1/derived",
"identifiedBy": "_:b19",
"instantiates": "https://memobase.ch/record/maa-003-SF_2019-0282",
"isDerivedFromInstantiation": "https://memobase.ch/physical/maa-003-SF_2019-0282-1",
"regulatedBy": [
"_:b16",
"_:b18",
"_:b20"
],
"type": "digitalObject"
},
{
"@id": "https://memobase.ch/digital/maa-003-SF_2019-0282-1/derived",
"@type": "https://www.ica.org/standards/RiC/ontology#Instantiation",
"P60558": "Grayscale",
"hasFormat": "fmt/43",
"hasMimeType": "image/jpeg",
"height": "696.0",
"isDistributedOn": "image",
"locator": "sftp:/swissbib_index/mb_sftp/stage/maa-003/thumbnails/SF_2019-0282.jpg",
"orientation": "Undefined",
"width": "960.0",
"componentColor": [
"A8A8A8",
"E6E6FA",
"545454",
"C0D9D9",
"000000",
"C0C0C0",
"A9A9A9"
],
"eventType": "CREATE",
"instantiates": "https://memobase.ch/record/maa-003-SF_2019-0282",
"isDerivedFromInstantiation": "https://memobase.ch/digital/maa-003-SF_2019-0282-1",
"type": "thumbnail"
},
{
"@id": "https://memobase.ch/physical/maa-003-SF_2019-0282-1",
"@type": "https://www.ica.org/standards/RiC/ontology#Instantiation",
"hasCarrierType": "_:b17",
"hasDerivedInstantiation": "https://memobase.ch/digital/maa-003-SF_2019-0282-1",
"identifiedBy": "_:b23",
"instantiates": "https://memobase.ch/record/maa-003-SF_2019-0282",
"physicalCharacteristics": "13 x 18 cm Objektmass <br> Glasdicke: 1.6 bis 2 mm Objektmass <br> Gelatinetrockenplatte <br> Glasplattennegativ",
"regulatedBy": [
"_:b28",
"_:b22"
],
"type": "physicalObject"
},
{
"@id": "https://memobase.ch/record/maa-003-SF_2019-0282",
"@type": "https://www.ica.org/standards/RiC/ontology#Record",
"created": "_:b12",
"spatial": "_:b10",
"P60451": "https://memobase.ch/institution/mav",
"eventType": "CREATE",
"isPublished": true,
"conditionsOfUse": "Die Reproduktion ist gemäss den geltenden Bestimmungen der Benutzungs- und Gebührenordnung des Stadtmuseums Aarau möglich.",
"hasInstantiation": [
"https://memobase.ch/physical/maa-003-SF_2019-0282-1",
"https://memobase.ch/digital/maa-003-SF_2019-0282-1",
"https://memobase.ch/digital/maa-003-SF_2019-0282-1/derived"
],
"hasSubject": [
"_:b8",
"_:b13",
"_:b14",
"_:b15"
],
"hasTitle": "_:b11",
"heldBy": "https://memobase.ch/institution/maa",
"identifiedBy": [
"_:b3",
"_:b4"
],
"isPartOf": "https://memobase.ch/recordSet/maa-003",
"recordResourceOrInstantiationIsSourceOfCreationRelation": [
"_:b9",
"_:b7"
],
"regulatedBy": "_:b5",
"scopeAndContent": "Glasnegative von August Frey (1871-1931)",
"title": "Aare und Jura, vom Aarensand aus",
"type": "Foto"
}
],
"@context": {
"performedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#performedBy",
"@type": "@id"
},
"hasBeginningDate": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasBeginningDate",
"@type": "@id"
},
"type": {
"@id": "https://www.ica.org/standards/RiC/ontology#type"
},
"identifier": {
"@id": "https://www.ica.org/standards/RiC/ontology#identifier"
},
"name": {
"@id": "https://www.ica.org/standards/RiC/ontology#name"
},
"regulates": {
"@id": "https://www.ica.org/standards/RiC/ontology#regulates",
"@type": "@id"
},
"agentIsTargetOfCreationRelation": {
"@id": "https://www.ica.org/standards/RiC/ontology#agentIsTargetOfCreationRelation",
"@type": "@id"
},
"firstName": {
"@id": "http://xmlns.com/foaf/0.1/firstName"
},
"lastName": {
"@id": "http://xmlns.com/foaf/0.1/lastName"
},
"hasSubject": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasSubject",
"@type": "@id"
},
"recordResourceOrInstantiationIsSourceOfCreationRelation": {
"@id": "https://www.ica.org/standards/RiC/ontology#recordResourceOrInstantiationIsSourceOfCreationRelation",
"@type": "@id"
},
"title": {
"@id": "https://www.ica.org/standards/RiC/ontology#title"
},
"P60451": {
"@id": "http://rdaregistry.info/Elements/u/P60451",
"@type": "@id"
},
"spatial": {
"@id": "http://purl.org/dc/terms/spatial",
"@type": "@id"
},
"hasTitle": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasTitle",
"@type": "@id"
},
"scopeAndContent": {
"@id": "https://www.ica.org/standards/RiC/ontology#scopeAndContent"
},
"eventType": {
"@id": "https://memobase.ch/internal/eventType"
},
"created": {
"@id": "http://purl.org/dc/terms/created",
"@type": "@id"
},
"identifiedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#identifiedBy",
"@type": "@id"
},
"isPartOf": {
"@id": "https://www.ica.org/standards/RiC/ontology#isPartOf",
"@type": "@id"
},
"hasInstantiation": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasInstantiation",
"@type": "@id"
},
"heldBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#heldBy",
"@type": "@id"
},
"regulatedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#regulatedBy",
"@type": "@id"
},
"isPublished": {
"@id": "https://memobase.ch/internal/isPublished",
"@type": "http://www.w3.org/2001/XMLSchema#boolean"
},
"conditionsOfUse": {
"@id": "https://www.ica.org/standards/RiC/ontology#conditionsOfUse"
},
"normalizedDateValue": {
"@id": "https://www.ica.org/standards/RiC/ontology#normalizedDateValue"
},
"hasMimeType": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasMimeType"
},
"instantiates": {
"@id": "https://www.ica.org/standards/RiC/ontology#instantiates",
"@type": "@id"
},
"isDistributedOn": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#isDistributedOn"
},
"proxyType": {
"@id": "https://memobase.ch/internal/proxyType"
},
"componentColor": {
"@id": "http://www.europeana.eu/schemas/edm/componentColor",
"@type": "http://www.w3.org/2001/XMLSchema#hexBinary"
},
"isDerivedFromInstantiation": {
"@id": "https://www.ica.org/standards/RiC/ontology#isDerivedFromInstantiation",
"@type": "@id"
},
"hasDerivedInstantiation": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasDerivedInstantiation",
"@type": "@id"
},
"P60558": {
"@id": "http://rdaregistry.info/Elements/u/P60558"
},
"width": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#width"
},
"orientation": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#orientation"
},
"hasFormat": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasFormat"
},
"locator": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#locator"
},
"height": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#height"
},
"creationRelationHasSource": {
"@id": "https://www.ica.org/standards/RiC/ontology#creationRelationHasSource",
"@type": "@id"
},
"creationRelationHasTarget": {
"@id": "https://www.ica.org/standards/RiC/ontology#creationRelationHasTarget",
"@type": "@id"
},
"sameAs": {
"@id": "http://schema.org/sameAs"
},
"resultsFrom": {
"@id": "https://www.ica.org/standards/RiC/ontology#resultsFrom",
"@type": "@id"
},
"prefLabel": {
"@id": "http://www.w3.org/2004/02/skos/core#prefLabel"
},
"hasCarrierType": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasCarrierType",
"@type": "@id"
},
"physicalCharacteristics": {
"@id": "https://www.ica.org/standards/RiC/ontology#physicalCharacteristics"
}
}
}
\ No newline at end of file
......@@ -51,6 +51,13 @@ class ManifestSpec extends AnyFunSuite {
assert(res.get.warnings.isEmpty)
}
test("a correct manifest should be built from image_input_5.json") {
val manifestBuilder = new Manifest
val res = manifestBuilder.create(Utils.loadFile("src/test/resources/image_input_5.json"))
assert(res.isSuccess)
assert(res.get.warnings.isEmpty)
}
test("a date consisting only of a year should result in a success") {
val manifestBuilder = new Manifest
val res = manifestBuilder.create(Utils.loadFile("src/test/resources/year_only_format.json"))
......
Supports Markdown
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