use of org.semanticweb.owlapi.io.OWLObjectRenderer in project webprotege by protegeproject.
the class ComputeProjectMergeActionHandler method renderDiff.
private List<DiffElement<String, SafeHtml>> renderDiff(OWLOntology uploadedRootOntology, Set<OntologyDiff> diffs) {
final ShortFormProvider dualShortFormProvider = getShortFormProvider(uploadedRootOntology);
final OWLObjectRenderer renderer = getManchesterSyntaxObjectRenderer(projectRootOntology, uploadedRootOntology, dualShortFormProvider);
List<DiffElement<String, OWLAxiom>> diffElements = getDiffElements(diffs);
sortDiff(diffElements);
// Transform from OWLAxiom to SafeHtml
List<DiffElement<String, SafeHtml>> transformedDiff = new ArrayList<>();
for (DiffElement<String, OWLAxiom> element : diffElements) {
String html = renderer.render(element.getLineElement());
SafeHtml rendering = new SafeHtmlBuilder().appendHtmlConstant(html).toSafeHtml();
transformedDiff.add(new DiffElement<>(element.getDiffOperation(), element.getSourceDocument(), rendering));
}
return transformedDiff;
}
Aggregations