use of edu.stanford.bmir.protege.web.shared.csv.DocumentId 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();
}
use of edu.stanford.bmir.protege.web.shared.csv.DocumentId in project webprotege by protegeproject.
the class ComputeProjectMergeActionHandler method execute.
@Nonnull
@Override
public ComputeProjectMergeResult execute(@Nonnull ComputeProjectMergeAction action, @Nonnull ExecutionContext executionContext) {
try {
DocumentId documentId = action.getProjectDocumentId();
OWLOntology uploadedRootOntology = loadUploadedOntology(documentId);
Set<OntologyDiff> diffs = computeDiff(uploadedRootOntology, projectRootOntology);
List<DiffElement<String, SafeHtml>> transformedDiff = renderDiff(uploadedRootOntology, diffs);
return new ComputeProjectMergeResult(transformedDiff);
} catch (Exception e) {
logger.info("An error occurred whilst merging ontologies", e);
throw new RuntimeException(e);
}
}
Aggregations