/** * Renders an IRI as a full IRI rather than as an IRI that represents an entity in the signature * of the imports closure of the active ontology. * * @param page The page that the IRI should be rendered into. * @param iri The IRI to be rendered. * @return A list of paragraphs that represent the rendering of the annotation value. */ private List<Paragraph> renderExternalIRI(Page page, IRI iri) { Paragraph paragraph; if (isLinkableAddress(iri)) { paragraph = page.addParagraph(iri.toString(), new HTTPLink(iri.toURI())); } else { paragraph = page.addParagraph(iri.toString()); } return Arrays.asList(paragraph); }
/** * Determines whether an IRI that represents an annotation value can be opened in a web browser. * i.e. wherther or not the IRI represents a web link. * * @param iri The iri to be tested. * @return <code>true</code> if the IRI represents a web link, other wise <code>false</code>. */ private boolean isLinkableAddress(IRI iri) { String scheme = iri.getScheme(); return scheme != null && scheme.startsWith("http"); }