use of org.semanticweb.owlapi.model.OWLEntity in project webprotege by protegeproject.
the class FindAndReplaceIRIPrefixChangeGenerator method generateChanges.
@Override
public OntologyChangeList<Collection<OWLEntity>> generateChanges(ChangeGenerationContext context) {
OntologyChangeList.Builder<Collection<OWLEntity>> builder = OntologyChangeList.builder();
Map<OWLEntity, IRI> renameMap = new HashMap<>();
for (OWLEntity entity : rootOntology.getSignature(Imports.INCLUDED)) {
if (!entity.isBuiltIn()) {
IRI iri = entity.getIRI();
String iriString = iri.toString();
if (iriString.startsWith(fromPrefix)) {
IRI toIRI = IRI.create(toPrefix + iri.subSequence(fromPrefix.length(), iri.length()));
renameMap.put(entity, toIRI);
}
}
}
OWLEntityRenamer entityRenamer = new OWLEntityRenamer(rootOntology.getOWLOntologyManager(), rootOntology.getImportsClosure());
List<OWLOntologyChange> changeList = entityRenamer.changeIRI(renameMap);
builder.addAll(changeList);
return builder.build(renameMap.keySet());
}
use of org.semanticweb.owlapi.model.OWLEntity in project webprotege by protegeproject.
the class OBOTermRelationshipPortletPresenter method displayEntity.
@Override
protected void displayEntity(OWLEntity entity) {
Optional<OWLEntity> current = getSelectedEntity();
if (!current.isPresent()) {
editor.clearValue();
pristineValue = Optional.empty();
return;
}
if (!(current.get() instanceof OWLClass)) {
editor.clearValue();
pristineValue = Optional.empty();
return;
}
dispatch.execute(new GetOboTermRelationshipsAction(getProjectId(), entity.asOWLClass()), this, result -> {
List<OBORelationship> listOfRels = new ArrayList<>(result.getRelationships().getRelationships());
pristineValue = Optional.of(listOfRels);
editor.setValue(listOfRels);
});
}
use of org.semanticweb.owlapi.model.OWLEntity in project webprotege by protegeproject.
the class ClassNameFieldEditor method setValue.
@Override
public void setValue(FormDataValue object) {
Optional<OWLEntity> entity = object.asOWLEntity();
entity.ifPresent(e -> {
dispatchServiceManager.execute(new GetEntityRenderingAction(projectId, e), result -> editor.setValue(result.getEntityData()));
});
if (!entity.isPresent()) {
editor.clearValue();
}
}
use of org.semanticweb.owlapi.model.OWLEntity 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 org.semanticweb.owlapi.model.OWLEntity in project webprotege by protegeproject.
the class WatchPresenter method start.
public void start(final OWLEntity forEntity) {
final UserId userId = loggedInUserProvider.getCurrentUserId();
dispatchServiceManager.execute(new GetWatchesAction(projectId, userId, forEntity), new DispatchServiceCallback<GetWatchesResult>() {
@Override
public void handleSuccess(GetWatchesResult result) {
Set<Watch> watches = result.getWatches();
updateDialog(watches);
WebProtegeDialog<WatchTypeSelection> dlg = new WebProtegeDialog<>(controller);
dlg.show();
controller.setDialogButtonHandler(DialogButton.OK, (data, closer) -> {
closer.hide();
handleWatchTypeForEntity(data, forEntity);
});
}
});
}
Aggregations