@Override @Nonnull public Collection<? extends Object> createCapabilities (final @Nonnull Taxon taxon) { return Collections.singletonList(new DefaultDocumentable(taxon)); } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @Nonnull public Graph getGraph() throws IOException { log.info("getGraph()"); final String resourceName = taxon.getId().stringValue().replaceAll(":", "_") + ".n3"; log.info(">>>> resourceName: {}", resourceName); final File file = createProviderFor.get().findAsset("factsheets.zip"); log.info(">>>> zip file: {}", file); final @Cleanup ZipFile zipFile = new ZipFile(file); final ZipEntry entry = zipFile.getEntry(resourceName); final @Cleanup InputStream is = zipFile.getInputStream(entry); return loadGraph(is, MimeTypes.MIME_N3); }
@Nonnull public FactSheet createFactSheetFor (final @Nonnull Taxon taxon) throws NotFoundException { try { final GraphProvider graphProvider = new DefaultGraphProvider(taxon); final Graph graph = graphProvider.getGraph(); final GraphUnmarshaller unmarshaller = new GraphUnmarshallerImpl(); unmarshaller.registerStatementUnmarshallerFactory(new FactSheetStatementUnmarshallerFactory()); return unmarshaller.unmarshal(graph, TYPE_TAXON); } catch (IOException e) { throw new NotFoundException(e); } } }