Commit 5ec21ff8 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix multiple qualifiers & certainties.

parent ab38a2f1
Pipeline #16771 passed with stages
in 5 minutes and 52 seconds
package org.memobase.builders
import com.beust.klaxon.JsonArray
import com.beust.klaxon.JsonObject
import org.apache.logging.log4j.LogManager
import org.memobase.KEYS
......@@ -32,8 +33,16 @@ class DateContainerBuilder(private val containedIds: List<String>) : IFieldBuild
} else {
null
}
val qualifier = jsonObject["dateQualifier"] as String?
val certainty = jsonObject["certainty"] as String?
val qualifier = when (val value = jsonObject["dateQualifier"]) {
is String -> listOf(value)
is JsonArray<*> -> value.mapNotNull { value as String? }
else -> emptyList()
}
val certainty = when (val value = jsonObject["certainty"]) {
is String -> listOf(value)
is JsonArray<*> -> value.mapNotNull { value as String? }
else -> emptyList()
}
val facetList = when (jsonObject["@type"] as String) {
NS.rico + "SingleDate" ->
if (isNormalized)
......
......@@ -24,7 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude
data class DateContainer(
val date: String,
val sort: String?,
val certainty: String?,
val qualifier: String?,
val certainty: List<String>,
val qualifier: List<String>,
val facet: List<String>
)
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