From a2d4aef04970518125b6d59e1efa93238571b3d0 Mon Sep 17 00:00:00 2001 From: soimugeo Date: Tue, 26 Nov 2024 13:31:54 +0200 Subject: [PATCH] Fix for CreateClassesFromApiAction --- .../icd/actions/CreateClassesFromApiAction.java | 3 +-- .../CreateClassesFromApiActionHandler.java | 15 ++++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/edu/stanford/protege/webprotege/icd/actions/CreateClassesFromApiAction.java b/src/main/java/edu/stanford/protege/webprotege/icd/actions/CreateClassesFromApiAction.java index 36143cbd6..c0268131e 100644 --- a/src/main/java/edu/stanford/protege/webprotege/icd/actions/CreateClassesFromApiAction.java +++ b/src/main/java/edu/stanford/protege/webprotege/icd/actions/CreateClassesFromApiAction.java @@ -1,7 +1,6 @@ package edu.stanford.protege.webprotege.icd.actions; import com.fasterxml.jackson.annotation.*; -import com.google.common.collect.ImmutableSet; import edu.stanford.protege.webprotege.common.*; import edu.stanford.protege.webprotege.dispatch.ProjectAction; @@ -14,7 +13,7 @@ public record CreateClassesFromApiAction(@JsonProperty("changeRequestId") Change @JsonProperty("projectId") ProjectId projectId, @JsonProperty("sourceText") String sourceText, @JsonProperty("langTag") @Nullable String langTag, - @JsonProperty("parent") ImmutableSet parent) implements ProjectAction { + @JsonProperty("parent") String parent) implements ProjectAction { public static final String CHANNEL = "icatx.webprotege.entities.CreateClassesFromApi"; public String getChannel() { diff --git a/src/main/java/edu/stanford/protege/webprotege/icd/actions/CreateClassesFromApiActionHandler.java b/src/main/java/edu/stanford/protege/webprotege/icd/actions/CreateClassesFromApiActionHandler.java index aea025410..308057847 100644 --- a/src/main/java/edu/stanford/protege/webprotege/icd/actions/CreateClassesFromApiActionHandler.java +++ b/src/main/java/edu/stanford/protege/webprotege/icd/actions/CreateClassesFromApiActionHandler.java @@ -17,7 +17,6 @@ import javax.inject.Inject; import java.util.*; import java.util.concurrent.ExecutionException; -import java.util.stream.Collectors; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.ImmutableSet.toImmutableSet; @@ -70,16 +69,14 @@ protected List getRequiredExecutableBuiltInActions(CreateClassesF @Override protected ChangeListGenerator> getChangeListGenerator(CreateClassesFromApiAction action, ExecutionContext executionContext) { - var owlClassParents = action.parent().stream() - .map(DataFactory::getOWLClass) - .collect(ImmutableSet.toImmutableSet()); + var owlClassParent = DataFactory.getOWLClass(action.parent()); var language = action.langTag(); if (language == null || language.isEmpty()) { language = projectDetailsManager.getProjectSettings(action.projectId()).getDefaultLanguage().getLang(); } return changeGeneratorFactory.create(action.sourceText(), language, - owlClassParents, + ImmutableSet.of(owlClassParent), action.changeRequestId()); } @@ -92,19 +89,19 @@ protected CreateClassesFromApiResult createActionResult(ChangeApplicationResult< classes.forEach(newClass -> { try { - linearizationManager.mergeLinearizationsFromParents( + linearizationManager.createLinearizationFromParent( newClass.getIRI(), - action.parent().stream().map(IRI::create).collect(Collectors.toSet()), + IRI.create(action.parent()), action.projectId(), executionContext ).get(); } catch (InterruptedException | ExecutionException e) { - logger.error("MergeLinearizationsError: " + e); + logger.error("CreateLinearizationsError: " + e); } try { postcoordinationManager.createPostcoordinationFromParent( newClass.getIRI(), - IRI.create(action.parent().stream().findFirst().get()), + IRI.create(action.parent()), action.projectId(), executionContext ).get();