use of edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyNode 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());
}
use of edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyNode in project webprotege by protegeproject.
the class EntityHierarchyNodeUpdater method handleEntityTagsChanged.
private void handleEntityTagsChanged(EntityTagsChangedEvent event) {
if (model == null) {
throw createHierarchyModelIsNullException();
}
model.getHierarchyNode(event.getEntity()).ifPresent(node -> {
EntityHierarchyNode updatedNode = new EntityHierarchyNode(node.getEntity(), node.getBrowserText(), node.isDeprecated(), node.getWatches(), node.getOpenCommentCount(), event.getTags());
model.updateNode(updatedNode);
});
}
use of edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyNode in project webprotege by protegeproject.
the class EntityHierarchyNodeUpdater method handleEntityDeprecatedChanged.
private void handleEntityDeprecatedChanged(EntityDeprecatedChangedEvent event) {
if (model == null) {
throw createHierarchyModelIsNullException();
}
model.getHierarchyNode(event.getEntity()).ifPresent(node -> {
EntityHierarchyNode updatedNode = new EntityHierarchyNode(node.getEntity(), node.getBrowserText(), event.isDeprecated(), node.getWatches(), node.getOpenCommentCount(), node.getTags());
model.updateNode(updatedNode);
});
}
use of edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyNode in project webprotege by protegeproject.
the class EntityHierarchyNodeUpdater method handleCommentPosted.
private void handleCommentPosted(CommentPostedEvent event) {
if (model == null) {
throw createHierarchyModelIsNullException();
}
event.getEntity().ifPresent(entity -> {
model.getHierarchyNode(entity.getEntity()).ifPresent(node -> {
EntityHierarchyNode updatedNode = new EntityHierarchyNode(node.getEntity(), node.getBrowserText(), node.isDeprecated(), node.getWatches(), event.getOpenCommentCountForEntity(), node.getTags());
model.updateNode(updatedNode);
});
});
}
Aggregations