Unverified Commit 67b11e1d authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

don't extract the (invalid) locator url directly

parent 132935ef
Pipeline #20221 passed with stages
in 5 minutes and 57 seconds
......@@ -126,8 +126,9 @@ object Extractors {
.flatMap(obj =>
getBlankNodeContent(graph)(obj)("creationRelationHasTarget")
.flatMap(v => stringValue(v)("name")) match {
case Some(name) => Some(obj.getOrElse("name", obj("type")).str, name)
case None => None
case Some(name) =>
Some(obj.getOrElse("name", obj("type")).str, name)
case None => None
}
)
.toList
......@@ -177,8 +178,15 @@ object Extractors {
stringValue(digitalObject)("@id").flatMap(v => Some(s"$v/sequence/default"))
val canvasId: JObj => Option[String] = digitalObject =>
stringValue(digitalObject)("@id").flatMap(v => Some(s"$v/canvas/default"))
// This is a slight concession to the fact that the locator is sent as invalid
// sftp link. The locator link can however be built easily from the digitalObject
// id, so we check only the existence of the locator property, but discard a potential
// value.
val imageResourceId: JObj => Option[String] = digitalObject =>
stringValue(digitalObject)("locator")
stringValue(digitalObject)("locator").flatMap(_ =>
manifestId(digitalObject)
.flatMap(v => Some(v.replaceFirst("/manifest", "/binary")))
)
val mimeType: JObj => Option[String] = digitalObject =>
stringValue(digitalObject)("hasMimeType")
val imageHeight: JObj => Option[Double] = digitalObject =>
......
This diff is collapsed.
{
"@graph": [
{
"@id": "_:b0",
"@type": "https://www.ica.org/standards/RiC/ontology#Mechanism",
"name": "GenreNormalizer",
"performs": "_:b1"
},
{
"@id": "_:b1",
"@type": "https://www.ica.org/standards/RiC/ontology#Activity",
"beginningDate": "2021-56-16T12:56:27+0000",
"endDate": "2021-56-16T12:56:27+0000",
"performedBy": "_:b0",
"resultsIn": "_:b12",
"type": "enrichment"
},
{
"@id": "_:b10",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "© IASA / UNIL",
"regulates": "https://memobase.ch/record/ias-001-UNIL_FC_5463",
"type": "holder"
},
{
"@id": "_:b11",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "ias-001-UNIL_FC_5463-1",
"type": "main"
},
{
"@id": "_:b12",
"@type": "http://www.w3.org/2004/02/skos/core#Concept",
"prefLabel": [
{
"@language": "de",
"@value": "Andere"
},
{
"@language": "fr",
"@value": "Autres"
},
{
"@language": "it",
"@value": "Altri"
}
],
"resultsFrom": "_:b1"
},
{
"@id": "_:b13",
"@type": "https://www.ica.org/standards/RiC/ontology#Person",
"firstName": "Paul",
"lastName": "Collart",
"agentIsTargetOfCreationRelation": "_:b14",
"name": "Paul Collart"
},
{
"@id": "_:b14",
"@type": "https://www.ica.org/standards/RiC/ontology#CreationRelation",
"creationRelationHasSource": "https://memobase.ch/record/ias-001-UNIL_FC_5463",
"creationRelationHasTarget": "_:b13",
"type": "creator"
},
{
"@id": "_:b15",
"@type": "https://www.ica.org/standards/RiC/ontology#Mechanism",
"name": "CarrierTypeNormalizer",
"performs": "_:b4"
},
{
"@id": "_:b16",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "public",
"regulates": "https://memobase.ch/digital/ias-001-UNIL_FC_5463-1",
"type": "access"
},
{
"@id": "_:b17",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "ias-001-UNIL_FC_5463",
"type": "main"
},
{
"@id": "_:b18",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "UNIL_FC_5463",
"type": "original"
},
{
"@id": "_:b19",
"@type": "http://www.w3.org/2004/02/skos/core#Concept",
"prefLabel": "propylées"
},
{
"@id": "_:b2",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "IASA-UNIL_FC_5463",
"type": "oldMemobase"
},
{
"@id": "_:b20",
"@type": "https://www.ica.org/standards/RiC/ontology#Title",
"title": "Grèce - Athènes",
"type": "main"
},
{
"@id": "_:b21",
"@type": "https://www.ica.org/standards/RiC/ontology#Title",
"title": "boîte",
"type": "series"
},
{
"@id": "_:b22",
"@type": "http://www.w3.org/2004/02/skos/core#Concept",
"prefLabel": "Foto"
},
{
"@id": "_:b3",
"@type": "https://www.ica.org/standards/RiC/ontology#CarrierType",
"sameAs": "http://www.wikidata.org/entity/Q1138868",
"name": [
{
"@language": "de",
"@value": "Fotoplatte"
},
{
"@language": "fr",
"@value": "plaque photographique"
},
{
"@language": "it",
"@value": "lastra fotografica"
}
],
"resultsFrom": "_:b4"
},
{
"@id": "_:b4",
"@type": "https://www.ica.org/standards/RiC/ontology#Activity",
"beginningDate": "2021-56-16T12:56:27+0000",
"endDate": "2021-56-16T12:56:27+0000",
"performedBy": "_:b15",
"resultsIn": "_:b3",
"type": "enrichment"
},
{
"@id": "_:b5",
"@type": "https://www.ica.org/standards/RiC/ontology#Identifier",
"identifier": "ias-001-UNIL_FC_5463-1",
"type": "main"
},
{
"@id": "_:b6",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"sameAs": "http://rightsstatements.org/vocab/CNE/1.0/",
"name": "Copyright Not Evaluated (CNE)",
"regulates": "https://memobase.ch/digital/ias-001-UNIL_FC_5463-1",
"type": "usage"
},
{
"@id": "_:b7",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"sameAs": "http://rightsstatements.org/vocab/CNE/1.0/",
"name": "Copyright Not Evaluated (CNE)",
"regulates": "https://memobase.ch/physical/ias-001-UNIL_FC_5463-1",
"type": "usage"
},
{
"@id": "_:b8",
"@type": "https://www.ica.org/standards/RiC/ontology#CarrierType",
"name": "plaque"
},
{
"@id": "_:b9",
"@type": "https://www.ica.org/standards/RiC/ontology#Rule",
"name": "onsite",
"regulates": "https://memobase.ch/physical/ias-001-UNIL_FC_5463-1",
"type": "access"
},
{
"@id": "https://memobase.ch/digital/ias-001-UNIL_FC_5463-1",
"@type": "https://www.ica.org/standards/RiC/ontology#Instantiation",
"P60558": "Grayscale",
"hasFormat": "fmt/41",
"hasMimeType": "image/jpeg",
"height": "458.0",
"isDistributedOn": "image",
"locator": "sftp:/swissbib_index/mb_sftp/ias-001/media/UNIL_FC_5463.jpg",
"orientation": "TopLeft",
"width": "620.0",
"componentColor": [
"527F76",
"C0D9D9",
"8FBC8F",
"A9A9A9",
"2F2F4F",
"545454"
],
"identifiedBy": "_:b11",
"instantiates": "https://memobase.ch/record/ias-001-UNIL_FC_5463",
"isDerivedFromInstantiation": "https://memobase.ch/physical/ias-001-UNIL_FC_5463-1",
"regulatedBy": [
"_:b16",
"_:b6"
],
"type": "digitalObject"
},
{
"@id": "https://memobase.ch/physical/ias-001-UNIL_FC_5463-1",
"@type": "https://www.ica.org/standards/RiC/ontology#Instantiation",
"eventType": "CREATE",
"hasCarrierType": [
"_:b8",
"_:b3"
],
"hasDerivedInstantiation": "https://memobase.ch/digital/ias-001-UNIL_FC_5463-1",
"identifiedBy": "_:b5",
"instantiates": "https://memobase.ch/record/ias-001-UNIL_FC_5463",
"regulatedBy": [
"_:b7",
"_:b9"
],
"type": "physicalObject"
},
{
"@id": "https://memobase.ch/record/ias-001-UNIL_FC_5463",
"@type": "https://www.ica.org/standards/RiC/ontology#Record",
"P60451": "https://memobase.ch/institution/mrv",
"hasGenre": [
"_:b12",
"_:b22"
],
"eventType": "CREATE",
"https://memobase.ch/internal/isPublished": false,
"conditionsOfUse": "Toute utilisation est soumise à autorisation par Anne Bielman / IASA : Anne.Bielman@unil.ch.",
"hasInstantiation": [
"https://memobase.ch/digital/ias-001-UNIL_FC_5463-1",
"https://memobase.ch/physical/ias-001-UNIL_FC_5463-1"
],
"hasSubject": "_:b19",
"hasTitle": [
"_:b20",
"_:b21"
],
"heldBy": "https://memobase.ch/institution/ias",
"identifiedBy": [
"_:b17",
"_:b18",
"_:b2"
],
"isPartOf": "https://memobase.ch/recordSet/ias-001",
"recordResourceOrInstantiationIsSourceOfCreationRelation": "_:b14",
"regulatedBy": "_:b10",
"title": "Grèce - Athènes",
"type": "Foto"
}
],
"@context": {
"name": {
"@id": "https://www.ica.org/standards/RiC/ontology#name"
},
"performs": {
"@id": "https://www.ica.org/standards/RiC/ontology#performs",
"@type": "@id"
},
"type": {
"@id": "https://www.ica.org/standards/RiC/ontology#type"
},
"identifier": {
"@id": "https://www.ica.org/standards/RiC/ontology#identifier"
},
"sameAs": {
"@id": "http://schema.org/sameAs"
},
"resultsFrom": {
"@id": "https://www.ica.org/standards/RiC/ontology#resultsFrom",
"@type": "@id"
},
"regulates": {
"@id": "https://www.ica.org/standards/RiC/ontology#regulates",
"@type": "@id"
},
"regulatedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#regulatedBy",
"@type": "@id"
},
"hasCarrierType": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasCarrierType",
"@type": "@id"
},
"hasDerivedInstantiation": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasDerivedInstantiation",
"@type": "@id"
},
"identifiedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#identifiedBy",
"@type": "@id"
},
"instantiates": {
"@id": "https://www.ica.org/standards/RiC/ontology#instantiates",
"@type": "@id"
},
"eventType": {
"@id": "https://memobase.ch/internal/eventType"
},
"prefLabel": {
"@id": "http://www.w3.org/2004/02/skos/core#prefLabel"
},
"beginningDate": {
"@id": "https://www.ica.org/standards/RiC/ontology#beginningDate",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"endDate": {
"@id": "https://www.ica.org/standards/RiC/ontology#endDate",
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
},
"performedBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#performedBy",
"@type": "@id"
},
"resultsIn": {
"@id": "https://www.ica.org/standards/RiC/ontology#resultsIn",
"@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"
},
"creationRelationHasSource": {
"@id": "https://www.ica.org/standards/RiC/ontology#creationRelationHasSource",
"@type": "@id"
},
"creationRelationHasTarget": {
"@id": "https://www.ica.org/standards/RiC/ontology#creationRelationHasTarget",
"@type": "@id"
},
"isDerivedFromInstantiation": {
"@id": "https://www.ica.org/standards/RiC/ontology#isDerivedFromInstantiation",
"@type": "@id"
},
"componentColor": {
"@id": "http://www.europeana.eu/schemas/edm/componentColor",
"@type": "http://www.w3.org/2001/XMLSchema#hexBinary"
},
"width": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#width"
},
"hasFormat": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasFormat"
},
"hasMimeType": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasMimeType"
},
"locator": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#locator"
},
"P60558": {
"@id": "http://rdaregistry.info/Elements/u/P60558"
},
"height": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#height"
},
"isDistributedOn": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#isDistributedOn"
},
"orientation": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#orientation"
},
"hasInstantiation": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasInstantiation",
"@type": "@id"
},
"conditionsOfUse": {
"@id": "https://www.ica.org/standards/RiC/ontology#conditionsOfUse"
},
"recordResourceOrInstantiationIsSourceOfCreationRelation": {
"@id": "https://www.ica.org/standards/RiC/ontology#recordResourceOrInstantiationIsSourceOfCreationRelation",
"@type": "@id"
},
"hasGenre": {
"@id": "http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasGenre",
"@type": "@id"
},
"hasSubject": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasSubject",
"@type": "@id"
},
"P60451": {
"@id": "http://rdaregistry.info/Elements/u/P60451",
"@type": "@id"
},
"hasTitle": {
"@id": "https://www.ica.org/standards/RiC/ontology#hasTitle",
"@type": "@id"
},
"heldBy": {
"@id": "https://www.ica.org/standards/RiC/ontology#heldBy",
"@type": "@id"
},
"isPartOf": {
"@id": "https://www.ica.org/standards/RiC/ontology#isPartOf",
"@type": "@id"
},
"isPublished": {
"@id": "https://memobase.ch/internal/isPublished",
"@type": "http://www.w3.org/2001/XMLSchema#boolean"
},
"title": {
"@id": "https://www.ica.org/standards/RiC/ontology#title"
}
}
}
......@@ -44,6 +44,13 @@ class ManifestSpec extends AnyFunSuite {
assert(res.get.warnings.isEmpty)
}
test("a correct manifest should be built from image_input_4.json") {
val manifestBuilder = new Manifest
val res = manifestBuilder.create(Utils.loadFile("src/test/resources/image_input_4.json"))
assert(res.isSuccess)
assert(res.get.warnings.isEmpty)
}
test("an incorrect date format should result in a warning") {
val manifestBuilder = new Manifest
val res = manifestBuilder.create(Utils.loadFile("src/test/resources/wrong_date_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