From 6918211c1125c68653dc17ff8c6653c573b857f0 Mon Sep 17 00:00:00 2001 From: Nils Ove Tendenes Date: Thu, 27 Jun 2024 09:40:41 +0200 Subject: [PATCH] fix: add all valueRange values to RDF --- .../service/SkosApNoModelService.kt | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/main/kotlin/no/fdk/concept_catalog/service/SkosApNoModelService.kt b/src/main/kotlin/no/fdk/concept_catalog/service/SkosApNoModelService.kt index 73c7b4af..ceddd997 100644 --- a/src/main/kotlin/no/fdk/concept_catalog/service/SkosApNoModelService.kt +++ b/src/main/kotlin/no/fdk/concept_catalog/service/SkosApNoModelService.kt @@ -210,11 +210,15 @@ class SkosApNoModelService( definitionResource } - private fun Resource.addScopeToConcept(concept: Begrep) { - concept.omfang - ?.takeIf { !it.tekst.isNullOrBlank() || it.uri.isValidURI() } - ?.let { source -> addURIOrText(SKOSNO.valueRange, source) } - } + private fun Resource.addScopeToConcept(concept: Begrep) = + concept.omfang?.let { valueRange -> + if (valueRange.uri.isValidURI()) { + addProperty(SKOSNO.valueRange, model.safeCreateResource(valueRange.uri)) + } + if (!valueRange.tekst.isNullOrBlank()) { + addProperty(SKOSNO.valueRange, valueRange.tekst, NB) + } + } private fun Resource.addStatusToConcept(concept: Begrep) { concept.statusURI @@ -251,16 +255,6 @@ class SkosApNoModelService( } } - private fun Resource.addURIOrText(predicate: Property, uriText: URITekst) { - if (uriText.uri.isValidURI()) { - addProperty(predicate, model.safeCreateResource(uriText.uri)) - } - else if (!uriText.tekst.isNullOrBlank()) { - addProperty(predicate, uriText.tekst, NB) - } - } - - private fun Resource.addAltLabelToConcept(concept: Begrep) { concept.tillattTerm ?.filterValues { it.isNotEmpty() }