Commit 7c5250f3 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Add record set ids

Add teaser image link
parent 5b63a56a
Pipeline #17039 passed with stages
in 4 minutes and 41 seconds
...@@ -35,7 +35,7 @@ dependencies { ...@@ -35,7 +35,7 @@ dependencies {
// https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-high-level-client // https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-high-level-client
//compile group: 'org.elasticsearch.client', name: 'elasticsearch-rest-high-level-client', version: '7.1.0' //compile group: 'org.elasticsearch.client', name: 'elasticsearch-rest-high-level-client', version: '7.1.0'
implementation 'org.memobase:memobase-service-utilities:0.17.0' implementation 'org.memobase:memobase-service-utilities:1.12.3'
// Logging Framework // Logging Framework
implementation "org.apache.logging.log4j:log4j-api:${log4jV}" implementation "org.apache.logging.log4j:log4j-api:${log4jV}"
......
...@@ -47,12 +47,15 @@ class KafkaTopology(private val settings: SettingsLoader) { ...@@ -47,12 +47,15 @@ class KafkaTopology(private val settings: SettingsLoader) {
private fun parseJson(data: String): List<Input> { private fun parseJson(data: String): List<Input> {
return try { return try {
val int = Klaxon().parse<Institution>(StringReader(data)) val int = Klaxon().parse<Input>(StringReader(data))
return if (int == null) emptyList() return if (int == null) emptyList()
else listOf(int) else listOf(int)
} catch (ex: KlaxonException) { } catch (ex: KlaxonException) {
log.error(ex.localizedMessage) log.error(ex.localizedMessage)
emptyList() emptyList()
} catch (ex: ClassCastException) {
log.error(ex.localizedMessage)
emptyList()
} }
} }
...@@ -62,7 +65,5 @@ class KafkaTopology(private val settings: SettingsLoader) { ...@@ -62,7 +65,5 @@ class KafkaTopology(private val settings: SettingsLoader) {
is RecordSet -> transformer.createRecordSet(input) is RecordSet -> transformer.createRecordSet(input)
else -> throw Exception("Unknown Type Input.") else -> throw Exception("Unknown Type Input.")
} }
} }
} }
...@@ -64,6 +64,10 @@ class Transform { ...@@ -64,6 +64,10 @@ class Transform {
oldIdentifier.addProperty(RICO.identifier, literal(input.field_old_memobase_id)) oldIdentifier.addProperty(RICO.identifier, literal(input.field_old_memobase_id))
resource.addProperty(RICO.identifiedBy, oldIdentifier) resource.addProperty(RICO.identifiedBy, oldIdentifier)
input.recordset_ids.forEach {
resource.addProperty(RICO.isHolderOf, NS.mbrs + it)
}
resource.addProperty(RICO.name, langLiteral(input.title, "de")) resource.addProperty(RICO.name, langLiteral(input.title, "de"))
resource.addProperty(RICO.name, langLiteral(input.title_fr, "fr")) resource.addProperty(RICO.name, langLiteral(input.title_fr, "fr"))
resource.addProperty(RICO.name, langLiteral(input.title_it, "it")) resource.addProperty(RICO.name, langLiteral(input.title_it, "it"))
...@@ -71,7 +75,7 @@ class Transform { ...@@ -71,7 +75,7 @@ class Transform {
resource.addProperty(RICO.descriptiveNote, langLiteral(input.field_text_fr.value, "fr")) resource.addProperty(RICO.descriptiveNote, langLiteral(input.field_text_fr.value, "fr"))
resource.addProperty(RICO.descriptiveNote, langLiteral(input.field_text_it.value, "it")) resource.addProperty(RICO.descriptiveNote, langLiteral(input.field_text_it.value, "it"))
input.field_address.forEach {address -> input.field_address.forEach { address ->
val location = generateLocationResource(model, address) val location = generateLocationResource(model, address)
resource.addProperty(RICO.hasLocation, location) resource.addProperty(RICO.hasLocation, location)
} }
...@@ -95,6 +99,7 @@ class Transform { ...@@ -95,6 +99,7 @@ class Transform {
input.field_institution_types.forEach { input.field_institution_types.forEach {
resource.addProperty(WD.typeOfInstitution, model.createResource(NS.wd + it.substringAfterLast("/"))) resource.addProperty(WD.typeOfInstitution, model.createResource(NS.wd + it.substringAfterLast("/")))
} }
resource.addLiteral(WD.image, input.computed_teaser_image_url)
return Pair(resource.uri, model) return Pair(resource.uri, model)
} }
...@@ -170,7 +175,8 @@ class Transform { ...@@ -170,7 +175,8 @@ class Transform {
} }
private fun langLiteral(text: String, language: String): Literal =
ResourceFactory.createLangLiteral(text.trim(), language)
private fun langLiteral(text: String, language: String): Literal = ResourceFactory.createLangLiteral(text.trim(), language)
private fun literal(text: String): Literal = ResourceFactory.createPlainLiteral(text.trim()) private fun literal(text: String): Literal = ResourceFactory.createPlainLiteral(text.trim())
} }
\ No newline at end of file
...@@ -24,6 +24,8 @@ data class Institution( ...@@ -24,6 +24,8 @@ data class Institution(
val title_fr: String, val title_fr: String,
val title_it: String, val title_it: String,
val recordset_ids: List<String>,
val field_address: List<Address>, val field_address: List<Address>,
val field_isil: String?, val field_isil: String?,
...@@ -39,5 +41,6 @@ data class Institution( ...@@ -39,5 +41,6 @@ data class Institution(
val field_text_it: RichText, val field_text_it: RichText,
val field_institution_types: List<String>, val field_institution_types: List<String>,
val field_wikidata_id: String val field_wikidata_id: String,
val computed_teaser_image_url: String
) : Input("Institution") ) : Input("Institution")
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"title_it": "Test institution Oana (IT)", "title_it": "Test institution Oana (IT)",
"field_address": [ "field_address": [
{ {
"langcode": "de", "langcode": "",
"country_code": "CH", "country_code": "CH",
"administrative_area": "BS", "administrative_area": "BS",
"locality": "Münchenstein", "locality": "Münchenstein",
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"coordinates": "47.5602571, 7.5804113" "coordinates": "47.5602571, 7.5804113"
}, },
{ {
"langcode": "de", "langcode": "",
"country_code": "CH", "country_code": "CH",
"administrative_area": "BE", "administrative_area": "BE",
"locality": "Bern", "locality": "Bern",
...@@ -71,5 +71,9 @@ ...@@ -71,5 +71,9 @@
"field_institution_types": [ "field_institution_types": [
"http://www.wikidata.org/wiki/Q166118", "http://www.wikidata.org/wiki/Q166118",
"http://www.wikidata.org/wiki/Q327333" "http://www.wikidata.org/wiki/Q327333"
] ],
} "recordset_ids": [
"RadioX-Kampagnen"
],
"computed_teaser_image_url": "https://mb-wf1.memobase.unibas.ch/sites/default/files/styles/teaser/public/2020-10/1.jpg?itok=5ncVBnVQ"
}
\ No newline at end of file
<https://memobase.ch/institution/RadioX> <http://memobase.ch/internal/isPublished> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> . <https://memobase.ch/institution/RadioX> <http://memobase.ch/internal/isPublished> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<https://memobase.ch/institution/RadioX> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#CorporateBody> . <https://memobase.ch/institution/RadioX> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#CorporateBody> .
<https://memobase.ch/institution/RadioX> <http://www.wikidata.org/prop/direct/P18> "https://mb-wf1.memobase.unibas.ch/sites/default/files/styles/teaser/public/2020-10/1.jpg?itok=5ncVBnVQ" .
<https://memobase.ch/institution/RadioX> <http://www.wikidata.org/prop/direct/P2699> "http://online-archiv-radiox.com" . <https://memobase.ch/institution/RadioX> <http://www.wikidata.org/prop/direct/P2699> "http://online-archiv-radiox.com" .
<https://memobase.ch/institution/RadioX> <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q166118> . <https://memobase.ch/institution/RadioX> <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q166118> .
<https://memobase.ch/institution/RadioX> <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q327333> . <https://memobase.ch/institution/RadioX> <http://www.wikidata.org/prop/direct/P31> <http://www.wikidata.org/entity/Q327333> .
...@@ -12,6 +13,7 @@ ...@@ -12,6 +13,7 @@
<https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#hasLocation> _:B . <https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#hasLocation> _:B .
<https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B . <https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B . <https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B .
<https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#isHolderOf> "https://memobase.ch/recordSet/RadioX-Kampagnen" .
<https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#name> "RadioX"@de . <https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#name> "RadioX"@de .
<https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#name> "Test institution Oana (FR)"@fr . <https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#name> "Test institution Oana (FR)"@fr .
<https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#name> "Test institution Oana (IT)"@it . <https://memobase.ch/institution/RadioX> <https://www.ica.org/standards/RiC/ontology#name> "Test institution Oana (IT)"@it .
......
...@@ -24,11 +24,29 @@ ...@@ -24,11 +24,29 @@
mbcb:RadioX a rico:CorporateBody ; mbcb:RadioX a rico:CorporateBody ;
internal:isPublished true ; internal:isPublished true ;
wdt:P18 "https://mb-wf1.memobase.unibas.ch/sites/default/files/styles/teaser/public/2020-10/1.jpg?itok=5ncVBnVQ" ;
wdt:P2699 "http://online-archiv-radiox.com" ; wdt:P2699 "http://online-archiv-radiox.com" ;
wdt:P31 wd:Q327333 , wd:Q166118 ; wdt:P31 wd:Q327333 , wd:Q166118 ;
wdt:P856 "https://radiox.ch/" ; wdt:P856 "https://radiox.ch/" ;
wdt:P968 "radiox@test.com" ; wdt:P968 "radiox@test.com" ;
rico:descriptiveNote "<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.</p>"@de , "<p>test_description&nbsp;&nbsp;(IT)</p>"@it , "<p>test_description&nbsp;(FR)</p>"@fr ; rico:descriptiveNote "<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.</p>"@de , "<p>test_description&nbsp;&nbsp;(IT)</p>"@it , "<p>test_description&nbsp;(FR)</p>"@fr ;
rico:hasLocation [ a rico:Place ;
wdt:P131 [ a rico:Place ;
schema:sameAs "http://www.wikidata.org/entity/Q11911" ;
rico:name "Bern"@de , "Berne"@fr , "Berna"@it ;
rico:type "canton"
] ;
wdt:P131 [ a rico:Place ;
rico:name "Bern" ;
rico:type "municipality"
] ;
wdt:P17 wd:Q39 ;
wdt:P281 "3005" ;
wdt:P625 "46.9531243, 7.434256" ;
wdt:P6375 "Helvetiapl. 5" ;
wdt:P669 "Helvetiapl." ;
wdt:P670 "5"
] ;
rico:hasLocation [ a rico:Place ; rico:hasLocation [ a rico:Place ;
wdt:P131 [ a rico:Place ; wdt:P131 [ a rico:Place ;
schema:sameAs "http://www.wikidata.org/entity/Q12172" ; schema:sameAs "http://www.wikidata.org/entity/Q12172" ;
...@@ -47,30 +65,14 @@ mbcb:RadioX a rico:CorporateBody ; ...@@ -47,30 +65,14 @@ mbcb:RadioX a rico:CorporateBody ;
wdt:P669 "Oslo-Strasse" ; wdt:P669 "Oslo-Strasse" ;
wdt:P670 "8" wdt:P670 "8"
] ; ] ;
rico:hasLocation [ a rico:Place ; rico:identifiedBy [ a rico:Identifier ;
wdt:P131 [ a rico:Place ; rico:identifier "test_radio_x" ;
schema:sameAs "http://www.wikidata.org/entity/Q11911" ; rico:type "oldMemobase"
rico:name "Bern"@de , "Berne"@fr , "Berna"@it ;
rico:type "canton"
] ;
wdt:P131 [ a rico:Place ;
rico:name "Bern" ;
rico:type "municipality"
] ;
wdt:P17 wd:Q39 ;
wdt:P281 "3005" ;
wdt:P625 "46.9531243, 7.434256" ;
wdt:P6375 "Helvetiapl. 5" ;
wdt:P669 "Helvetiapl." ;
wdt:P670 "5"
] ; ] ;
rico:identifiedBy [ a rico:Identifier ; rico:identifiedBy [ a rico:Identifier ;
rico:identifier "RadioX" ; rico:identifier "RadioX" ;
rico:type "main" rico:type "main"
] ; ] ;
rico:identifiedBy [ a rico:Identifier ; rico:isHolderOf "https://memobase.ch/recordSet/RadioX-Kampagnen" ;
rico:identifier "test_radio_x" ;
rico:type "oldMemobase"
] ;
rico:name "RadioX"@de , "Test institution Oana (FR)"@fr , "Test institution Oana (IT)"@it ; rico:name "RadioX"@de , "Test institution Oana (FR)"@fr , "Test institution Oana (IT)"@it ;
rico:type "memobaseInstitution" . rico:type "memobaseInstitution" .
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