我下载了OWL API maven项目并打开OWL API默认实现。我只想加载一个本体,但它给了我一个错误。
public static final IRI example_iri2 = IRI.create("http://mged.sourceforge.net/ontologies/MGEDOntology.owl");
public static void main(String[] arg) throws OWLOntologyCreationException {
OWLDataFactoryImpl factoryImpl = new OWLDataFactoryImpl();
ReadWriteLock readWriteLock = new NoOpReadWriteLock();
OWLOntologyManagerImpl managerImpl = new OWLOntologyManagerImpl(factoryImpl, readWriteLock);
OWLOntology ontology = managerImpl.loadOntology(example_iri2);
}输出为:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" org.semanticweb.owlapi.model.OWLOntologyFactoryNotFoundException: Could not find an appropriate factory to load ontology from ontology document: <http://mged.sourceforge.net/ontologies/MGEDOntology.owl>
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:1048)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:935)
at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.loadOntology(OWLOntologyManagerImpl.java:891)
at com.main.main.main(main.java:33)
------------------------------------------------------------------------
BUILD FAILURE我该如何解决这个问题呢?我试过了,但不起作用。
File file = new File("pizza3.owl");
OWLOntology ontology = managerImpl.loadOntologyFromOntologyDocument(file);发布于 2016-08-15 19:08:54
您创建的管理器需要设置。
推荐的方式是通过apibinding模块中的OWLManager。
推荐使用的依赖项是发行版或osgidistribution模块。
https://stackoverflow.com/questions/38943621
复制相似问题