查询本体时出现异常

发布于 2024-11-01 23:27:59 字数 950 浏览 4 评论 0原文

QUERY=" PREFIX table: <http://www.daml.org/2003/01/periodictable/PeriodicTable#> \n"+
            "SELECT ?name ?symbol ?weight ?number \n"+
            "FROM <http://www.daml.org/2003/01/periodictable/PeriodicTable.owl> \n" +
            "WHERE \n" +
            "{ \n"+
            "?uranium table:name \"uranium\". \n"+
            "?uranium table:atomicWeight ?uraniumWeight. \n"+
            "?element table:name ?name. \n"+
            "?element table:symbol ?symbol. \n" +
            "?element table:atomicWeight ?weight. \n" +
            "?element table:atomicNumber ?number. \n" +
            "FILTER ?weight > ?uraniumWeight. \n" +
            "} \n"+
            "ORDER BY ASC[?weight] ";

我在查询periodicTable本体时遇到以下异常异常

线程“AWT-EventQueue-0”com.hp.hpl.jena.query.QueryParseException中的异常:在行遇到“”?weight“” 12,第 8 栏。 期待其中之一: ... ... ... “存在”... 。

QUERY=" PREFIX table: <http://www.daml.org/2003/01/periodictable/PeriodicTable#> \n"+
            "SELECT ?name ?symbol ?weight ?number \n"+
            "FROM <http://www.daml.org/2003/01/periodictable/PeriodicTable.owl> \n" +
            "WHERE \n" +
            "{ \n"+
            "?uranium table:name \"uranium\". \n"+
            "?uranium table:atomicWeight ?uraniumWeight. \n"+
            "?element table:name ?name. \n"+
            "?element table:symbol ?symbol. \n" +
            "?element table:atomicWeight ?weight. \n" +
            "?element table:atomicNumber ?number. \n" +
            "FILTER ?weight > ?uraniumWeight. \n" +
            "} \n"+
            "ORDER BY ASC[?weight] ";

I am getting the following Exception while querying the periodicTable ontology Exception

Exception in thread "AWT-EventQueue-0" com.hp.hpl.jena.query.QueryParseException: Encountered " "?weight "" at line 12, column 8.
Was expecting one of:
...
...
...
"exists" ...
.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尛丟丟 2024-11-08 23:27:59

您需要在过滤器表达式两边加上括号:

FILTER (?weight > ?uraniumWeight)

You need parentheses around the filter expression:

FILTER (?weight > ?uraniumWeight)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文