use of org.semanticweb.owlapi.model.OWLEntity in project webprotege by protegeproject.
the class CSVColumnRelationEditorViewImpl method handleRelationTypeFieldChanged.
@UiHandler("relationTypeField")
protected void handleRelationTypeFieldChanged(ChangeEvent event) {
final Optional<OWLPrimitiveData> property = propertyField.getValue();
if (property.isPresent()) {
EntityType<?> propertyType = ((OWLEntity) property.get().getObject()).getEntityType();
if (getColumnType().isPresent()) {
ColumnType type = getColumnType().get();
List<EntityType<?>> propertyTypes = type.getPropertyTypes();
if (!propertyTypes.contains(propertyType)) {
final EntityType<?> firstPermissiblePropertyType = propertyTypes.get(0);
propertyField.coerceToEntityType(firstPermissiblePropertyType);
}
}
}
ValueChangeEvent.fire(this, property);
}
use of org.semanticweb.owlapi.model.OWLEntity in project webprotege by protegeproject.
the class CSVColumnRelationEditorViewImpl method updateRelationTypeField.
private void updateRelationTypeField() {
Optional<OWLPrimitiveData> property = propertyField.getValue();
int selIndex = relationTypeField.getSelectedIndex();
Optional<String> selectedItem;
if (selIndex != -1) {
selectedItem = Optional.of(relationTypeField.getItemText(selIndex));
} else {
selectedItem = Optional.empty();
}
List<String> nextItems = new ArrayList<>();
if (property.isPresent()) {
OWLPrimitiveData primitiveData = property.get();
final OWLEntity prop = (OWLEntity) primitiveData.getObject();
boolean freshEntity = DataFactory.isFreshEntity(prop);
if (freshEntity) {
for (ColumnType columnType : ColumnType.values()) {
nextItems.add(columnType.getDisplayName());
}
} else {
for (ColumnType columnType : ColumnType.values()) {
if (columnType.isPropertyType(prop.getEntityType())) {
nextItems.add(columnType.getDisplayName());
}
}
}
}
int nextSelIndex = 0;
relationTypeField.clear();
for (int i = 0; i < nextItems.size(); i++) {
String nextItem = nextItems.get(i);
relationTypeField.addItem(nextItem);
if (selectedItem.orElse("").equals(nextItem)) {
nextSelIndex = i;
}
}
relationTypeField.setSelectedIndex(nextSelIndex);
}
use of org.semanticweb.owlapi.model.OWLEntity in project webprotege by protegeproject.
the class DeleteEntityPresenter method start.
/**
* Start the deletion of the entities represented by the selected nodes in the specified tree.
* @param treeWidget The tree.
*/
public void start(@Nonnull TreeWidget<EntityHierarchyNode, OWLEntity> treeWidget) {
final Optional<EntityHierarchyNode> currentSelection = treeWidget.getFirstSelectedUserObject();
currentSelection.ifPresent(sel -> {
OWLEntity entity = sel.getEntity();
String browserText = sel.getBrowserText();
MessageBox.showConfirmBox(getDeleteConfirmationTitle(entity), getDeleteConfirmationMessage(entity, browserText), CANCEL, DELETE, () -> deleteEntity(entity, treeWidget), CANCEL);
});
}
use of org.semanticweb.owlapi.model.OWLEntity in project webprotege by protegeproject.
the class IndividualsListPresenter method deleteSelectedIndividuals.
private void deleteSelectedIndividuals() {
Collection<OWLNamedIndividualData> selection = view.getSelectedIndividuals();
Set<OWLEntity> entities = view.getSelectedIndividuals().stream().map(OWLNamedIndividualData::getEntity).collect(toSet());
dispatchServiceManager.execute(new DeleteEntitiesAction(projectId, entities), view, result -> updateList());
}
use of org.semanticweb.owlapi.model.OWLEntity in project webprotege by protegeproject.
the class DeleteEntityChangeListGenerator method generateChanges.
@Override
public OntologyChangeList<OWLEntity> generateChanges(ChangeGenerationContext context) {
OntologyChangeList.Builder<OWLEntity> builder = new OntologyChangeList.Builder<>();
OWLEntityRemover remover = new OWLEntityRemover(rootOntology.getImportsClosure());
entity.accept(remover);
List<RemoveAxiom> changeList = remover.getChanges();
builder.addAll(changeList);
return builder.build(entity);
}
Aggregations