use of edu.stanford.bmir.protege.web.server.diff.OntologyDiff2OntologyChanges in project webprotege by protegeproject.
the class MergeUploadedProjectActionHandler method execute.
@Nonnull
@Override
public MergeUploadedProjectResult execute(@Nonnull MergeUploadedProjectAction action, @Nonnull ExecutionContext executionContext) {
try {
DocumentId documentId = action.getUploadedDocumentId();
final OWLOntology uploadedRootOntology = loadUploadedOntology(documentId);
ModifiedProjectOntologiesCalculator calculator = new ModifiedProjectOntologiesCalculator(ImmutableSet.copyOf(projectRootOntology.getImportsClosure()), ImmutableSet.copyOf(uploadedRootOntology.getImportsClosure()), new OntologyDiffCalculator(new AnnotationDiffCalculator(), new AxiomDiffCalculator()));
Set<OntologyDiff> ontologyDiffSet = calculator.getModifiedOntologyDiffs();
List<OWLOntologyChange> changeList = new ArrayList<>();
HasGetOntologyById man = projectRootOntology.getOWLOntologyManager();
for (OntologyDiff diff : ontologyDiffSet) {
OntologyDiff2OntologyChanges diff2Changes = new OntologyDiff2OntologyChanges();
List<OWLOntologyChange> changes = diff2Changes.getOntologyChangesFromDiff(diff, man);
changeList.addAll(changes);
}
applyChanges(action.getCommitMessage(), changeList, executionContext);
} catch (IOException | OWLOntologyCreationException e) {
throw new ActionExecutionException(e);
}
return new MergeUploadedProjectResult();
}
Aggregations