use of edu.stanford.bmir.protege.web.shared.hierarchy.GetHierarchyChildrenResult in project webprotege by protegeproject.
the class GetEntityHierarchyChildrenActionHandler method execute.
@Nonnull
@Override
public GetHierarchyChildrenResult execute(@Nonnull GetHierarchyChildrenAction action, @Nonnull ExecutionContext executionContext) {
HierarchyId hierarchyId = action.getHierarchyId();
Optional<HierarchyProvider<OWLEntity>> hierarchyProvider = hierarchyProviderMapper.getHierarchyProvider(hierarchyId);
if (!hierarchyProvider.isPresent()) {
return emptyResult();
}
OWLEntity parent = action.getEntity();
GraphNode<EntityHierarchyNode> parentNode = nodeRenderer.toGraphNode(parent, hierarchyProvider.get());
SuccessorMap.Builder<EntityHierarchyNode> successorMap = SuccessorMap.builder();
hierarchyProvider.get().getChildren(parent).stream().filter(child -> isNotDeprecatedTopLevelEntity(parent, child)).map(child -> nodeRenderer.toGraphNode(child, hierarchyProvider.get())).forEach(childNode -> successorMap.add(parentNode, childNode));
successorMap.sort(comparing(GraphNode::getUserObject));
return new GetHierarchyChildrenResult(successorMap.build());
}
Aggregations