public VocabBuilder(String filename, RDFFormat format) throws IOException, RDFParseException { Path file = Paths.get(filename); if (!Files.exists(file)) throw new FileNotFoundException(filename); if (format == null) { format = Rio.getParserFormatForFileName(filename); log.trace("detected input format from filename {}: {}", filename, format); } try (final InputStream inputStream = Files.newInputStream(file)) { log.trace("Loading input file"); model = Rio.parse(inputStream, "", format); } // import Set<Resource> owlOntologies = model.filter(null, RDF.TYPE, OWL.ONTOLOGY).subjects(); if (!owlOntologies.isEmpty()) { setPrefix(owlOntologies.iterator().next().stringValue()); } }