简体   繁体   English

使用OWL API从本体文档加载本体

[英]load ontology from ontology document using OWL API

I downloaded OWL API maven project and opened OWL API Default Implementation. 我下载了OWL API maven项目并打开了OWL API默认实现。 I just want to load an ontology but it gives me an error. 我只想加载一个本体,但这给了我一个错误。

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);
}

The output is: 输出为:

        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

How can I fix this? 我怎样才能解决这个问题? I tried this and it's not working. 我尝试了这个,但是没有用。

File file = new File("pizza3.owl");
OWLOntology ontology = managerImpl.loadOntologyFromOntologyDocument(file);

The manager you created needs setup. 您创建的经理需要设置。

The recommended way is through OWLManager, in the apibinding module. 推荐的方法是通过apibinding模块中的OWLManager。

The recommended dependencies to use are the distribution or osgidistribution modules. 建议使用的依赖项是分发或osgidistribution模块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM