Skip to content
Open
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 @@ -115,7 +115,7 @@ public String execute(TransactionContext context) {

private SnomedConceptDocument convertConcept(final TransactionContext context) {
final String newDefinitionStatusId;
final Set<String> newAxiomExpressions = getOwlAxiomExpressions();
final Set<String> newAxiomExpressions = getOwlAxiomExpressions(context);

if (!newAxiomExpressions.isEmpty()) {
newDefinitionStatusId = SnomedOWLAxiomHelper.getDefinitionStatusFromExpressions(newAxiomExpressions);
Expand All @@ -140,12 +140,17 @@ private SnomedConceptDocument convertConcept(final TransactionContext context) {
}
}

private Set<String> getOwlAxiomExpressions() {
private Set<String> getOwlAxiomExpressions(final TransactionContext context) {
return Optional.ofNullable(members()).map(Collection::stream).orElseGet(Stream::empty)
.filter(req -> req.hasProperty(SnomedRf2Headers.FIELD_OWL_EXPRESSION))
.filter(req -> {
String owlExpression = req.getProperty(SnomedRf2Headers.FIELD_OWL_EXPRESSION);
SnomedOWLExpressionConverterResult result = context.service(SnomedOWLExpressionConverter.class)
.toSnomedOWLRelationships(req.getReferencedComponentId(), owlExpression);
return result.getGciAxiomRelationships() == null || result.getGciAxiomRelationships().isEmpty();
})
.map(req -> req.getProperty(SnomedRf2Headers.FIELD_OWL_EXPRESSION))
.collect(Collectors.toSet());

}

private void convertDescriptions(TransactionContext context, final String conceptId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ private boolean updateDefinitionStatus(final TransactionContext context, final S
.map(Collection::stream)
.orElseGet(Stream::empty)
.filter(member -> SnomedRefSetType.OWL_AXIOM == member.type() || Concepts.REFSET_OWL_AXIOM.equals(member.getReferenceSetId()))
.filter(member -> member.getGciOWLRelationships() == null || member.getGciOWLRelationships().isEmpty()) // Filter out GCI axioms
.map(member -> (String) member.getProperties().get(SnomedRf2Headers.FIELD_OWL_EXPRESSION))
.collect(Collectors.toSet());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public static String getDefinitionStatusFromExpressions(Set<String> owlExpressio

return owlExpressions.stream()
.filter(expression -> !Strings.isNullOrEmpty(expression))
Copy link
Member

@apeteri apeteri Sep 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filter GCI axioms here (in class SnomedOWLAxiomHelper), not in the create or update requests. They don't have a say in the concept's suggested definition status, but should be going through when creating or updating a SNOMED CT concept, just as before.

Or did they cause some other problem?

.filter(expression -> expression.toLowerCase(Locale.ENGLISH).contains(EQUIVALENTCLASSES))
.filter(expression -> !expression.toLowerCase(Locale.ENGLISH).contains(EQUIVALENTCLASSES))
.findFirst()
.map(equivalentClassesAxiom -> Concepts.FULLY_DEFINED)
.orElse(Concepts.PRIMITIVE);
.map(equivalentClassesAxiom -> Concepts.PRIMITIVE)
.orElse(Concepts.FULLY_DEFINED);
}

}