0

我在 Eclipse 3.4、Jsf 1.2、java 1.7、tomcat 7 和 owl api 4.0 中有一个动态 Web 项目。我在 java 的支持 bean 中使用示例代码。此代码在 Java 应用程序中运行顺利,但在 JSF 项目中使用并在 tomcat 7 服务器上运行时会产生错误。

代码片段如下:-

OWLOntologyWalkerVisitor<Object> visitor = new OWLOntologyWalkerVisitor<Object>(
            walker) {
            @Override
            public Object visit(OWLObjectSomeValuesFrom desc) {
            // Print out the restriction
            System.out.println(desc);
            // Print out the axiom where the restriction is used
            System.out.println(" " + getCurrentAxiom());
            System.out.println();
            // We don't need to return anything here.
            return null;
            }
            };
            // Now ask the walker to walk over the ontology structure using our
            // visitor instance.
            walker.walkStructure(visitor);

而它产生的错误是: -

 The type OWLOntologyWalkerVisitor is not generic; it cannot be parameterized with arguments<Object>  

任何线索为什么会发生这种情况?

4

1 回答 1

2

您链接的示例代码适用于 owlapi 3.5(主分支)。正确的示例在 version4 分支中 - 抱歉,可能一些文档链接已过时。

编辑:版本 4 Examples.java 在这里: https ://github.com/owlcs/owlapi/blob/version4/contract/src/test/java/org/semanticweb/owlapi/examples/Examples.java

https://github.com/owlcs/owlapi/wiki/Documentation

于 2014-09-30T17:48:29.867 回答