Commit 8d24a499 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix missing skos:Concept entities

parent 4ca0d42c
Pipeline #10801 passed with stages
in 12 minutes and 53 seconds
...@@ -115,29 +115,7 @@ class MappingConfig(directory: String) { ...@@ -115,29 +115,7 @@ class MappingConfig(directory: String) {
KEYS.titles, KEYS.identifiers, KEYS.languages -> KEYS.titles, KEYS.identifiers, KEYS.languages ->
recordFieldMappers.addAll(buildRicoConceptMappers(key, entry.value)) recordFieldMappers.addAll(buildRicoConceptMappers(key, entry.value))
KEYS.subject, KEYS.genre -> KEYS.subject, KEYS.genre ->
when (val value = entry.value) { recordFieldMappers.addAll(buildSkosConceptMappers(key, entry.value))
is Map<*, *> -> {
extractEntityFields<SkosConceptFieldMapper>(
key,
value as Map<String, Any>,
SKOS.acceptedPropertiesList
)
}
is List<*> -> {
for (item in value) {
try {
extractEntityFields<SkosConceptFieldMapper>(
key,
item as Map<String, Any>,
SKOS.acceptedPropertiesList
)
} catch (ex: ClassCastException) {
throw InvalidMappingException("Expected a map inside of the list entry in the ${entry.key} section.")
}
}
}
else -> throw InvalidMappingException("Expected a mapping or a list inside of the ${entry.key} section!")
}
KEYS.placeOfCapture, KEYS.relatedPlaces -> KEYS.placeOfCapture, KEYS.relatedPlaces ->
recordFieldMappers.addAll(buildPlaceMapper(key, entry.value)) recordFieldMappers.addAll(buildPlaceMapper(key, entry.value))
KEYS.creationDate, KEYS.issuedDate, KEYS.temporal -> KEYS.creationDate, KEYS.issuedDate, KEYS.temporal ->
...@@ -248,6 +226,32 @@ class MappingConfig(directory: String) { ...@@ -248,6 +226,32 @@ class MappingConfig(directory: String) {
} }
} }
private fun buildSkosConceptMappers(key: String, value: Any?): List<IFieldMapper> {
return when (value) {
is Map<*, *> -> {
listOf(extractEntityFields<SkosConceptFieldMapper>(
key,
value as Map<String, Any>,
SKOS.acceptedPropertiesList
))
}
is List<*> -> {
value.map {
try {
extractEntityFields<SkosConceptFieldMapper>(
key,
it as Map<String, Any>,
SKOS.acceptedPropertiesList
)
} catch (ex: ClassCastException) {
throw InvalidMappingException("Expected a map inside of the list entry in the ${key} section.")
}
}
}
else -> throw InvalidMappingException("Expected a mapping or a list inside of the ${key} section!")
}
}
private fun extractAgentTypeMapper(key: String, value: Map<String, Any>): IFieldMapper { private fun extractAgentTypeMapper(key: String, value: Map<String, Any>): IFieldMapper {
val mapper = when { val mapper = when {
value.containsKey(KEYS.agent) -> { value.containsKey(KEYS.agent) -> {
......
...@@ -209,6 +209,20 @@ class Tests { ...@@ -209,6 +209,20 @@ class Tests {
"Successfully created a physical instantiation from source." "Successfully created a physical instantiation from source."
) )
) )
),
KafkaTestParams(
5,
"ID_1",
listOf(
"https://memobase.ch/record/TEST-ID_1"
),
listOf(
Report(
"https://memobase.ch/record/TEST-ID_1",
"SUCCESS",
"Successfully created a record from source."
)
)
) )
) )
......
id: jobXYZ
app:
institutionId: "TEST"
recordSetId: "TEST_RECORD_SET"
configs: src/test/resources/kafkaTests/5/config
kafka:
streams:
bootstrap.servers: localhost:12345
application.id: test-clinet-1234
topic:
in: test-topic-in
out: test-topic-out
process: test-topic-process
\ No newline at end of file
<https://memobase.ch/record/TEST-Sig_Han_1293> <http://purl.org/dc/terms/spatial> _:B . <https://memobase.ch/record/TEST-Sig_Han_1293> <http://purl.org/dc/terms/spatial> _:B .
<https://memobase.ch/record/TEST-Sig_Han_1293> <http://rdaregistry.info/Elements/u/P60441> _:B . <https://memobase.ch/record/TEST-Sig_Han_1293> <http://rdaregistry.info/Elements/u/P60441> _:B .
<https://memobase.ch/record/TEST-Sig_Han_1293> <http://schema.org/sameAs> "http://example.org/stuff" . <https://memobase.ch/record/TEST-Sig_Han_1293> <http://schema.org/sameAs> "http://example.org/stuff" .
<https://memobase.ch/record/TEST-Sig_Han_1293> <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasGenre> _:B .
<https://memobase.ch/record/TEST-Sig_Han_1293> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Record> . <https://memobase.ch/record/TEST-Sig_Han_1293> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Record> .
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#descriptiveNote> "Eine Bespielbeschreibung"@de . <https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#descriptiveNote> "Eine Bespielbeschreibung"@de .
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#hasInstantiation> <https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1> . <https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#hasInstantiation> <https://memobase.ch/instantiation/digital/TEST-Sig_Han_1293-1> .
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#hasInstantiation> <https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0> . <https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#hasInstantiation> <https://memobase.ch/instantiation/physical/TEST-Sig_Han_1293-0> .
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#hasSubject> _:B . <https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#hasSubject> _:B .
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#hasSubject> _:B .
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#heldBy> <https://memobase.ch/institution/TEST> . <https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#heldBy> <https://memobase.ch/institution/TEST> .
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B . <https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#isPartOf> <https://memobase.ch/recordSet/TEST_RECORD_SET> . <https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#isPartOf> <https://memobase.ch/recordSet/TEST_RECORD_SET> .
...@@ -15,6 +17,8 @@ ...@@ -15,6 +17,8 @@
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#scopeAndContent> "Kontext text"@de . <https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#scopeAndContent> "Kontext text"@de .
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#title> "Das ist ein Titel"@de . <https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#title> "Das ist ein Titel"@de .
<https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#type> "Tonbildschau" . <https://memobase.ch/record/TEST-Sig_Han_1293> <https://www.ica.org/standards/RiC/ontology#type> "Tonbildschau" .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Agent> . _:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Agent> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#CorporateBody> . _:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#CorporateBody> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#CreationRelation> . _:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#CreationRelation> .
...@@ -25,6 +29,10 @@ _:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/stand ...@@ -25,6 +29,10 @@ _:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/stand
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Person> . _:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Person> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Person> . _:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Person> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Place> . _:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Place> .
_:B <http://www.w3.org/2004/02/skos/core#editorialNote> "Ursprungsfeld: Genre" .
_:B <http://www.w3.org/2004/02/skos/core#editorialNote> "Ursprungsfeld: Sachthemen" .
_:B <http://www.w3.org/2004/02/skos/core#prefLabel> "name"@de .
_:B <http://www.w3.org/2004/02/skos/core#prefLabel> "name"@de .
_:B <https://www.ica.org/standards/RiC/ontology#creationRelationHasSource> <https://memobase.ch/record/TEST-Sig_Han_1293> . _:B <https://www.ica.org/standards/RiC/ontology#creationRelationHasSource> <https://memobase.ch/record/TEST-Sig_Han_1293> .
_:B <https://www.ica.org/standards/RiC/ontology#creationRelationHasSource> <https://memobase.ch/record/TEST-Sig_Han_1293> . _:B <https://www.ica.org/standards/RiC/ontology#creationRelationHasSource> <https://memobase.ch/record/TEST-Sig_Han_1293> .
_:B <https://www.ica.org/standards/RiC/ontology#creationRelationHasSource> <https://memobase.ch/record/TEST-Sig_Han_1293> . _:B <https://www.ica.org/standards/RiC/ontology#creationRelationHasSource> <https://memobase.ch/record/TEST-Sig_Han_1293> .
......
record:
uri: id
type:
const: Foto
subject: # blank node skos:Concept with rico:hasSubject
prefLabel:
fr: Schlagworte
editorialNote:
const: "Ursprungsfeld: Mots clés"
genre:
- prefLabel:
fr: Genre
editorialNote:
const: "Ursprungsfeld: Genre"
{
"id": "ID_1",
"Schlagworte": "Schlagwort 1, Schlagwort 2",
"Genre": "Genre 1, Genre 2"
}
\ No newline at end of file
<https://memobase.ch/record/TEST-ID_1> <http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#hasGenre> _:B .
<https://memobase.ch/record/TEST-ID_1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Record> .
<https://memobase.ch/record/TEST-ID_1> <https://www.ica.org/standards/RiC/ontology#hasSubject> _:B .
<https://memobase.ch/record/TEST-ID_1> <https://www.ica.org/standards/RiC/ontology#heldBy> <https://memobase.ch/institution/TEST> .
<https://memobase.ch/record/TEST-ID_1> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/record/TEST-ID_1> <https://www.ica.org/standards/RiC/ontology#isPartOf> <https://memobase.ch/recordSet/TEST_RECORD_SET> .
<https://memobase.ch/record/TEST-ID_1> <https://www.ica.org/standards/RiC/ontology#type> "Foto" .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
_: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/2004/02/skos/core#editorialNote> "Ursprungsfeld: Genre" .
_:B <http://www.w3.org/2004/02/skos/core#editorialNote> "Ursprungsfeld: Mots clés" .
_:B <http://www.w3.org/2004/02/skos/core#prefLabel> "Genre 1, Genre 2"@fr .
_:B <http://www.w3.org/2004/02/skos/core#prefLabel> "Schlagwort 1, Schlagwort 2"@fr .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "https://memobase.ch/record/TEST-ID_1" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
\ 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