use of edu.stanford.bmir.protege.web.shared.entity.OWLEntityData in project webprotege by protegeproject.
the class PrimitiveDataParserImpl_LiteralParsing_TestCase method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() {
primitiveTypes = Sets.newHashSet();
primitiveTypes.add(PrimitiveType.LITERAL);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
AsyncCallback<Optional<OWLEntityData>> callback = (AsyncCallback<Optional<OWLEntityData>>) invocationOnMock.getArguments()[2];
callback.onSuccess(Optional.empty());
return null;
}
}).when(lookupHandler).lookupEntity(any(String.class), any(Set.class), any(AsyncCallback.class));
parser = new PrimitiveDataParserImpl(lookupHandler);
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLEntityData in project webprotege by protegeproject.
the class CommentPostedEventView method setValue.
public void setValue(CommentPostedEvent event) {
Comment comment = event.getComment();
UserId createdBy = comment.getCreatedBy();
userNameLabel.setText(createdBy.getUserName());
userIconHolder.setWidget(UserIcon.get(createdBy));
final java.util.Optional<OWLEntityData> targetAsEntityData = event.getEntity();
if (targetAsEntityData.isPresent()) {
entityLabel.setEntity(targetAsEntityData.get());
entityLabel.setVisible(true);
} else {
entityLabel.setVisible(false);
}
timeLabel.setBaseTime(comment.getCreatedAt());
final SafeHtmlBuilder builder = new SafeHtmlBuilder();
bodyLabel.setHTML(builder.appendHtmlConstant(comment.getRenderedBody()).toSafeHtml());
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLEntityData in project webprotege by protegeproject.
the class AugmentedFreshEntitiesSuggestStrategy method getSuggestion.
private Optional<FreshEntitySuggestion> getSuggestion(String query, EntityType<?> type, Optional<OWLEntityData> auxiliaryType) {
// TODO: If query starts with a lowercase letter, suggest individual first?
OWLEntity entity = DataFactory.getFreshOWLEntity(type, query);
OWLEntityData entityData = DataFactory.getOWLEntityData(entity, query);
if (auxiliaryType.isPresent()) {
AuxiliaryTypeHandler auxiliaryTypeHandler = AuxiliaryTypeHandler.get(auxiliaryType.get());
if (auxiliaryTypeHandler.isApplicableTo(type)) {
Set<OWLAxiom> augmentingAxioms = auxiliaryTypeHandler.getAdditionalAxioms(entity);
return Optional.of(new FreshEntitySuggestion(entityData, auxiliaryTypeHandler.getSuggestionText(entityData), augmentingAxioms));
}
}
return Optional.empty();
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLEntityData in project webprotege by protegeproject.
the class AugmentedFreshEntitiesSuggestStrategy method getSuggestions.
@Override
public List<EntitySuggestion> getSuggestions(String query, List<EntityType<?>> suggestedTypes) {
List<EntitySuggestion> result = Lists.newArrayList();
for (EntityType<?> type : suggestedTypes) {
for (Optional<OWLEntityData> auxiliaryType : auxiliaryTypes) {
Optional<FreshEntitySuggestion> suggestion = getSuggestion(query, type, auxiliaryType);
if (suggestion.isPresent()) {
result.add(suggestion.get());
}
}
OWLEntity entity = DataFactory.getFreshOWLEntity(type, query);
OWLEntityData entityData = DataFactory.getOWLEntityData(entity, query);
result.add(new EntitySuggestion(entityData, formatSuggestText(query, type)));
}
return result;
}
use of edu.stanford.bmir.protege.web.shared.entity.OWLEntityData in project webprotege by protegeproject.
the class SimpleFreshEntitySuggestStrategy method getSuggestions.
@Override
public List<EntitySuggestion> getSuggestions(String query, List<EntityType<?>> suggestedTypes) {
List<EntitySuggestion> suggestions = Lists.newArrayList();
for (EntityType<?> allowedType : suggestedTypes) {
OWLEntity entity = DataFactory.getFreshOWLEntity(allowedType, query);
OWLEntityData entityData = DataFactory.getOWLEntityData(entity, query);
suggestions.add(new EntitySuggestion(entityData, formatSuggestText(query, allowedType)));
}
return suggestions;
}
Aggregations