Search in sources :

Example 1 with OWLObjectRenderer

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;
}
Also used : DiffElement(edu.stanford.bmir.protege.web.shared.diff.DiffElement) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) WebProtegeShortFormProvider(edu.stanford.bmir.protege.web.server.shortform.WebProtegeShortFormProvider) WebProtegeIRIShortFormProvider(edu.stanford.bmir.protege.web.server.shortform.WebProtegeIRIShortFormProvider) ShortFormProvider(org.semanticweb.owlapi.util.ShortFormProvider) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) OWLObjectRenderer(org.semanticweb.owlapi.io.OWLObjectRenderer)

Aggregations

SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)1 WebProtegeIRIShortFormProvider (edu.stanford.bmir.protege.web.server.shortform.WebProtegeIRIShortFormProvider)1 WebProtegeShortFormProvider (edu.stanford.bmir.protege.web.server.shortform.WebProtegeShortFormProvider)1 DiffElement (edu.stanford.bmir.protege.web.shared.diff.DiffElement)1 OWLObjectRenderer (org.semanticweb.owlapi.io.OWLObjectRenderer)1 ShortFormProvider (org.semanticweb.owlapi.util.ShortFormProvider)1