Skip to content

Commit

Permalink
Merge pull request #5302 from inception-project/feature/5291-Improve-…
Browse files Browse the repository at this point in the history
…curation-and-auto-merging-of-link-features

#5291 - Improve curation and auto-merging of link features
  • Loading branch information
reckart authored Feb 18, 2025
2 parents 2e40354 + 62fac24 commit 8351aad
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public static CasMergeOperationResult mergeSlotFeature(CasMergeContext aContext,

var targetLinkHost = findLinkHostInTargetCas(aTargetCas, aSourceFs, adapter, slotFeature,
sourceLink);
var targetLinkTarget = findLinkTargetInTargetCas(aContext, adapter, aSourceFs, sourceLink,
slotFeature, aSourceSlotIndex, aTargetCas);
var targetLinkTarget = findLinkTargetInTargetCas(aTargetCas, aSourceFs, adapter, slotFeature,
sourceLink, aSourceSlotIndex, aContext);

List<LinkWithRoleModel> targetLinks = adapter.getFeatureValue(slotFeature, targetLinkHost);

Expand Down Expand Up @@ -134,18 +134,18 @@ private static LinkWithRoleModel existingLinkWithTarget(LinkWithRoleModel aLink,
return null;
}

private static AnnotationFS findLinkTargetInTargetCas(CasMergeContext aContext,
TypeAdapter aAdapter, AnnotationFS aSourceFS, LinkWithRoleModel aSourceLink,
AnnotationFeature aSlotFeature, int aSourceSlotIndex, CAS aTargetCas)
private static AnnotationFS findLinkTargetInTargetCas(CAS aTargetCas,
AnnotationFS aSourceFS, TypeAdapter aAdapter, AnnotationFeature aSlotFeature,
LinkWithRoleModel aSourceLink, int aSourceSlotIndex, CasMergeContext aContext)
throws UnfulfilledPrerequisitesException
{
var sourceCas = aSourceFS.getCAS();
var sourceLinkTarget = selectAnnotationByAddr(sourceCas, aSourceLink.targetAddr);
var sourceLinkTargetAdapter = aContext.getAdapter(aContext
.findLayer(aAdapter.getLayer().getProject(), sourceLinkTarget.getType().getName()));

var candidateTarget = selectBestCandidateTarget(aContext, aAdapter, aSourceFS, aSourceLink,
aSlotFeature, aSourceSlotIndex, aTargetCas);
var candidateTarget = selectBestCandidateTarget(aTargetCas, aAdapter, aSourceFS, aContext,
aSourceLink, aSlotFeature, aSourceSlotIndex);

if (candidateTarget.isEmpty()) {
throw new UnfulfilledPrerequisitesException("There is no ["
Expand All @@ -157,9 +157,9 @@ private static AnnotationFS findLinkTargetInTargetCas(CasMergeContext aContext,
return candidateTarget.get();
}

private static Optional<Annotation> selectBestCandidateTarget(CasMergeContext aContext,
TypeAdapter aAdapter, AnnotationFS aSourceFS, LinkWithRoleModel aSourceLink,
AnnotationFeature aSlotFeature, int aSourceSlotIndex, CAS aTargetCas)
private static Optional<Annotation> selectBestCandidateTarget(CAS aTargetCas,
TypeAdapter aAdapter, AnnotationFS aSourceFS, CasMergeContext aContext,
LinkWithRoleModel aSourceLink, AnnotationFeature aSlotFeature, int aSourceSlotIndex)
throws UnfulfilledPrerequisitesException
{
var sourceCas = aSourceFS.getCAS();
Expand Down

0 comments on commit 8351aad

Please sign in to comment.