Skip to content

Commit c6c8855

Browse files
committed
CLASS-110 Prevent stated relationship ids being used during group change.
1 parent ece0a17 commit c6c8855

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

src/main/java/org/snomed/otf/owltoolkit/taxonomy/SnomedTaxonomyLoader.java

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,28 @@ public void newRelationshipState(String id, String effectiveTime, String active,
128128
parseLong(characteristicTypeId)
129129
)
130130
);
131-
} else if (loadingDelta || (!stated && !ACTIVE.equals(active))) {
132-
// Inactive relationships in the delta should be removed from the snapshot view
133-
snomedTaxonomy.removeRelationship(stated, sourceId, id);
134-
int effectiveTimeInt = !Strings.isNullOrEmpty(effectiveTime) ? Integer.parseInt(effectiveTime) : effectiveTimeNow;
135-
boolean universal = UNIVERSAL_RESTRICTION_MODIFIER.equals(modifierId);
136-
snomedTaxonomy.addInactiveInferredRelationship(parseLong(sourceId), new Relationship(
137-
parseLong(id),
138-
effectiveTimeInt,
139-
parseLong(moduleId),
140-
parseLong(typeId),
141-
parseLong(destinationId),
142-
false,
143-
Integer.parseInt(relationshipGroup),
144-
0,
145-
universal,
146-
parseLong(characteristicTypeId)));
131+
} else {
132+
// Inactive
133+
if (loadingDelta) {
134+
// Inactive relationships in the delta should be removed from the snapshot view
135+
snomedTaxonomy.removeRelationship(stated, sourceId, id);
136+
}
137+
if (!stated) {
138+
// Inactive inferred relationships kept for possible reactivation
139+
int effectiveTimeInt = !Strings.isNullOrEmpty(effectiveTime) ? Integer.parseInt(effectiveTime) : effectiveTimeNow;
140+
boolean universal = UNIVERSAL_RESTRICTION_MODIFIER.equals(modifierId);
141+
snomedTaxonomy.addInactiveInferredRelationship(parseLong(sourceId), new Relationship(
142+
parseLong(id),
143+
effectiveTimeInt,
144+
parseLong(moduleId),
145+
parseLong(typeId),
146+
parseLong(destinationId),
147+
false,
148+
Integer.parseInt(relationshipGroup),
149+
0,
150+
universal,
151+
parseLong(characteristicTypeId)));
152+
}
147153
}
148154
ComponentFactory componentFactoryTap = getComponentFactoryTap();
149155
if (componentFactoryTap != null) {

0 commit comments

Comments
 (0)