我下载了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);
答案 0 :(得分:0)
您创建的经理需要设置。
推荐的方法是通过OFLManager,在apibinding模块中。
建议使用的依赖项是分发或osgidistribution模块。