gpt4 book ai didi

java - 处理dl查询中的数据值限制

转载 作者:行者123 更新时间:2023-12-01 14:50:46 25 4
gpt4 key购买 nike

我正在尝试使用 OWL API 运行 DL 查询,使用 DL 查询示例 ( http://sourceforge.net/p/owlapi/code/ci/aef6981535f07a2d0d44c394b9f4d5415f36025a/tree/contract/src/test/java/org/coode/owlapi/examples/DLQueryExample.java )

hasExperience some(Experience 和 hasYearsOfExperience some int[>=1])

它运行良好并在 Protege 中显示预期结果,但在 Java 中返回以下错误:

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Prefix not registered for prefix name: :
at org.semanticweb.owlapi.util.DefaultPrefixManager.getIRI(DefaultPrefixManager.java:199)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.getIRI(ManchesterOWLSyntaxEditorParser.java:3112)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.getOWLDatatype(ManchesterOWLSyntaxEditorParser.java:563)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseDataRangePrimary(ManchesterOWLSyntaxEditorParser.java:1032)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseDataUnionOf(ManchesterOWLSyntaxEditorParser.java:1013)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseDataIntersectionOf(ManchesterOWLSyntaxEditorParser.java:995)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseDataRange(ManchesterOWLSyntaxEditorParser.java:988)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseDataRestriction(ManchesterOWLSyntaxEditorParser.java:908)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseNonNaryClassExpression(ManchesterOWLSyntaxEditorParser.java:787)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseUnion(ManchesterOWLSyntaxEditorParser.java:688)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseIntersection(ManchesterOWLSyntaxEditorParser.java:663)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseNestedClassExpression(ManchesterOWLSyntaxEditorParser.java:1212)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseObjectRestriction(ManchesterOWLSyntaxEditorParser.java:819)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseNonNaryClassExpression(ManchesterOWLSyntaxEditorParser.java:783)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseUnion(ManchesterOWLSyntaxEditorParser.java:688)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseIntersection(ManchesterOWLSyntaxEditorParser.java:663)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseNestedClassExpression(ManchesterOWLSyntaxEditorParser.java:1212)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseObjectRestriction(ManchesterOWLSyntaxEditorParser.java:819)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseNonNaryClassExpression(ManchesterOWLSyntaxEditorParser.java:783)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseUnion(ManchesterOWLSyntaxEditorParser.java:688)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseIntersection(ManchesterOWLSyntaxEditorParser.java:663)
at org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser.parseClassExpression(ManchesterOWLSyntaxEditorParser.java:650)
at org.coode.owlapi.examples.DLQueryParser.parseClassExpression(DLQueryManager.java:413)
at org.coode.owlapi.examples.DLQueryEngine.getInstances(DLQueryManager.java:324)
at org.coode.owlapi.examples.DLQueryManager.getInstances(DLQueryManager.java:127)

有什么想法可以解决这个问题吗?

最佳答案

问题似乎来自处理前缀的方式,而不是来自 DL 查询。

确保您的默认前缀存在:您可以在 .owl 文件的顶部查看声明的前缀映射。

在你的代码中你也应该有类似的东西:

String base = "http://example.com/";
PrefixManager pm = new DefaultPrefixManager(base);

您还可以查看 documentation以了解有关前缀的更多信息。

关于java - 处理dl查询中的数据值限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14884319/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com