Commit 2b6d62e5 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Change memoriav sponsoring claim implementation.

Will now expect a boolean.
parent 5f803bca
Pipeline #10639 passed with stages
in 9 minutes and 15 seconds
......@@ -91,7 +91,8 @@ class KafkaTopology(
config.digitalObjectFieldMappers,
value,
settings.appSettings.getProperty("institutionId"),
settings.appSettings.getProperty("recordSetId")
settings.appSettings.getProperty("recordSetId"),
config.sponsoredByMemoriav
)
}
......
......@@ -21,11 +21,11 @@ package org.memobase.builder
import org.apache.jena.rdf.model.Resource
import org.memobase.helpers.StringHelpers
import org.memobase.mapping.KEYS
import org.memobase.mapping.fields.SimpleAnnotationField
import org.memobase.rdf.NS
import org.memobase.rdf.RDA
import org.memobase.rdf.RICO
class Record(id: String, type: String, recordSetId: String, institutionId: String) :
class Record(id: String, type: String, recordSetId: String, institutionId: String, hasSponsoringAgent: Boolean) :
RecordResource(institutionId) {
override val resource: Resource = model.createResource(NS.memr + institutionId + "-" + StringHelpers.normalizeId(id))
......@@ -35,6 +35,9 @@ class Record(id: String, type: String, recordSetId: String, institutionId: Strin
resource.addProperty(RICO.isPartOf, recordSetUri(recordSetId))
resource.addProperty(RICO.heldBy, institutionUri)
addRicoConcept(KEYS.identifiers, "main", listOf(literal(resource.uri)))
if (hasSponsoringAgent) {
resource.addProperty(RDA.hasSponsoringAgentOfResource, model.createResource(KEYS.memoriavUri))
}
}
fun addInstantiation(instantiation: Instantiation) {
......
......@@ -38,7 +38,8 @@ class ResourceBuilder(
private val digitalObjectFieldMappers: List<IFieldMapper>,
private val source: Map<String, String>,
private val institutionId: String,
private val recordSetId: String
private val recordSetId: String,
private val isSponsoredByMemoriav: Boolean
) {
private var record: Record? = null
private var physicalObject: PhysicalObject? = null
......@@ -91,7 +92,7 @@ class ResourceBuilder(
}
fun generateRecord(): ResourceBuilder {
record = Record(recordId, recordTypeValue, recordSetId, institutionId)
record = Record(recordId, recordTypeValue, recordSetId, institutionId, isSponsoredByMemoriav)
for (recordFieldMapper in recordFieldMappers) {
recordFieldMapper.apply(source, record!!)
}
......
......@@ -20,12 +20,15 @@ package org.memobase.mapping
import org.memobase.rdf.DC
import org.memobase.rdf.EBUCORE
import org.memobase.rdf.NS
import org.memobase.rdf.RDA
import org.memobase.rdf.RICO
import org.memobase.rdf.SCHEMA
object KEYS {
val memoriavUri = NS.memint + "Memoriav"
val validRecordTypeValues = listOf("Film", "Foto", "Radio", "Ton", "Tonbildschau", "TV", "Video")
const val uri = "uri"
......@@ -39,7 +42,7 @@ object KEYS {
const val abstract = "abstract"
const val source = "source"
const val title = "title"
const val hasSponsoringAgent = "hasSponsoringAgent"
const val isSponsoredByMemoriav = "isSponsoredByMemoriav"
const val hasFindingAid = "hasFindingAid"
const val sameAs = "sameAs"
const val relation = "relation"
......@@ -144,7 +147,7 @@ object KEYS {
Pair(source, RICO.source),
Pair(descriptiveNote, RICO.descriptiveNote),
Pair(scopeAndContent, RICO.scopeAndContent),
Pair(hasSponsoringAgent, RDA.hasSponsoringAgentOfResource),
Pair(isSponsoredByMemoriav, RDA.hasSponsoringAgentOfResource),
Pair(hasFindingAid, RDA.hasFindingAid),
Pair(creationDate, DC.created),
Pair(issuedDate, DC.issued),
......
......@@ -54,6 +54,7 @@ class MappingConfig(directory: String) {
val recordFieldMappers = mutableListOf<IFieldMapper>()
val physicalObjectFieldMappers = mutableListOf<IFieldMapper>()
val digitalObjectFieldMappers = mutableListOf<IFieldMapper>()
var sponsoredByMemoriav = false
private val log = LogManager.getLogger("MappingConfigParser")
......@@ -101,9 +102,12 @@ class MappingConfig(directory: String) {
KEYS.type -> {
localRecordType = parseSimpleAnnotationField(key, entry.value)
}
KEYS.isSponsoredByMemoriav -> {
sponsoredByMemoriav = entry.value as Boolean
}
// literal properties
KEYS.name, KEYS.title, KEYS.descriptiveNote, KEYS.scopeAndContent, KEYS.sameAs,
KEYS.abstract, KEYS.source, KEYS.hasSponsoringAgent, KEYS.hasFindingAid, KEYS.relation,
KEYS.abstract, KEYS.source, KEYS.hasFindingAid, KEYS.relation,
KEYS.conditionsOfUse, KEYS.conditionsOfAccess ->
recordFieldMappers.add(buildAnnotationMappers(entry))
KEYS.rights ->
......
......@@ -127,12 +127,20 @@ class Tests {
KafkaTestParams(
1,
"MEI_49884",
listOf("MEI_49884"),
listOf(
"https://memobase.ch/record/BAZ-MEI_49884",
"https://memobase.ch/instantiation/physical/BAZ-MEI_49884-0"
),
listOf(
Report(
"https://memobase.ch/record/BAZ-MEI_49884",
"SUCCESS",
"Successfully created a record from source."
),
Report(
"MEI_49884",
"FAILURE",
"No type for record in field 'Foto for source {original_id=MEI_49884}."
"https://memobase.ch/instantiation/physical/BAZ-MEI_49884-0",
"SUCCESS",
"Successfully created a physical instantiation from source."
)
)
),
......
record:
uri: original_id
type: Foto # is always a constant!
type:
const: Foto
isSponsoredByMemoriav: true
title:
de: titel
descriptiveNote: # rico:descriptiveNote
......@@ -63,6 +65,4 @@ record:
- strasse2
- hausnummer2
- name:
de: bezeichnung_bauobjekt
hasSponsoringAgent: # rdau:P60451 with value "Memoriav"
const: Memoriav
\ No newline at end of file
de: bezeichnung_bauobjekt
\ No newline at end of file
ERROR: No record type value specified!
\ No newline at end of file
<https://memobase.ch/record/BAZ-MEI_49884> <http://rdaregistry.info/Elements/u/P60451> <https://memobase.ch/institution/Memoriav> .
<https://memobase.ch/record/BAZ-MEI_49884> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Record> .
<https://memobase.ch/record/BAZ-MEI_49884> <https://www.ica.org/standards/RiC/ontology#hasInstantiation> <https://memobase.ch/instantiation/physical/BAZ-MEI_49884-0> .
<https://memobase.ch/record/BAZ-MEI_49884> <https://www.ica.org/standards/RiC/ontology#hasTitle> _:B .
<https://memobase.ch/record/BAZ-MEI_49884> <https://www.ica.org/standards/RiC/ontology#heldBy> <https://memobase.ch/institution/BAZ> .
<https://memobase.ch/record/BAZ-MEI_49884> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/record/BAZ-MEI_49884> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/record/BAZ-MEI_49884> <https://www.ica.org/standards/RiC/ontology#isPartOf> <https://memobase.ch/recordSet/BAZ-B_MEI> .
<https://memobase.ch/record/BAZ-MEI_49884> <https://www.ica.org/standards/RiC/ontology#type> "Foto" .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Identifier> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Identifier> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Title> .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "MEI_49884" .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "https://memobase.ch/record/BAZ-MEI_49884" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "callNumber" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
\ No newline at end of file
<https://memobase.ch/instantiation/physical/BAZ-MEI_49884-0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Instantiation> .
<https://memobase.ch/instantiation/physical/BAZ-MEI_49884-0> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/instantiation/physical/BAZ-MEI_49884-0> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/instantiation/physical/BAZ-MEI_49884-0> <https://www.ica.org/standards/RiC/ontology#instantiates> <https://memobase.ch/record/BAZ-MEI_49884> .
<https://memobase.ch/instantiation/physical/BAZ-MEI_49884-0> <https://www.ica.org/standards/RiC/ontology#type> "physicalObject" .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Identifier> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Identifier> .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "MEI_49884" .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "https://memobase.ch/instantiation/physical/BAZ-MEI_49884-0" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "original" .
\ No newline at end of file
......@@ -2,6 +2,7 @@ record:
uri: original_id
type:
const: Foto
hasSponsoringAgent: true
title:
de: titel
descriptiveNote: # rico:descriptiveNote
......@@ -64,6 +65,4 @@ record:
- strasse2
- hausnummer2
- name:
de: bezeichnung_bauobjekt
hasSponsoringAgent: # rdau:P60451 with value "Memoriav"
const: Memoriav
\ No newline at end of file
de: bezeichnung_bauobjekt
\ No newline at end of file
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