From 752a7fef337dd612907109b854fb84eb483229d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kleinb=C3=B6lting?= Date: Mon, 15 Jul 2024 14:03:27 +0200 Subject: [PATCH] fix: Do not fail when updating class with external ontologies (DEV-3879) (#3321) --- .../webapi/slice/ontology/repo/service/OntologyCache.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webapi/src/main/scala/org/knora/webapi/slice/ontology/repo/service/OntologyCache.scala b/webapi/src/main/scala/org/knora/webapi/slice/ontology/repo/service/OntologyCache.scala index 9542cd6df1..4257e2c65d 100644 --- a/webapi/src/main/scala/org/knora/webapi/slice/ontology/repo/service/OntologyCache.scala +++ b/webapi/src/main/scala/org/knora/webapi/slice/ontology/repo/service/OntologyCache.scala @@ -924,8 +924,11 @@ final case class OntologyCacheLive(triplestore: TriplestoreService, cacheDataRef val inheritableCardinalities: Map[SmartIri, KnoraCardinalityInfo] = directSubClass.entityInfoContent.subClassOf.flatMap { baseClassIri => - cacheData.ontologies(baseClassIri.getOntologyFromEntity).classes(baseClassIri).allCardinalities - }.toMap + for { + ontology <- cacheData.ontologies.get(baseClassIri.getOntologyFromEntity) + classInfo <- ontology.classes.get(baseClassIri) + } yield classInfo + }.flatMap(_.allCardinalities).toMap // Override inherited cardinalities with directly defined cardinalities. val newInheritedCardinalities: Map[SmartIri, KnoraCardinalityInfo] = OntologyHelpers.overrideCardinalities(