@Override public Collection<OWLOntologyDocumentSource> getDocumentSources() { return Lists.newArrayList(new FileDocumentSource(rootOntologyDocument)); }
public Reader getReader() { return new InputStreamReader(getInputStream()); } }
@Override public Collection<OWLOntologyDocumentSource> getDocumentSources() { return Lists.newArrayList(new FileDocumentSource(ontologyDocument)); }
@Override public OWLOntology loadOntologyFromOntologyDocument(File file) throws OWLOntologyCreationException { // XXX check default return loadOntologyFromOntologyDocument(new FileDocumentSource(file)); }
@Override public OWLOntology loadOntologyFromOntologyDocument(File file) throws OWLOntologyCreationException { // XXX check default return loadOntologyFromOntologyDocument(new FileDocumentSource(file)); }
@Override public OWLOntology loadOntologyFromOntologyDocument(File file) throws OWLOntologyCreationException { // XXX check default return loadOntologyFromOntologyDocument(new FileDocumentSource(file)); }
@Override public OWLOntology loadOntologyFromOntologyDocument(File file) throws OWLOntologyCreationException { // XXX check default return loadOntologyFromOntologyDocument(new FileDocumentSource(file)); }
public OWLOntology loadOntologyFromOntologyDocument(File file) throws OWLOntologyCreationException { return loadOntologyFromOntologyDocument(new FileDocumentSource(file)); }
/** * Loads an ontology from an ontology document contained in a local file. The loaded ontology * will be assigned a document IRI that corresponds to the file IRI. * * @param file The file that contains a representation of an ontology * @return The ontology that was parsed from the file. * @throws OWLOntologyCreationException If there was a problem in creating and loading the * ontology. * @throws org.semanticweb.owlapi.io.UnparsableOntologyException if the ontology could not be * parsed. * @throws UnloadableImportException if the ontology imports ontologies and one of the imports * could not be loaded for what ever reason. If the * {@link MissingImportHandlingStrategy} is set to * {@link MissingImportHandlingStrategy#SILENT} then this exception will not be thrown. * The {@code UnloadableImportException} contains information about the import * declaration that triggered the import and the cause of this exception is an {@code * OWLOntologyCreationException} which contains information about why the import could not be * loaded. * @throws org.semanticweb.owlapi.io.OWLOntologyCreationIOException if there was an {@code * IOException} when trying to load the ontology. * @throws OWLOntologyDocumentAlreadyExistsException if the IRI of the specified file is already * the document IRI for a loaded ontology. * @throws OWLOntologyAlreadyExistsException if the manager already contains an ontology whose * ontology IRI and version IRI is the same as the ontology IRI and version IRI of the * ontology contained in the document pointed to by {@code documentIRI}. */ default OWLOntology loadOntologyFromOntologyDocument(File file) throws OWLOntologyCreationException { return loadOntologyFromOntologyDocument(new FileDocumentSource(file)); }
/** * Loads an ontology from an ontology document contained in a local file. The loaded ontology * will be assigned a document IRI that corresponds to the file IRI. * * @param file The file that contains a representation of an ontology * @return The ontology that was parsed from the file. * @throws OWLOntologyCreationException If there was a problem in creating and loading the * ontology. * @throws org.semanticweb.owlapi.io.UnparsableOntologyException if the ontology could not be * parsed. * @throws UnloadableImportException if the ontology imports ontologies and one of the imports * could not be loaded for what ever reason. If the * {@link MissingImportHandlingStrategy} is set to * {@link MissingImportHandlingStrategy#SILENT} then this exception will not be thrown. * The {@code UnloadableImportException} contains information about the import * declaration that triggered the import and the cause of this exception is an {@code * OWLOntologyCreationException} which contains information about why the import could not be * loaded. * @throws org.semanticweb.owlapi.io.OWLOntologyCreationIOException if there was an {@code * IOException} when trying to load the ontology. * @throws OWLOntologyDocumentAlreadyExistsException if the IRI of the specified file is already * the document IRI for a loaded ontology. * @throws OWLOntologyAlreadyExistsException if the manager already contains an ontology whose * ontology IRI and version IRI is the same as the ontology IRI and version IRI of the * ontology contained in the document pointed to by {@code documentIRI}. */ default OWLOntology loadOntologyFromOntologyDocument(File file) throws OWLOntologyCreationException { return loadOntologyFromOntologyDocument(new FileDocumentSource(file)); }
/** * Loads an ontology from an ontology document contained in a local file. The loaded ontology * will be assigned a document IRI that corresponds to the file IRI. * * @param file The file that contains a representation of an ontology * @return The ontology that was parsed from the file. * @throws OWLOntologyCreationException If there was a problem in creating and loading the * ontology. * @throws org.semanticweb.owlapi.io.UnparsableOntologyException if the ontology could not be * parsed. * @throws UnloadableImportException if the ontology imports ontologies and one of the imports * could not be loaded for what ever reason. If the * {@link MissingImportHandlingStrategy} is set to * {@link MissingImportHandlingStrategy#SILENT} then this exception will not be thrown. * The {@code UnloadableImportException} contains information about the import * declaration that triggered the import and the cause of this exception is an {@code * OWLOntologyCreationException} which contains information about why the import could not be * loaded. * @throws org.semanticweb.owlapi.io.OWLOntologyCreationIOException if there was an {@code * IOException} when trying to load the ontology. * @throws OWLOntologyDocumentAlreadyExistsException if the IRI of the specified file is already * the document IRI for a loaded ontology. * @throws OWLOntologyAlreadyExistsException if the manager already contains an ontology whose * ontology IRI and version IRI is the same as the ontology IRI and version IRI of the * ontology contained in the document pointed to by {@code documentIRI}. */ default OWLOntology loadOntologyFromOntologyDocument(File file) throws OWLOntologyCreationException { return loadOntologyFromOntologyDocument(new FileDocumentSource(file)); }
private OWLOntology loadOwlOntology() throws OWLOntologyCreationException { FileDocumentSource fileDocumentSource = new FileDocumentSource(ontologyFile); // use silent import handling strategy to enable ontology loading without internet access // see: https://github.com/molgenis/molgenis/issues/5301 OWLOntologyLoaderConfiguration owlOntologyLoaderConfiguration = new OWLOntologyLoaderConfiguration() .setMissingImportHandlingStrategy(MissingImportHandlingStrategy.SILENT); return manager.loadOntologyFromOntologyDocument( fileDocumentSource, owlOntologyLoaderConfiguration); }
log.debug("Cannot load from the web", e1); log.debug("Try to load the configuration ontology as full local file path"); oConfSrc = new FileDocumentSource(new File(configPath)); } catch (Exception e2) { log.error("Cannot load the configuration ontology from parameter value: "
public static synchronized OWLOntologyDocumentSource getOntologyInputSource(URI uri) throws ODPRegistryCacheException, URIUnresolvableException { if (getUnresolvedURIs().contains(uri)) throw new URIUnresolvableException(); if (uris.containsKey(uri)) { File f = uris.get(uri); FileDocumentSource fds = new FileDocumentSource(f); return fds; } else { try { retrieveRemoteResource(uri); return getOntologyInputSource(uri); } catch (UnknownOWLOntologyException e) { throw new ODPRegistryCacheException(e); } catch (OWLOntologyCreationException e) { throw new ODPRegistryCacheException(e); } catch (OWLOntologyStorageException e) { throw new ODPRegistryCacheException(e); } } }
public static synchronized OWLOntologyDocumentSource getOntologyInputSource(URI uri) throws ODPRegistryCacheException, URIUnresolvableException { if (getUnresolvedURIs().contains(uri)) throw new URIUnresolvableException(); if (uris.containsKey(uri)) { File f = uris.get(uri); FileDocumentSource fds = new FileDocumentSource(f); return fds; } else { try { retrieveRemoteResource(uri); return getOntologyInputSource(uri); } catch (UnknownOWLOntologyException e) { throw new ODPRegistryCacheException(e); } catch (OWLOntologyCreationException e) { throw new ODPRegistryCacheException(e); } catch (OWLOntologyStorageException e) { throw new ODPRegistryCacheException(e); } } }
log.debug("Cannot load from the web", e1); log.debug("Try to load the configuration ontology as full local file path"); oConfSrc = new FileDocumentSource(new File(configPath)); } catch (Exception e2) { log.error("Cannot load the configuration ontology from parameter value: "
/** * Method that will download the ontology to document with Widoco. * @param c Widoco configuration object. * @throws java.lang.Exception */ public static void loadModelToDocument(Configuration c) throws Exception{ if(!c.isFromFile()){ String newOntologyPath = c.getTmpFile().getAbsolutePath()+File.separator+"Ontology"; downloadOntology(c.getOntologyURI(), newOntologyPath); c.setFromFile(true); c.setOntologyPath(newOntologyPath); } //reding the model with Jena (deprecated) // OntModel model = ModelFactory.createOntologyModel();//ModelFactory.createDefaultModel(); // readOntModel(model, c); // c.getMainOntology().setMainModel(model); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntologyLoaderConfiguration loadingConfig = new OWLOntologyLoaderConfiguration(); loadingConfig = loadingConfig.setMissingImportHandlingStrategy(MissingImportHandlingStrategy.SILENT); OWLOntology ontology= manager.loadOntologyFromOntologyDocument(new FileDocumentSource(new File(c.getOntologyPath())),loadingConfig); c.getMainOntology().setMainOntology(ontology); c.getMainOntology().setMainOntologyManager(manager); c.getMainOntology().getOWLAPIModel().setOWLOntologyManager(manager); }