use of edu.stanford.bmir.protege.web.shared.entity.EntityLookupResult in project webprotege by protegeproject.
the class LookupEntitiesActionResultCachingStrategy method getInvalidationKeys.
@Override
public Collection<OWLEntity> getInvalidationKeys(LookupEntitiesAction action, LookupEntitiesResult result) {
List<OWLEntity> entities = new ArrayList<OWLEntity>();
for (EntityLookupResult res : result.getEntityLookupResults()) {
OWLEntity entity = res.getOWLEntityData().getEntity();
entities.add(entity);
}
return entities;
}
use of edu.stanford.bmir.protege.web.shared.entity.EntityLookupResult in project webprotege by protegeproject.
the class CommentAutoCompleter method handleAttemptAtEntityCompletions.
private void handleAttemptAtEntityCompletions(String queryUpToCaret, EditorPosition caretPos, AutoCompletionCallback callback) {
// Last index of space or 0 if there are not spaces
int wordStart = queryUpToCaret.lastIndexOf(" ") + 1;
int wordFragmentLen = queryUpToCaret.length() - wordStart;
String wordFragment = queryUpToCaret.substring(wordStart);
if (wordFragment.isEmpty()) {
callback.completionsReady(new AutoCompletionResult());
return;
}
dispatchServiceManager.execute(new LookupEntitiesAction(projectId, lookUpEntities(wordFragment)), result -> {
List<AutoCompletionChoice> choices = new ArrayList<>();
EditorPosition pos = new EditorPosition(caretPos.getLineNumber(), caretPos.getColumnNumber() - wordFragmentLen);
for (final EntityLookupResult entity : result.getEntityLookupResults()) {
choices.add(new AutoCompletionChoice(formatReplacementTest(entity), entity.getOWLEntityData().getBrowserText(), "", pos, caretPos));
}
AutoCompletionResult autoCompletionResult = new AutoCompletionResult(choices, pos);
callback.completionsReady(autoCompletionResult);
});
}
Aggregations