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

Fix hasSubject not mapping correctly

Added ability to add source field alternatives to entity transforms
with conditional target.
parent e7c6049f
Pipeline #10799 passed with stages
in 12 minutes and 27 seconds
...@@ -5,4 +5,4 @@ tag: "latest" ...@@ -5,4 +5,4 @@ tag: "latest"
deploymentName: search-doc-service deploymentName: search-doc-service
configMapName: search-doc-mapping-config configMapName: search-doc-mapping-config
kafkaConfigs: prod-kafka-bootstrap-servers kafkaConfigs: prod-kafka-bootstrap-servers
\ No newline at end of file
...@@ -77,9 +77,18 @@ class SearchDocTransform(mapping: String) { ...@@ -77,9 +77,18 @@ class SearchDocTransform(mapping: String) {
transform.conditionalTargets.isNotEmpty() -> { transform.conditionalTargets.isNotEmpty() -> {
transform.conditionalTargets.map { transform.conditionalTargets.map {
if (entity.containsKey(it.conditionProperty) && entity[it.conditionProperty] == it.conditionPattern) { if (entity.containsKey(it.conditionProperty) && entity[it.conditionProperty] == it.conditionPattern) {
val pair = extractPair(entity[transform.source], it.target) if (transform.source.contains('|')) {
if (pair != null) listOf(pair) val sourceFields = transform.source.split('|')
else emptyList() sourceFields.mapNotNull { sourceField ->
extractPair(entity[sourceField], it.target)
}
} else {
val subPair = extractPair(entity[transform.source], it.target)
if (subPair == null)
emptyList()
else
listOf(subPair)
}
} else { } else {
emptyList() emptyList()
} }
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
"rico:heldBy": { "rico:heldBy": {
"@id": "https://memobase.ch/institution/BAZ" "@id": "https://memobase.ch/institution/BAZ"
}, },
"rico:hasSubject": {
"@id": "_:Bb9117dd4X2D7bccX2D4500X2Daab3X2D37ed2d136c26"
},
"rico:identifiedBy": [ "rico:identifiedBy": [
{ {
"@id": "_:Nb9da0f23b09a47e3b9ad346ff8c1d586" "@id": "_:Nb9da0f23b09a47e3b9ad346ff8c1d586"
...@@ -63,6 +66,11 @@ ...@@ -63,6 +66,11 @@
}, },
"rico:type": "Foto" "rico:type": "Foto"
}, },
{
"@id": "_:Bb9117dd4X2D7bccX2D4500X2Daab3X2D37ed2d136c26",
"@type": "rico:Agent",
"rico:name": "Chubb"
},
{ {
"@id": "_:Nfe03ee672afa4223921c79464904b674", "@id": "_:Nfe03ee672afa4223921c79464904b674",
"@type": "rico:Rule", "@type": "rico:Rule",
......
{"id":"https://memobase.ch/record/BAZ-MEI_49884","dateCreated.date":"1921-09-14","dateCreated.facet":["0~20.Jahrhundert~","1~20.Jahrhundert~1921-1930#"],"relation":"Bezug Findmittel: Auftragsregister Bd. 6; Bildverzeichnis Bd. 7","placeCaptureRaw":{"de":"Zürich"},"descriptiveNote":{"de":"Villa mit Garten und Brunnen im Vordergrund. Vermutlich von Architekt Walz"},"title":{"de":"«Villa Siegel», Zürich"},"AgentContributorRaw.relation":"Auftraggeber","AgentContributorRaw.name":{"de":"Walz"},"CorporateBodyCreatorRaw.relation":"Fotograf","CorporateBodyCreatorRaw.name":{"de":"Atelier Meiner"},"rightsHolder":"BAZ","type.keyword":"Foto"} {"id":"https://memobase.ch/record/BAZ-MEI_49884","dateCreated.date":"1921-09-14","dateCreated.facet":["0~20.Jahrhundert~","1~20.Jahrhundert~1921-1930#"],"relation":"Bezug Findmittel: Auftragsregister Bd. 6; Bildverzeichnis Bd. 7","placeCaptureRaw":{"de":"Zürich"},"descriptiveNote":{"de":"Villa mit Garten und Brunnen im Vordergrund. Vermutlich von Architekt Walz"},"title":{"de":"«Villa Siegel», Zürich"},"agentSubjectRaw":"Chubb","AgentContributorRaw.relation":"Auftraggeber","AgentContributorRaw.name":{"de":"Walz"},"CorporateBodyCreatorRaw.relation":"Fotograf","CorporateBodyCreatorRaw.name":{"de":"Atelier Meiner"},"rightsHolder":"BAZ","type.keyword":"Foto"}
\ No newline at end of file \ No newline at end of file
...@@ -65,7 +65,7 @@ entities: ...@@ -65,7 +65,7 @@ entities:
source: "rico:name" source: "rico:name"
isCreationRelation: true isCreationRelation: true
- property: "rico:hasSubject" - property: "rico:hasSubject"
source: "skos:prefLabel" source: "skos:prefLabel|rico:name"
conditionalTargets: conditionalTargets:
- conditionPattern: "rico:Agent" - conditionPattern: "rico:Agent"
conditionProperty: "@type" conditionProperty: "@type"
...@@ -75,7 +75,7 @@ entities: ...@@ -75,7 +75,7 @@ entities:
target: "corporateBodySubjectRaw" target: "corporateBodySubjectRaw"
- conditionPattern: "rico:Person" - conditionPattern: "rico:Person"
conditionProperty: "@type" conditionProperty: "@type"
target: "agentSubjectRaw" target: "personSubjectRaw"
- conditionPattern: "skos:Concept" - conditionPattern: "skos:Concept"
conditionProperty: "@type" conditionProperty: "@type"
target: "keywords" target: "keywords"
......
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