简体   繁体   English

OWL API入门

[英]Getting started with OWL API

Post-Answer Edit: This was an issue that arose primarily due to IDE issues. 答案后编辑:这是主要由于IDE问题引起的一个问题。 This is more likely to be useful if you are new to eclipse, or java programming in general while also learning about OWL. 如果您不熟悉eclipse或一般的Java编程,同时也了解OWL,这可能会很有用。

I am very new to OWL in general, and need to familiarize myself with the OWL API for a project I am working on. 总体而言,我对OWL并不陌生,需要熟悉我正在从事的项目的OWL API。 I am a bit rusty on my java, so maybe my issue is there, though I do not think so. 我对Java有点生疏,所以也许我的问题在那里,尽管我不这么认为。

Issue: I have been playing with OWL API for several days and am having trouble finding compatible versions of libraries necessary to do ANYTHING. 问题:我已经使用OWL API已有几天了,无法找到执行任何操作所需的兼容版本的库。 Here is some example code of a very basic operation I am trying to perform: 这是我尝试执行的一些非常基本的操作的示例代码:

package converter;

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

public class OWL_Converter {

    OWLOntologyManager m = OWLManager.createOWLOntologyManager();
}

This throws exactly 11,362 errors for me when I try to build in eclipse. 当我尝试构建eclipse时,这为我抛出了11,362个错误。 The first 50 or so of these errors say things like "AbstractAnnotatedAxiomRoundTrippingTestCase cannot be resolved to a type". 这些错误中的前50个左右说“诸如AbstractAnnotatedAxiomRoundTrippingTestCase无法解析为类型”之类的事情。 Please someone help me figure out what I am doing wrong. 请有人帮我弄清楚我在做什么错。 I have been messing around with OWL and OWL api for the past three days with very slow progress, and now I am hitting walls like this where it seems that no matter how many of the OWL api classes I import, I still have unresolved types from indirect references of classes, etc... 在过去的三天里,我一直在处理OWL和OWL api,进展非常缓慢,现在我遇到了这样的麻烦,无论我导入了多少OWL api类,我仍然有来自以下类型的未解析类型类的间接引用,等等。

The stack trace appears as below: 堆栈跟踪如下所示:

Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException
    at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:189)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221)
    at org.semanticweb.owlapi.OWLAPIServiceLoaderModule.<clinit>(OWLAPIServiceLoaderModule.java:50)
    at org.semanticweb.owlapi.apibinding.OWLManager.<clinit>(OWLManager.java:42)
    at owl_converter.Converter.main(Converter.java:115)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.joran.spi.JoranException
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 9 more

Are you compiling the OWL API source? 您在编译OWL API源代码吗? You can skip having to fill in all dependencies manually in two ways: 您可以通过以下两种方式跳过不必手动填写所有依赖项的情况:

  • import existing maven project in Eclipse (this will use the pom files to determined dependencies) 在Eclipse中导入现有的Maven项目(这将使用pom文件确定依赖项)

  • look at the classpath files in the antbuild folder and make sure your .classpath file matches. 查看antbuild文件夹中的classpath文件,并确保您的.classpath文件匹配。

You might need to do a maven test build to ensure the libraries are downloaded. 您可能需要进行Maven测试,以确保已下载库。

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

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