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

Update record set to accept null for descriptions.

parent 2cc54f73
Pipeline #20369 failed with stages
in 3 minutes and 48 seconds
......@@ -35,6 +35,7 @@ import org.apache.logging.log4j.LogManager
import org.memobase.model.Address
import org.memobase.model.Institution
import org.memobase.model.RecordSet
import org.memobase.model.RichText
class RdfTransformer(properties: Properties) {
private val log = LogManager.getLogger("RdfTransformer")
......@@ -62,18 +63,9 @@ class RdfTransformer(properties: Properties) {
resource.addProperty(RICO.name, langLiteral(input.title, "de"))
resource.addProperty(RICO.name, langLiteral(input.title_fr, "fr"))
resource.addProperty(RICO.name, langLiteral(input.title_it, "it"))
input.field_text.let {
if (it != null)
resource.addProperty(RICO.descriptiveNote, langLiteral(it.value, "de"))
}
input.field_text_fr.let {
if (it != null)
resource.addProperty(RICO.descriptiveNote, langLiteral(it.value, "fr"))
}
input.field_text_it.let {
if (it != null)
resource.addProperty(RICO.descriptiveNote, langLiteral(it.value, "it"))
}
addIfNotNull(resource, input.field_text, "de")
addIfNotNull(resource, input.field_text_fr, "fr")
addIfNotNull(resource, input.field_text_it, "it")
input.field_address.forEach { address ->
val location = generateLocationResource(model, address)
......@@ -122,9 +114,10 @@ class RdfTransformer(properties: Properties) {
resource.addProperty(RICO.title, langLiteral(input.title, "de"))
resource.addProperty(RICO.title, langLiteral(input.title_fr, "fr"))
resource.addProperty(RICO.title, langLiteral(input.title_it, "it"))
resource.addProperty(RICO.descriptiveNote, langLiteral(input.field_text.value, "de"))
resource.addProperty(RICO.descriptiveNote, langLiteral(input.field_text_fr.value, "fr"))
resource.addProperty(RICO.descriptiveNote, langLiteral(input.field_text_it.value, "it"))
addIfNotNull(resource, input.field_text, "de")
addIfNotNull(resource, input.field_text_fr, "fr")
addIfNotNull(resource, input.field_text_it, "it")
input.field_metadata_language_codes.forEach {
// rico:hasLanguage metadata
......@@ -271,4 +264,11 @@ class RdfTransformer(properties: Properties) {
ResourceFactory.createLangLiteral(text.trim(), language)
private fun literal(text: String): Literal = ResourceFactory.createPlainLiteral(text.trim())
private fun addIfNotNull(resource: Resource, field: RichText?, language: String) {
field.let {
if (it != null)
resource.addProperty(RICO.descriptiveNote, langLiteral(it.value, language))
}
}
}
\ No newline at end of file
......@@ -24,9 +24,9 @@ data class RecordSet(
val status: Boolean,
val field_text: RichText,
val field_text_fr: RichText,
val field_text_it: RichText,
val field_text: RichText?,
val field_text_fr: RichText?,
val field_text_it: RichText?,
val field_memobase_id: String,
val field_old_memobase_id: String? = null,
......
......@@ -71,7 +71,7 @@ class TestRecordSets {
assertAll("",
{
assertThat(result.first)
.isEqualTo("https://memobase.ch/recordSet/SNM-Arbeit")
.isEqualTo("https://memobase.ch/recordSet/hgk-001")
}
)
}
......@@ -114,7 +114,7 @@ class TestRecordSets {
},
{
assertThat(key)
.isEqualTo("https://memobase.ch/recordSet/SNM-Arbeit")
.isEqualTo("https://memobase.ch/recordSet/hgk-001")
}
)
}
......
......@@ -48,14 +48,14 @@ mbcb:zbz a rico:CorporateBody ;
wdt:P669 "Zähringerplatz" ;
wdt:P670 "6"
] ;
rico:identifiedBy [ a rico:Identifier ;
rico:identifier "zbz" ;
rico:type "main"
] ;
rico:identifiedBy [ a rico:Identifier ;
rico:identifier "ZB" ;
rico:type "oldMemobase"
] ;
rico:identifiedBy [ a rico:Identifier ;
rico:identifier "zbz" ;
rico:type "main"
] ;
rico:isHolderOf "https://memobase.ch/recordSet/001" ;
rico:name "Zentralbibliothek Zürich"@de , "Zentralbibliothek Zürich"@fr , "Zentralbibliothek Zürich"@it ;
rico:type "memobaseInstitution" .
{
"type": "node--record_set",
"status": true,
"title": "SNM-Arbeit",
"title_fr": "SNM-Arbeit",
"title_it": "SNM-Arbeit",
"field_supported_by_memoriav": true,
"field_memobase_id": "SNM-Arbeit",
"field_text": {
"value": "Beschreibung test field value",
"format": "plain_text",
"processed": "<p>Beschreibung test field value</p>\n"
},
"field_text_fr": {
"value": "Beschreibung test field value",
"format": "plain_text",
"processed": "<p>Beschreibung test field value</p>\n"
},
"field_text_it": {
"value": "Beschreibung test field value",
"format": "plain_text",
"processed": "<p>Beschreibung test field value</p>\n"
},
"title": "Videosammlung Videowochen im Wenkenpark",
"title_fr": "Videosammlung Videowochen im Wenkenpark",
"title_it": "Videosammlung Videowochen im Wenkenpark",
"field_supported_by_memoriav": false,
"field_memobase_id": "hgk-001",
"field_text": null,
"field_text_fr": null,
"field_text_it": null,
"field_institution": [
"59dacc8e-0345-4914-87c1-195697a429b8"
"hgk"
],
"field_metadata_language_codes": [
"de",
"de"
],
"computed_teaser_image_url": "https://mb-wf1.memobase.unibas.ch/sites/default/files/styles/teaser/public/2020-11/04223.jpg?itok=EfV8jyJQ"
"field_metadata_language_codes": [],
"computed_teaser_image_url": null,
"field_old_memobase_id": "FHNW_HGK-VWW"
}
\ No newline at end of file
......@@ -22,28 +22,20 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
mbrs:SNM-Arbeit a rico:RecordSet ;
mbrs:hgk-001 a rico:RecordSet ;
rdau:P60451 mbcb:mrv ;
wdt:P18 "https://mb-wf1.memobase.unibas.ch/sites/default/files/styles/teaser/public/2020-11/04223.jpg?itok=EfV8jyJQ" ;
internal:isPublished true ;
rico:descriptiveNote "Beschreibung test field value"@it , "Beschreibung test field value"@de , "Beschreibung test field value"@fr ;
rico:hasLanguage [ a rico:Language ;
schema:sameAs "http://www.wikidata.org/entity/Q188" ;
rico:name "Deutsch"@de , "Allemand"@fr , "Tedesco"@it ;
rico:type "metadata"
] ;
rico:hasLanguage [ a rico:Language ;
schema:sameAs "http://www.wikidata.org/entity/Q188" ;
rico:name "Deutsch"@de , "Allemand"@fr , "Tedesco"@it ;
rico:type "metadata"
] ;
rico:hasTitle [ a rico:Title ;
rico:title "SNM-Arbeit"@de , "SNM-Arbeit"@fr , "SNM-Arbeit"@it ;
rico:title "Videosammlung Videowochen im Wenkenpark"@de , "Videosammlung Videowochen im Wenkenpark"@fr , "Videosammlung Videowochen im Wenkenpark"@it ;
rico:type "main"
] ;
rico:heldBy "https://memobase.ch/institution/59dacc8e-0345-4914-87c1-195697a429b8" ;
rico:heldBy "https://memobase.ch/institution/hgk" ;
rico:identifiedBy [ a rico:Identifier ;
rico:identifier "SNM-Arbeit" ;
rico:identifier "hgk-001" ;
rico:type "main"
] ;
rico:title "SNM-Arbeit"@de , "SNM-Arbeit"@fr , "SNM-Arbeit"@it .
rico:identifiedBy [ a rico:Identifier ;
rico:identifier "FHNW_HGK-VWW" ;
rico:type "oldMemobase"
] ;
rico:title "Videosammlung Videowochen im Wenkenpark"@fr , "Videosammlung Videowochen im Wenkenpark"@it , "Videosammlung Videowochen im Wenkenpark"@de .
<https://memobase.ch/recordSet/SNM-Arbeit> <http://rdaregistry.info/Elements/u/P60451> <https://memobase.ch/institution/mrv> .
<https://memobase.ch/recordSet/SNM-Arbeit> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#RecordSet> .
<https://memobase.ch/recordSet/SNM-Arbeit> <http://www.wikidata.org/prop/direct/P18> "https://mb-wf1.memobase.unibas.ch/sites/default/files/styles/teaser/public/2020-11/04223.jpg?itok=EfV8jyJQ" .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://memobase.ch/internal/isPublished> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#descriptiveNote> "Beschreibung test field value"@de .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#descriptiveNote> "Beschreibung test field value"@fr .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#descriptiveNote> "Beschreibung test field value"@it .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#hasLanguage> _:B .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#hasLanguage> _:B .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#hasTitle> _:B .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#heldBy> "https://memobase.ch/institution/59dacc8e-0345-4914-87c1-195697a429b8" .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#title> "SNM-Arbeit"@de .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#title> "SNM-Arbeit"@fr .
<https://memobase.ch/recordSet/SNM-Arbeit> <https://www.ica.org/standards/RiC/ontology#title> "SNM-Arbeit"@it .
_:B <http://schema.org/sameAs> "http://www.wikidata.org/entity/Q188" .
_:B <http://schema.org/sameAs> "http://www.wikidata.org/entity/Q188" .
<https://memobase.ch/recordSet/hgk-001> <http://rdaregistry.info/Elements/u/P60451> <https://memobase.ch/institution/mrv> .
<https://memobase.ch/recordSet/hgk-001> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#RecordSet> .
<https://memobase.ch/recordSet/hgk-001> <https://memobase.ch/internal/isPublished> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<https://memobase.ch/recordSet/hgk-001> <https://www.ica.org/standards/RiC/ontology#hasTitle> _:B .
<https://memobase.ch/recordSet/hgk-001> <https://www.ica.org/standards/RiC/ontology#heldBy> "https://memobase.ch/institution/hgk" .
<https://memobase.ch/recordSet/hgk-001> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/recordSet/hgk-001> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/recordSet/hgk-001> <https://www.ica.org/standards/RiC/ontology#title> "Videosammlung Videowochen im Wenkenpark"@de .
<https://memobase.ch/recordSet/hgk-001> <https://www.ica.org/standards/RiC/ontology#title> "Videosammlung Videowochen im Wenkenpark"@fr .
<https://memobase.ch/recordSet/hgk-001> <https://www.ica.org/standards/RiC/ontology#title> "Videosammlung Videowochen im Wenkenpark"@it .
_: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#Language> .
_:B <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Language> .
_: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> "SNM-Arbeit" .
_:B <https://www.ica.org/standards/RiC/ontology#name> "Allemand"@fr .
_:B <https://www.ica.org/standards/RiC/ontology#name> "Allemand"@fr .
_:B <https://www.ica.org/standards/RiC/ontology#name> "Deutsch"@de .
_:B <https://www.ica.org/standards/RiC/ontology#name> "Deutsch"@de .
_:B <https://www.ica.org/standards/RiC/ontology#name> "Tedesco"@it .
_:B <https://www.ica.org/standards/RiC/ontology#name> "Tedesco"@it .
_:B <https://www.ica.org/standards/RiC/ontology#title> "SNM-Arbeit"@de .
_:B <https://www.ica.org/standards/RiC/ontology#title> "SNM-Arbeit"@fr .
_:B <https://www.ica.org/standards/RiC/ontology#title> "SNM-Arbeit"@it .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "FHNW_HGK-VWW" .
_:B <https://www.ica.org/standards/RiC/ontology#identifier> "hgk-001" .
_:B <https://www.ica.org/standards/RiC/ontology#title> "Videosammlung Videowochen im Wenkenpark"@de .
_:B <https://www.ica.org/standards/RiC/ontology#title> "Videosammlung Videowochen im Wenkenpark"@fr .
_:B <https://www.ica.org/standards/RiC/ontology#title> "Videosammlung Videowochen im Wenkenpark"@it .
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "main" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "metadata" .
_:B <https://www.ica.org/standards/RiC/ontology#type> "metadata" .
\ No newline at end of file
_:B <https://www.ica.org/standards/RiC/ontology#type> "oldMemobase" .
\ No newline at end of file
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