Commit 560d5d54 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Add conditionsOfUse for record based conditions.

parent 1861f94c
Pipeline #20627 failed with stages
in 4 minutes and 48 seconds
...@@ -214,14 +214,14 @@ class DocumentsSearchDocBuilder( ...@@ -214,14 +214,14 @@ class DocumentsSearchDocBuilder(
"NoSourceIdFound" "NoSourceIdFound"
}, },
sameAs = Extract.listOfStrings(record["sameAs"]), sameAs = Extract.listOfStrings(record["sameAs"]),
abstract = Extract.languageContainer("abstract", record["abstract"]), abstract = Extract.languageContainer("abstract (record id: $key)", record["abstract"]),
recordId = key, recordId = key,
institution = extractInstitution(record), institution = extractInstitution(record),
recordSet = extractRecordSet(record), recordSet = extractRecordSet(record),
descriptiveNote = Extract.languageContainer("descriptiveNote", record["descriptiveNote"]), descriptiveNote = Extract.languageContainer("descriptiveNote (record id: $key)", record["descriptiveNote"]),
scopeAndContent = Extract.languageContainer("scopeAndContent", record["scopeAndContent"]), scopeAndContent = Extract.languageContainer("scopeAndContent (record id: $key)", record["scopeAndContent"]),
relatedMaterial = Extract.languageContainer("relation", record["relation"]), relatedMaterial = Extract.languageContainer("relation (record id: $key)", record["relation"]),
source = Extract.languageContainer("source", record["source"]), source = Extract.languageContainer("source (record id: $key)", record["source"]),
temporal = temporalBuilder.build(), temporal = temporalBuilder.build(),
dateCreated = dateCreatedBuilder.build(), dateCreated = dateCreatedBuilder.build(),
dateIssued = dateIssuedBuilder.build(), dateIssued = dateIssuedBuilder.build(),
...@@ -229,13 +229,14 @@ class DocumentsSearchDocBuilder( ...@@ -229,13 +229,14 @@ class DocumentsSearchDocBuilder(
placeRelated = placesRelatedBuilder.build(), placeRelated = placesRelatedBuilder.build(),
placeFacet = placeFacetBuilder.build(), placeFacet = placeFacetBuilder.build(),
rightsHolder = Extract.typedEntityByType(recordRules, "type", "holder", "name"), rightsHolder = Extract.typedEntityByType(recordRules, "type", "holder", "name"),
memoriavClaim = record["P60451"] != null, conditionsOfUse = Extract.languageContainer("conditionsOfUse (record id: $key)", record[KEYS.conditionsOfUse]),
memoriavClaim = record[KEYS.sponsoredBy] != null,
format = formats.build(), format = formats.build(),
language = languages.build(), language = languages.build(),
genre = genres.build(), genre = genres.build(),
keywords = subjects.flatMap { Extract.languageContainer("hasSubject", it[KEYS.prefLabel]) }.let { keywords = subjects.flatMap { Extract.languageContainer("hasSubject (record id: $key)", it[KEYS.prefLabel]) }.let {
if (it.isEmpty()) if (it.isEmpty())
LanguageContainer.EMPTY LanguageContainer.EMPTY
else else
...@@ -268,7 +269,7 @@ class DocumentsSearchDocBuilder( ...@@ -268,7 +269,7 @@ class DocumentsSearchDocBuilder(
// DIGITAL // DIGITAL
accessDigital = accessDigital, accessDigital = accessDigital,
durationDigital = Extract.listOfStrings(digitalObject?.get("duration")), durationDigital = Extract.listOfStrings(digitalObject?.get("duration")),
colourDigital = Extract.listOfStrings(digitalObject?.get("P60558")), colourDigital = Extract.listOfStrings(digitalObject?.get(KEYS.color)),
digitalObjectNote = Extract.languageContainer("descriptiveNote", digitalObject?.get("descriptiveNote")), digitalObjectNote = Extract.languageContainer("descriptiveNote", digitalObject?.get("descriptiveNote")),
locator = locator, locator = locator,
usageConditionsDigital = Extract.languageContainer( usageConditionsDigital = Extract.languageContainer(
......
...@@ -60,7 +60,7 @@ object Extract { ...@@ -60,7 +60,7 @@ object Extract {
un = emptyList() un = emptyList()
) )
else -> { else -> {
log.error("Could not extract language container from subEntity $subEntity in entity $entity.") log.error("Invalid structure in $subEntity for $parent.")
null null
} }
} }
...@@ -68,11 +68,11 @@ object Extract { ...@@ -68,11 +68,11 @@ object Extract {
acc.merge(languageContainer) acc.merge(languageContainer)
}) })
null -> { null -> {
log.info("No items in $parent found.") log.info("No values for key $parent.")
emptyList() emptyList()
} }
else -> { else -> {
log.error("Could not extract language container from entity: $entity in parent $parent.") log.error("No values for key $parent.")
emptyList() emptyList()
} }
} }
......
...@@ -35,6 +35,7 @@ object KEYS { ...@@ -35,6 +35,7 @@ object KEYS {
const val institutionIndex = "elastic.institutionIndex" const val institutionIndex = "elastic.institutionIndex"
} }
const val conditionsOfUse = "conditionsOfUse"
const val isAssociatedWithDate = "isAssociatedWithDate" const val isAssociatedWithDate = "isAssociatedWithDate"
const val normalizedDateValue = "normalizedDateValue" const val normalizedDateValue = "normalizedDateValue"
const val sameAs = "sameAs" const val sameAs = "sameAs"
...@@ -83,6 +84,7 @@ object KEYS { ...@@ -83,6 +84,7 @@ object KEYS {
const val placeOfCapture = "P60556" const val placeOfCapture = "P60556"
const val producer = "P60441" const val producer = "P60441"
const val sponsoredBy = "P60451" const val sponsoredBy = "P60451"
const val color = "P60558"
// namespace skos: // namespace skos:
const val prefLabel = "prefLabel" const val prefLabel = "prefLabel"
......
...@@ -40,6 +40,7 @@ data class DocumentsSearchDoc( ...@@ -40,6 +40,7 @@ data class DocumentsSearchDoc(
val source: List<LanguageContainer>, val source: List<LanguageContainer>,
val relatedMaterial: List<LanguageContainer>, val relatedMaterial: List<LanguageContainer>,
val rightsHolder: List<LanguageContainer>, val rightsHolder: List<LanguageContainer>,
val conditionsOfUse: List<LanguageContainer>,
val sameAs: List<String>, val sameAs: List<String>,
// Concepts // Concepts
...@@ -78,6 +79,7 @@ data class DocumentsSearchDoc( ...@@ -78,6 +79,7 @@ data class DocumentsSearchDoc(
val dateCreated: List<DateContainer>, val dateCreated: List<DateContainer>,
val dateIssued: List<DateContainer>, val dateIssued: List<DateContainer>,
// Relations
val institution: List<FacetContainer>, val institution: List<FacetContainer>,
val recordSet: FacetContainer, val recordSet: FacetContainer,
...@@ -141,6 +143,7 @@ data class DocumentsSearchDoc( ...@@ -141,6 +143,7 @@ data class DocumentsSearchDoc(
emptyList(), emptyList(),
emptyList(), emptyList(),
emptyList(), emptyList(),
emptyList(),
LanguageContainer.EMPTY, LanguageContainer.EMPTY,
emptyList(), emptyList(),
emptyList(), emptyList(),
......
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