Commit 0e17c239 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Add lower case filter to mappings to ensure that mappings are case insensitive.

Add additional whitespace trimmings to make sure that nothing gets through.
parent 965e01f3
Pipeline #21505 passed with stage
in 2 minutes and 28 seconds
......@@ -27,7 +27,7 @@ object LoadFile {
val facetList = csv.readAll(File(path))
val facetMap = mutableMapOf<String, Facets>()
for (row in facetList.listIterator(1)) {
facetMap[row[0]] = Facets(
facetMap[row[0].trim().toLowerCase()] = Facets(
row.subList(1, 6).filter { it != "" }.map { it.trim() },
row.subList(7, 12).filter { it != "" }.map { it.trim() }
)
......@@ -40,7 +40,7 @@ object LoadFile {
val labelsMap = mutableMapOf<String, Labels>()
for (row in labelList.listIterator(1)) {
labelsMap[row[0]] = Labels(row[1], row[2], row[3])
labelsMap[row[0].trim()] = Labels(row[1].trim(), row[2].trim(), row[3].trim())
}
return labelsMap
}
......
......@@ -39,9 +39,10 @@ class CarrierTypeNormalizer(
allStatements.filter { it.predicate != RICO.name }.filter { it.predicate != RDF.type }
item.listProperties(RICO.name).mapNotNull { statement ->
val nameValue = statement.string.trim()
val lowerCaseValue = nameValue.toLowerCase()
val record = findPhysicalInstantiation(model)
val builder = EnrichedConceptBuilder(RICO.CarrierType, model, record, RICO.hasCarrierType)
facetsMap[nameValue].let { facetValues ->
facetsMap[lowerCaseValue].let { facetValues ->
if (facetValues != null) {
facetValues.wikidata.forEach { facetValue ->
builder
......
......@@ -43,8 +43,9 @@ class GenreNormalizer(
allStatements.filter { it.predicate != SKOS.prefLabel }.filter { it.predicate != RDF.type }
item.listProperties(SKOS.prefLabel).mapNotNull { statement ->
val nameValue = statement.string.trim()
val lowerCaseValue = nameValue.toLowerCase()
val builder = EnrichedConceptBuilder(SKOS.Concept, model, record, EBUCORE.hasGenre)
facetsMap[nameValue].let { facetValues ->
facetsMap[lowerCaseValue].let { facetValues ->
if (facetValues != null) {
facetValues.wikidata.forEach { facetValue ->
builder
......
......@@ -39,9 +39,10 @@ class LanguagesNormalizer(
allStatements.filter { it.predicate != RICO.name }.filter { it.predicate != RDF.type }
item.listProperties(RICO.name).mapNotNull { statement ->
val nameValue = statement.string.trim()
val lowerCaseValue = nameValue.toLowerCase()
val record = findRecord(model)
val builder = EnrichedConceptBuilder(RICO.Language, model, record, RICO.hasLanguage)
facetsMap[nameValue].let { facetValues ->
facetsMap[lowerCaseValue].let { facetValues ->
if (facetValues != null) {
facetValues.wikidata.forEach { facetValue ->
builder
......
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