public static OWLOntology loadAxiomOntology( InputStream inputStream ) throws IOException { try { return OWL.manager.loadOntologyFromOntologyDocument( inputStream ); } catch( OWLOntologyCreationException e ) { log.log( Level.SEVERE, "Unable to create an ontology", e ); throw new IOException( "Unable to create an ontology" ); } }
public static OWLOntology loadAxiomOntology(final InputStream inputStream) throws IOException { try { return OWL._manager.loadOntologyFromOntologyDocument(inputStream); } catch (final OWLOntologyCreationException e) { _logger.log(Level.SEVERE, "Unable to create an ontology", e); throw new IOException("Unable to create an ontology"); } }
@Override public OWLOntology loadOntologyFromOntologyDocument(OWLOntologyDocumentSource documentSource) throws OWLOntologyCreationException { if (sealed) { throw new OntologyCreationNotAllowedException(); } return delegate.loadOntologyFromOntologyDocument(documentSource); }
@Override public OWLOntology loadOntologyFromOntologyDocument(OWLOntologyDocumentSource documentSource, OWLOntologyLoaderConfiguration config) throws OWLOntologyCreationException { if (sealed) { throw new OntologyCreationNotAllowedException(); } return delegate.loadOntologyFromOntologyDocument(documentSource, config); }
@Override public OWLOntology loadOntologyFromOntologyDocument(File file) throws OWLOntologyCreationException { if (sealed) { throw new OntologyCreationNotAllowedException(); } return delegate.loadOntologyFromOntologyDocument(file); }
@Override public OWLOntology loadOntologyFromOntologyDocument(InputStream inputStream) throws OWLOntologyCreationException { if (sealed) { throw new OntologyCreationNotAllowedException(); } return delegate.loadOntologyFromOntologyDocument(inputStream); }
@Override public String getFileVersion() throws Exception { final FileInputStream in = new FileInputStream(new File(inputFile)); final OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); final OWLOntology directOntology = manager.loadOntologyFromOntologyDocument(in); // Determine version return getReleaseVersion(directOntology); }
private void loadConfiguration(BundleContext context, String configuration) throws OWLOntologyCreationException { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); MetaprojectVocabulary.addIRIMapper(manager); final OWLOntology ontology = manager.loadOntologyFromOntologyDocument(new File(configuration)); context.registerService(ServerConfiguration.class, new ServerConfiguration() { @Override public OWLOntology getMetaOntology() { return ontology; } }, new Hashtable<String, String>()); }
public Optional<OWLOntologyID> getOntologyId(URI location) { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); try { OWLOntology ontology = manager.loadOntologyFromOntologyDocument(IRI.create(location)); return Optional.of(ontology.getOntologyID()); } catch (Throwable t) { log.info("Exception caught trying to get ontology id for " + location, t); return null; } } }
public Optional<OWLOntologyID> getOntologyId(URI location) { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); try { OWLOntology ontology = manager.loadOntologyFromOntologyDocument(IRI.create(location)); return Optional.of(ontology.getOntologyID()); } catch (Throwable t) { log.info("Exception caught trying to get ontology id for " + location, t); return null; } } }
public OWLOntologyID getOntologyId() { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); try { OWLOntology ontology = manager.loadOntologyFromOntologyDocument(IRI.create(location)); return ontology.getOntologyID(); } catch (Throwable t) { log.info("Exception caught trying to get ontology id for " + location, t); return null; } }
private OWLOntology createOntology() throws OWLOntologyCreationException, IOException { // Set up the ontology here and hide its manager - the test needs to use a different ontology manager on reconstitution OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); Resource owlFile = new ClassPathResource("/org/dllearner/kb/owl-api-ontology-data.owl"); return manager.loadOntologyFromOntologyDocument(owlFile.getInputStream()); }
private OWLOntology createOntology() throws OWLOntologyCreationException, IOException { // Set up the ontology here and hide its manager - the test needs to use a different ontology manager on reconstitution OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); Resource owlFile = new ClassPathResource("/org/dllearner/kb/owl-api-ontology-data.owl"); return manager.loadOntologyFromOntologyDocument(owlFile.getInputStream()); }
public OWLGenericTools(final OWLGroup group, final String ontology, final boolean isVolatile) throws Exception { _group = group; _ontology = (isVolatile ? _group.getVolatileManager() : _group.getPersistentManager()).loadOntologyFromOntologyDocument(new StringDocumentSource(ontology)); _isVolatile = isVolatile; OWLHelper.setFormat(_ontology); }
public OWLGenericTools(final OWLGroup group, final String ontology, final boolean isVolatile) throws Exception { _group = group; _ontology = (isVolatile ? _group.getVolatileManager() : _group.getPersistentManager()).loadOntologyFromOntologyDocument(new StringDocumentSource(ontology)); _isVolatile = isVolatile; OWLHelper.setFormat(_ontology); }
public LUBM50Tests() throws Exception { manager = OWLManager.createOWLOntologyManager(); ontology = manager.loadOntologyFromOntologyDocument(new File(owlfile)); source = fac.getDataSource(URI.create("http://www.obda.org/ABOXDUMP1testx1")); source.setParameter(RDBMSourceParameterConstants.DATABASE_DRIVER, driver); source.setParameter(RDBMSourceParameterConstants.DATABASE_PASSWORD, password); source.setParameter(RDBMSourceParameterConstants.DATABASE_URL, url); source.setParameter(RDBMSourceParameterConstants.DATABASE_USERNAME, username); source.setParameter(RDBMSourceParameterConstants.IS_IN_MEMORY, "false"); source.setParameter(RDBMSourceParameterConstants.USE_DATASOURCE_FOR_ABOXDUMP, "true"); }
public static void main(String[] args) throws Exception { String solrServerURL = "http://solr.aksw.org/en_dbpedia_resources/"; String searchField = "comment"; OWLOntology ontology = OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument(new File("src/test/resources/org/dllearner/algorithms/isle/dbpedia_3.9.owl")); SolrSyntacticIndex index = new SolrSyntacticIndex(ontology, solrServerURL, searchField); index.loadCache(new File("entity_frequencies.obj")); OWLDataFactory df = new OWLDataFactoryImpl(); long n = index.getNumberOfDocumentsFor(df.getOWLClass(IRI.create("http://dbpedia.org/ontology/Comics"))); System.out.println(n); n = index.getNumberOfDocumentsFor(df.getOWLClass(IRI.create("http://dbpedia.org/ontology/Comics")), df.getOWLObjectProperty(IRI.create("http://dbpedia.org/ontology/largestCity"))); System.out.println(n); }
public OntologyLoader(String ontologyName, File ontologyFile) throws OWLOntologyCreationException { this.ontologyFile = ontologyFile; this.manager = OWLManager.createOWLOntologyManager(); this.factory = manager.getOWLDataFactory(); this.ontologyName = ontologyName; this.ontology = manager.loadOntologyFromOntologyDocument(ontologyFile); this.ontologyIRI = ontology.getOntologyID().getOntologyIRI().toString(); }
public OWLOntology importRawProjectSources(RawProjectSources projectSources) throws OWLOntologyCreationException { try { manager.addIRIMapper(projectSources.getOntologyIRIMapper()); OWLOntology ontology = null; for (OWLOntologyDocumentSource documentSource : projectSources.getDocumentSources()) { ontology = manager.loadOntologyFromOntologyDocument(documentSource, loaderConfig); } return ontology; } finally { manager.removeIRIMapper(projectSources.getOntologyIRIMapper()); } }
@Override public OWLOntology reloadOntology(OWLOntology ontology) throws OWLOntologyCreationException { URI physicalLocation = getOWLOntologyManager().getOntologyDocumentIRI(ontology).toURI(); mngr.removeOntology(ontology); OWLOntology ont = mngr.loadOntologyFromOntologyDocument(IRI.create(physicalLocation)); resetRootImports(); clear(); return ont; }