Search in sources :

Example 1 with ChangeEntityIRIResult

use of edu.stanford.bmir.protege.web.shared.entity.ChangeEntityIRIResult in project webprotege by protegeproject.

the class ChangeEntityIRIActionHandler method execute.

@Nonnull
@Override
public ChangeEntityIRIResult execute(@Nonnull ChangeEntityIRIAction action, @Nonnull ExecutionContext executionContext) {
    OWLEntityRenamer renamer = new OWLEntityRenamer(rootOntology.getOWLOntologyManager(), rootOntology.getImportsClosure());
    List<OWLOntologyChange> changeList = renamer.changeIRI(action.getEntity(), action.getTheNewIri());
    OWLEntityData oldRendering = renderer.getRendering(action.getEntity());
    applyChanges.applyChanges(executionContext.getUserId(), new FixedChangeListGenerator<>(changeList, action.getEntity(), String.format("Changed %s IRI from %s to %s", action.getEntity().getEntityType().getPrintName(), action.getEntity().getIRI(), action.getTheNewIri())));
    OWLEntity theNewEntity = dataFactory.getOWLEntity(action.getEntity().getEntityType(), action.getTheNewIri());
    discussionThreadRepository.replaceEntity(projectId, action.getEntity(), theNewEntity);
    OWLEntityData newRendering = renderer.getRendering(theNewEntity);
    return new ChangeEntityIRIResult(projectId, oldRendering, newRendering);
}
Also used : ChangeEntityIRIResult(edu.stanford.bmir.protege.web.shared.entity.ChangeEntityIRIResult) OWLOntologyChange(org.semanticweb.owlapi.model.OWLOntologyChange) OWLEntity(org.semanticweb.owlapi.model.OWLEntity) OWLEntityData(edu.stanford.bmir.protege.web.shared.entity.OWLEntityData) OWLEntityRenamer(org.semanticweb.owlapi.util.OWLEntityRenamer) Nonnull(javax.annotation.Nonnull)

Aggregations

ChangeEntityIRIResult (edu.stanford.bmir.protege.web.shared.entity.ChangeEntityIRIResult)1 OWLEntityData (edu.stanford.bmir.protege.web.shared.entity.OWLEntityData)1 Nonnull (javax.annotation.Nonnull)1 OWLEntity (org.semanticweb.owlapi.model.OWLEntity)1 OWLOntologyChange (org.semanticweb.owlapi.model.OWLOntologyChange)1 OWLEntityRenamer (org.semanticweb.owlapi.util.OWLEntityRenamer)1