Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SO-5363: Do not update Moved from association members during concept... #1243

Merged
merged 3 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,20 +252,7 @@ private Concepts() { }
public static final String REFSET_REPLACED_BY_ASSOCIATION = "900000000000526001";
public static final String REFSET_SAME_AS_ASSOCIATION = "900000000000527005";
public static final String REFSET_SIMILAR_TO_ASSOCIATION = "900000000000529008";
public static final String REFSET_WAS_A_ASSOCIATION = "900000000000528000";

public static final Set<String> HISTORICAL_ASSOCIATION_REFSETS = ImmutableSet.of(
REFSET_HISTORICAL_ASSOCIATION,
REFSET_ALTERNATIVE_ASSOCIATION,
REFSET_MOVED_FROM_ASSOCIATION,
cmark marked this conversation as resolved.
Show resolved Hide resolved
REFSET_MOVED_TO_ASSOCIATION,
REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION,
REFSET_REFERS_TO_ASSOCIATION,
REFSET_REPLACED_BY_ASSOCIATION,
REFSET_SAME_AS_ASSOCIATION,
REFSET_SIMILAR_TO_ASSOCIATION,
REFSET_WAS_A_ASSOCIATION);

public static final String REFSET_WAS_A_ASSOCIATION = "900000000000528000";

// simple map type refsets
public static final String CTV3_SIMPLE_MAP_TYPE_REFERENCE_SET_ID = "900000000000497000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
*/
package com.b2international.snowowl.snomed.datastore.request.rf2.validation;

import static com.b2international.snowowl.snomed.common.SnomedConstants.Concepts.HISTORICAL_ASSOCIATION_REFSETS;
import static com.b2international.snowowl.snomed.common.SnomedConstants.Concepts.REFSET_CONCEPT_INACTIVITY_INDICATOR;
import static com.b2international.snowowl.snomed.common.SnomedConstants.Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR;
import static com.b2international.snowowl.snomed.common.SnomedConstants.Concepts.*;
import static com.google.common.collect.Sets.newHashSet;

import java.io.IOException;
Expand All @@ -43,6 +41,7 @@
import com.b2international.snowowl.snomed.datastore.request.rf2.importer.Rf2AssociationRefSetContentType;
import com.b2international.snowowl.snomed.datastore.request.rf2.importer.Rf2AttributeValueRefSetContentType;
import com.b2international.snowowl.snomed.datastore.request.rf2.importer.Rf2EffectiveTimeSlice;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
Expand All @@ -56,6 +55,18 @@ public class Rf2GlobalValidator {

private static final int RAW_QUERY_PAGE_SIZE = 500_000;
private final Logger log;

private static final Set<String> HISTORICAL_ASSOCIATION_REFSETS_TO_VALIDATE = ImmutableSet.of(
REFSET_HISTORICAL_ASSOCIATION,
REFSET_ALTERNATIVE_ASSOCIATION,
REFSET_MOVED_TO_ASSOCIATION,
REFSET_MOVED_FROM_ASSOCIATION,
REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION,
REFSET_REFERS_TO_ASSOCIATION,
REFSET_REPLACED_BY_ASSOCIATION,
REFSET_SAME_AS_ASSOCIATION,
REFSET_SIMILAR_TO_ASSOCIATION,
REFSET_WAS_A_ASSOCIATION);

private Map<String, String> dependenciesByEffectiveTime;
private Map<String, String> skippableMemberDependenciesByEffectiveTime;
Expand Down Expand Up @@ -215,7 +226,7 @@ private void validateType(Rf2EffectiveTimeSlice slice, ImportDefectAcceptor glob
final String referenceSet = member[5];
final String type = member[0];

boolean invalidHistoricalAssociationMember = HISTORICAL_ASSOCIATION_REFSETS.contains(referenceSet) && !Rf2AssociationRefSetContentType.TYPE.equals(type);
boolean invalidHistoricalAssociationMember = HISTORICAL_ASSOCIATION_REFSETS_TO_VALIDATE.contains(referenceSet) && !Rf2AssociationRefSetContentType.TYPE.equals(type);
boolean invalidAttributeTypeMember = (REFSET_CONCEPT_INACTIVITY_INDICATOR.equals(referenceSet) || REFSET_DESCRIPTION_INACTIVITY_INDICATOR.equals(referenceSet))
&& !Rf2AttributeValueRefSetContentType.TYPE.equals(type);

Expand Down
Loading