/** * 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); }
/** * 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) { List<Paragraph> paragraphs = new ArrayList<>(); String iriString = iri.toString(); if (isLinkableAddress(iri)) { if (isImageAddress(iri) && isDisplayThumbnails()) { try { IconBox iconBox = getImageBox(iri); page.add(iconBox); } catch (MalformedURLException e) { paragraphs.add(page.addParagraph(iriString, new HTTPLink(iri.toURI()))); } } else { paragraphs.add(page.addParagraph(iriString, new HTTPLink(iri.toURI()))); } } else { paragraphs.add(page.addParagraph(iriString)); } return paragraphs; }
private boolean isImageAddress(IRI iri) { String iriString = iri.toString(); return iriString.endsWith(".png") || iriString.endsWith(".jpg") || iriString.endsWith(".jpeg"); }