简体   繁体   English

ReasonerFactory找不到符号OWLAPI

[英]ReasonerFactory cannot find a symbol OWLAPI

This is my pom file 这是我的pom文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany</groupId>
    <artifactId>mavenproject2</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>net.sourceforge.owlapi</groupId>
            <artifactId>owlapi-distribution</artifactId>
            <version>5.1.0</version>
        </dependency>
        <dependency> 
            <groupId>net.sourceforge.owlapi</groupId> 
            <artifactId>org.semanticweb.hermit</artifactId>
            <version>1.3.8.500</version>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>

I just want to make simple examples like this: 我只想举这样的简单例子:

    OWLOntology o = manager.loadOntologyFromOntologyDocument(file);
    System.out.println("--------------------------");
    OWLReasonerFactory rf = new ReasonerFactory();
    OWLReasoner r = rf.createReasoner(o);
    r.precomputeInferences(InferenceType.CLASS_HIERARCHY);

But ReasonerFactory is not recognized by the system. 但是ReasonerFactory无法被系统识别。 I downloaded the jar file, installed maven, opened a netbeans project using a maven project. 我下载了jar文件,安装了maven,并使用maven项目打开了一个netbeans项目。 Why it doesn't works?? 为什么它不起作用?

Use OWLAPI version 5.1.7 and HermiT version 1.4.3.517. 使用OWLAPI版本5.1.7和HermiT版本1.4.3.517。

The problem here is that in the version you used ReasonerFactory is an inner class in the Reasoner class, but your test code relies on it being a standalone class. 这里的问题在于,在您使用的版本中, ReasonerFactoryReasoner类中的内部类,但是您的测试代码依赖于它是独立类。 That happened in a later version of HermiT. 那是在更高版本的HermiT中发生的。

1.4.3.517 is the most recent release and includes a few bug fixes, hence I recommend using it in place of all the other OWLAPI 5 compatible versions. 1.4.3.517是最新版本,并包含一些错误修复,因此,我建议使用它代替所有其他OWLAPI 5兼容版本。

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

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