Commit e9ac8068 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Add reuse statements as csv file.

parent fd5b42c2
......@@ -34,6 +34,8 @@ spec:
mountPath: "/configs/document_types/"
- name: access-term-labels
mountPath: "/configs/access_terms/"
- name: reuse-statement-labels
mountPath: "/configs/access_terms/"
volumes:
- name: instituion-type-labels
configMap:
......@@ -44,4 +46,7 @@ spec:
- name: access-term-labels
configMap:
name: "{{ .Values.accessTermLabels }}"
- name: reuse-statement-labels
configMap:
name: "{{ .Values.reuseStatementLabels }}"
restartPolicy: Always
......@@ -15,5 +15,6 @@ reportingTopic: postprocessing-reporting
instutionTypeLabels: institution-type-labels
documentTypeLabels: document-type-labels
accessTermLabels: access-term-labels
reuseStatementLabels: reuse-statement-labels
mediaServerUrl: https://media.memobase.k8s.unibas.ch/memo/
\ No newline at end of file
......@@ -36,11 +36,9 @@ import org.memobase.helpers.Filter
import org.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractInstitution
import org.memobase.helpers.InstitutionAndRecordSetExtractionHelper.extractRecordSet
import org.memobase.helpers.KEYS
import org.memobase.helpers.ReuseStatementMap
import org.memobase.helpers.TranslationMappers
import org.memobase.model.DocumentsSearchDoc
import org.memobase.model.EnrichedDigitalMetadata
import org.memobase.model.FacetContainer
import org.memobase.model.LanguageContainer
import org.memobase.model.Schema
......@@ -278,7 +276,7 @@ class DocumentsSearchDocBuilder(
digitalObject?.get("conditionsOfUse")
),
usageDigital = usageDigital,
usageDigitalGroup = usageDigital.map { ReuseStatementMap.getValue(it) },
usageDigitalGroup = usageDigital.map { translationMappers.getReuseStatement(it) },
digital = digitalObjectValues,
......
......@@ -47,7 +47,9 @@ class Service(settings: SettingsLoader) {
private val documentMapperPath = appSettings.getProperty(SettingsProps.documentTypeLabelsPath)
private val accessTermPath = appSettings.getProperty(SettingsProps.accessTermLabelsPath)
private val institutionMapperPath = appSettings.getProperty(SettingsProps.institutionTypeLabelsPath)
private val translationMappers = TranslationMappers(institutionMapperPath, documentMapperPath, accessTermPath)
private val reuseStatementPath = appSettings.getProperty(SettingsProps.reuseStatementLabelsPath)
private val translationMappers =
TranslationMappers(institutionMapperPath, documentMapperPath, accessTermPath, reuseStatementPath)
private val host = appSettings.getProperty(SettingsProps.elasticHost)
private val port = appSettings.getProperty(SettingsProps.elasticPort).toInt()
......
......@@ -21,6 +21,7 @@ package org.memobase.helpers
object KEYS {
object SettingsProps {
const val accessTermLabelsPath = "accessTermLabelsPath"
const val reuseStatementLabelsPath = "reuseStatementLabelsPath"
const val documentTypeLabelsPath = "documentTypeLabelsPath"
const val mediaUrl = "media.url"
const val institutionTypeLabelsPath = "institutionTypeLabelsPath"
......
/*
* search-doc-service
* Copyright (C) 2020 Memoriav
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.memobase.helpers
import org.memobase.model.FacetContainer
import org.memobase.model.LanguageContainer
object ReuseStatementMap {
private const val noConditions = "Weiternutzbar ohne Bedingungen"
private const val ccConditions = "Weiternutzbar unter Bedingungen (CC)"
private const val copyright = "Weiternutzbar unter Bedingungen (Copyright)"
private const val unknownRightsHolder = "Unklar (Rechteinhaber nicht bekannt)"
private const val unknownCopyright = "Unklar (Copyright nicht bekannt)"
private const val pdm = "http://creativecommons.org/publicdomain/mark/1.0/"
private const val noc_nc = "http://rightsstatements.org/vocab/NoC-NC/1.0/"
private const val noc_oklr = "http://rightsstatements.org/vocab/NoC-OKLR/1.0/"
private const val cc0 = "http://creativecommons.org/publicdomain/zero/1.0/"
private const val cc_by = "http://creativecommons.org/licenses/by/4.0/"
private const val cc_by_sa = "http://creativecommons.org/licenses/by-sa/4.0/"
private const val cc_by_nd = "http://creativecommons.org/licenses/by-nd/4.0/"
private const val cc_by_nc = "http://creativecommons.org/licenses/by-nc/4.0/"
private const val cc_by_nc_sa = "http://creativecommons.org/licenses/by-nc-sa/4.0/"
private const val cc_by_nc_nd = "http://creativecommons.org/licenses/by-nc-nd/4.0/"
private const val inc = "http://rightsstatements.org/vocab/InC/1.0/"
private const val inc_edu = "http://rightsstatements.org/vocab/InC-EDU/1.0/"
private const val inc_ruu = "https://rightsstatements.org/page/InC-RUU/1.0/"
private const val cne = "http://rightsstatements.org/vocab/CNE/1.0/"
fun getValue(uri: String): FacetContainer {
return when (uri) {
pdm, cc0 ->
FacetContainer(LanguageContainer(
listOf(noConditions),
listOf(noConditions),
listOf(noConditions),
emptyList()), null, emptyList())
noc_nc, noc_oklr, cc_by, cc_by_nc,
cc_by_nc_nd, cc_by_sa, cc_by_nc_sa, cc_by_nd ->
FacetContainer(LanguageContainer(
listOf(ccConditions),
listOf(ccConditions),
listOf(ccConditions),
emptyList()), null, emptyList())
inc_edu, inc ->
FacetContainer(LanguageContainer(
listOf(copyright),
listOf(copyright),
listOf(copyright),
emptyList()), null, emptyList())
inc_ruu ->
FacetContainer(LanguageContainer(
listOf(unknownRightsHolder),
listOf(unknownRightsHolder),
listOf(unknownRightsHolder),
emptyList()), null, emptyList())
cne ->
FacetContainer(LanguageContainer(
listOf(unknownCopyright),
listOf(unknownCopyright),
listOf(unknownCopyright),
emptyList()), null, emptyList())
else -> FacetContainer.DEFAULT
}
}
}
......@@ -19,19 +19,31 @@ package org.memobase.helpers
import org.memobase.model.FacetContainer
class TranslationMappers(institutionTypeLabelsPath: String, documentTypePath: String, accessTermPath: String) {
class TranslationMappers(
institutionTypeLabelsPath: String,
documentTypePath: String,
accessTermPath: String,
reuseStatementPath: String
) {
private val documentTypeLabels = LoadFile.readLabelFile(documentTypePath)
private val accessTermLabels = LoadFile.readLabelFile(accessTermPath)
private val institutionTypeLabels = LoadFile.readLabelFile(institutionTypeLabelsPath)
private val reuseStatementLabels = LoadFile.readLabelFile(reuseStatementPath)
fun getDocumentType(code: String): FacetContainer {
return documentTypeLabels[code] ?: FacetContainer.DEFAULT
}
fun getAccessTerm(code: String): FacetContainer {
return accessTermLabels[code] ?: FacetContainer.DEFAULT
}
fun getInstitutionType(uri: String): FacetContainer {
val q = uri.substringAfterLast("/")
return institutionTypeLabels[q] ?: FacetContainer.DEFAULT
}
fun getReuseStatement(uri: String): FacetContainer {
return reuseStatementLabels[uri] ?: FacetContainer.DEFAULT
}
}
\ No newline at end of file
......@@ -7,7 +7,8 @@ app:
url: ${MEDIA_SERVER_URL:?system}
institutionTypeLabelsPath: "/configs/institution_types/labels.csv"
documentTypeLabelsPath: "/configs/document_types/labels.csv"
accessTermsLabelsPath: "/configs/access_terms/labels.csv"
accessTermLabelsPath: "/configs/access_terms/labels.csv"
reuseStatementLabelsPath: "/configs/reuse_statements/labels.csv"
kafka:
streams:
bootstrap.servers: ${KAFKA_BOOTSTRAP_SERVERS:?system}
......
......@@ -9,10 +9,12 @@ object TestUtilities {
private const val institutionTypePath = "src/test/resources/configs/institution-type-labels.csv"
private const val accessTermPath = "src/test/resources/configs/access-term-labels.csv"
private const val documentTypePath = "src/test/resources/configs/document-type-labels.csv"
private const val reuseStatementPath = "src/test/resources/configs/reuse-statement-labels.csv"
const val mediaUrl = "https://media.memobase.k8s.unibas.ch/memo/"
val translationMappers = TranslationMappers(institutionTypePath, documentTypePath, accessTermPath)
val translationMappers =
TranslationMappers(institutionTypePath, documentTypePath, accessTermPath, reuseStatementPath)
val elasticSearchClient = mockk<RestHighLevelClient>()
val elasticSearchWrapperMocked = mockk<ElasticSearchWrapper>()
......
code,de,fr,it
"http://creativecommons.org/publicdomain/mark/1.0/",Weiternutzbar ohne Bedingungen,,
"http://rightsstatements.org/vocab/NoC-NC/1.0/",Weiternutzbar unter Bedingungen (CC),,
"http://rightsstatements.org/vocab/NoC-OKLR/1.0/",Weiternutzbar unter Bedingungen (CC),,
"http://creativecommons.org/publicdomain/zero/1.0/",Weiternutzbar ohne Bedingungen,,
"http://creativecommons.org/licenses/by/4.0/",Weiternutzbar unter Bedingungen (CC),,
"http://creativecommons.org/licenses/by-sa/4.0/",Weiternutzbar unter Bedingungen (CC),,
"http://creativecommons.org/licenses/by-nd/4.0/",Weiternutzbar unter Bedingungen (CC),,
"http://creativecommons.org/licenses/by-nc/4.0/",Weiternutzbar unter Bedingungen (CC),,
"http://creativecommons.org/licenses/by-nc-sa/4.0/",Weiternutzbar unter Bedingungen (CC),,
"http://creativecommons.org/licenses/by-nc-nd/4.0/",Weiternutzbar unter Bedingungen (CC),,
"http://rightsstatements.org/vocab/InC/1.0/",Weiternutzbar unter Bedingungen (Copyright),,
"http://rightsstatements.org/vocab/InC-EDU/1.0/",Weiternutzbar unter Bedingungen (Copyright),,
"https://rightsstatements.org/page/InC-RUU/1.0/",Unklar (Rechteinhaber nicht bekannt),,
"http://rightsstatements.org/vocab/CNE/1.0/",Unklar (Copyright nicht bekannt),,
\ No newline at end of file
This diff is collapsed.
{"title":[{"de":[],"fr":[],"it":[],"un":["Falter"]}],"seriesTitle":[{"de":[],"fr":[],"it":[],"un":["Tieraufnahmen"]}],"type":{"name":{"de":["Film"],"fr":["Film"],"it":["Film"],"un":[]},"filter":"Film"},"sourceID":"PA_111_Sch_Y13_005_Nr_647","abstract":[{"de":[],"fr":[],"it":[],"un":["Vorspann: Agfa. Falter. <br><br> Beschrieb Schönwetter: Falter."]}],"descriptiveNote":[{"de":[],"fr":[],"it":[],"un":["Um die Filme des Bestands in der Listenansicht in der nach Serien/ Zeitraum bis oder nach 1945/ Filmdauer geordneten Reihenfolge anzuzeigen, ist in \"sortieren nach:\" die Auswahl \"Main-ID aufsteigend\" zu treffen. <a href=\"http://memobase.ch/#find/facets[inst-facet]=[LAGL]&order=4\" target=\"_blank\">http://memobase.ch/#find/facets[inst-facet]=[LAGL]&order=4</a>"]}],"scopeAndContent":[{"de":[],"fr":[],"it":[],"un":["Die archivische Serie \"Tieraufnahmen\" des Filmbestands Schönwetter (Kanton Glarus) umfasst Filmsequenzen, deren Szenen/Inhalte hauptsächlich Aufnahmen von Tieren sind, und zwar auch von Nutztieren und auch anlässlich von Viehschauen. [Verzeichnisreihenfolge innerhalb Serie gemäss Zeitperiode bis oder nach 1945 und pro Zeitperiode gemäss Abfolge Filmdauer]."]}],"rightsHolder":[{"de":[],"fr":[],"it":[],"un":["Landesarchiv des Kantons Glarus"]}],"sameAs":["https://archivverzeichnis.gl.ch/home/#/content/110700fae7994b628665add754139f2c"],"format":[{"displayLabel":{"de":[],"fr":[],"it":[],"un":[]},"name":{"de":["16-mm-Film"],"fr":["Format 16 mm"],"it":["16 millimetri"],"un":[]}}],"genre":[{"displayLabel":{"de":[],"fr":[],"it":[],"un":[]},"name":{"de":["Aktualitäten"],"fr":["Actualités"],"it":["Attualità"],"un":[]}}],"keywords":{"de":[],"fr":[],"it":[],"un":[]},"personCreator":[{"name":{"de":[],"fr":[],"it":[],"un":["Schönwetter Hans Jakob (1906-1997)"]},"relation":{"de":[],"fr":[],"it":[],"un":["Author"]},"filter":"Schönwetter, Hans Jakob (1906-1997)","facet":["0~S~","1~S~Schönwetter, Hans Jakob (1906-1997)~"]}],"personsFacet":{"facet":["0~S~","1~S~Schönwetter, Hans Jakob (1906-1997)~"],"filter":["Schönwetter, Hans Jakob (1906-1997)"]},"corporateBodyProducer":[{"name":{"de":[],"fr":[],"it":[],"un":["H.P. Schönwetter"]}}],"placeFacet":{},"dateCreated":[{"date":"/ vermutlich vor 1945 1930/1945","qualifier":["ca."]}],"institution":[{"name":{"de":[],"fr":[],"it":[],"un":[]},"facet":["LAGL"]}],"recordSet":{"name":{"de":[],"fr":[],"it":[],"un":[]},"facet":["LAGL-PA_111_Sch_Y"]},"memoriavClaim":true,"locator":"https://media.memobase.k8s.unibas.ch/memo/LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647-1","accessDigital":[{"name":{"de":["Online"],"fr":["En ligne"],"it":["Online"],"un":[]},"filter":"public"}],"digital":{},"durationPhysical":["00:00:43"],"callNumber":["LAGL PA 111 Sch Y13/005 Nr. 647"],"accessPhysical":[{"name":{"de":["vor Ort"],"fr":["Sur place"],"it":["Nel local"],"un":[]},"filter":"onsite"}],"physicalCharacteristics":[{"de":[],"fr":[],"it":[],"un":["Bemerkung: Länge Originalfilm 5m und Länge als Digitalisat 00:00:43 - Digitalisat in SD (standard definition)"]}],"colourPhysical":[{"de":[],"fr":[],"it":[],"un":["S/W"]}],"access":[{"name":{"de":["Online"],"fr":["En ligne"],"it":["Online"],"un":[]},"filter":"public"},{"name":{"de":["vor Ort"],"fr":["Sur place"],"it":["Nel local"],"un":[]},"filter":"onsite"}],"published":false,"suggest":{"title":["Falter"],"seriesTitle":["Tieraufnahmen"]},"id":"LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647"}
\ No newline at end of file
{"title":[{"de":[],"fr":[],"it":[],"un":["Antonia Bozzini con marito e figli davanti a un fondale appeso; dietro da sinistra: Angiolina, Pio, Clemente, Luigi, Giovanni e Anna; davanti con i genitori: Veronica e Caterina"]}],"type":{"name":{"de":["Fotografie"],"fr":["Photographie"],"it":["Fotografia"],"un":[]},"filter":"Foto"},"sourceID":"DON3196","abstract":[{"de":[],"fr":[],"it":[],"un":["Famiglia con fondale, tela, drappo, addobbo - Famiglia davanti ad un edificio, ad un muro"]}],"rightsHolder":[{"de":[],"fr":[],"it":[],"un":["Fondazione Archivio Roberto Donetta; Corzoneso"]}],"format":[{"displayLabel":{"de":[],"fr":[],"it":[],"un":[]},"name":{"de":["Fotoplatte"],"fr":["plaque photographique"],"it":["lastra fotografica"],"un":[]}}],"keywords":{"de":[],"fr":[],"it":[],"un":["Sedia , Cassa , Fondale scuro , Muro , Donna , Uomo , Bambini , Ragazzi ,"]},"personSubject":[{"name":{"de":[],"fr":[],"it":[],"un":["BOZZINI, Anna"]},"filter":"BOZZINI, Anna","facet":["0~B~","1~B~BOZZINI, Anna~"]}],"personCreator":[{"name":{"de":[],"fr":[],"it":[],"un":["DONETTA, Roberto"]},"relation":{"de":[],"fr":[],"it":[],"un":["Fotografo"]},"filter":"DONETTA, Roberto","facet":["0~D~","1~D~DONETTA, Roberto~"]}],"personsFacet":{"facet":["0~B~","1~B~BOZZINI, Anna~","0~D~","1~D~DONETTA, Roberto~"],"filter":["BOZZINI, Anna","DONETTA, Roberto"]},"placeFacet":{},"dateCreated":[{"date":"1900/1932","sort":"1900/1932","facet":["0~20.Jahrhundert~","1~20.Jahrhundert~1891-1900~","1~20.Jahrhundert~1901-1910~","1~20.Jahrhundert~1911-1920~","1~20.Jahrhundert~1921-1930~","1~20.Jahrhundert~1931-1940~"]}],"institution":[{"name":{"de":[],"fr":[],"it":[],"un":[]},"facet":["fad"]}],"recordSet":{"name":{"de":[],"fr":[],"it":[],"un":[]},"facet":["fad-001"]},"memoriavClaim":true,"locator":"https://media.memobase.k8s.unibas.ch/memo/fad-001-DON3196-1","accessDigital":[{"name":{"de":["Online"],"fr":["En ligne"],"it":["Online"],"un":[]},"filter":"public"}],"usageDigital":["http://rightsstatements.org/vocab/CNE/1.0/"],"usageDigitalGroup":[{"name":{"de":["Unklar (Copyright nicht bekannt)"],"fr":[""],"it":[""],"un":[]},"filter":"http://rightsstatements.org/vocab/CNE/1.0/"}],"digital":{},"callNumber":["DON3196"],"accessPhysical":[{"name":{"de":["vor Ort"],"fr":["Sur place"],"it":["Nel local"],"un":[]},"filter":"onsite"}],"usagePhysical":["http://rightsstatements.org/vocab/CNE/1.0/"],"physicalCharacteristics":[{"de":[],"fr":[],"it":[],"un":["Höhe: 18 cm","Weite: 13 cm","Bemerkung: Stato di conservazione : Buono"]}],"colourPhysical":[{"de":[],"fr":[],"it":[],"un":["Bianco e nero"]}],"access":[{"name":{"de":["Online"],"fr":["En ligne"],"it":["Online"],"un":[]},"filter":"public"},{"name":{"de":["vor Ort"],"fr":["Sur place"],"it":["Nel local"],"un":[]},"filter":"onsite"}],"published":false,"suggest":{"title":["Antonia Bozzini con marito e figli davanti a un fondale appeso; dietro da sinistra: Angiolina, Pio, Clemente, Luigi, Giovanni e Anna; davanti con i genitori: Veronica e Caterina"],"keywords":["Sedia , Cassa , Fondale scuro , Muro , Donna , Uomo , Bambini , Ragazzi ,"]},"id":"LAGL-PA_111_Sch_Y-PA_111_Sch_Y13_005_Nr_647"}
\ No newline at end of file
......@@ -8,6 +8,7 @@ app:
url: "https://media.memobase.k8s.unibas.ch/memo/"
institutionTypeLabelsPath: "src/test/resources/configs/institution-type-labels.csv"
accessTermLabelsPath: "src/test/resources/configs/access-term-labels.csv"
reuseStatementLabelsPath: "src/test/resources/configs/reuse-statement-labels.csv"
kafka:
streams:
bootstrap.servers: localhost:12345
......
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