为什么我不能创建本体?

问题描述 投票:0回答:1

我目前正在开始使用OWL。我相信我已经为OWL API设置了正确的.jar。但是,当我编译代码时,我得到一个错误:

OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

错误说:

cannot access com.google.inject.Provider 
class file for com.google.inject.Provider not found

关于可能导致问题的任何想法?

java owl protege owl-api
1个回答
3
投票

如果您使用pom,请确保使用正确的依赖关系,如here所示。

<dependency>
    <groupId>net.sourceforge.owlapi</groupId>
    <artifactId>owlapi-distribution</artifactId>
    <version>5.1.0</version>
</dependency>

如果你使用jar文件,正如你写的那样,所以可以肯定的是,你添加它正确写成here

之后,请确保您在班级中导入了正确的包。此外,请确保您下载了所有需要的内容,例如that

对于问题的起始行,您需要导入

import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.OWLOntologyManager;

更好的是,尝试使用maven,就像写成here一样

© www.soinside.com 2019 - 2024. All rights reserved.