查询本体时异常

问题描述

|
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] \";
查询periodTable本体异常时出现以下异常 线程\“ AWT-EventQueue-0 \” com.hp.hpl.jena.query.QueryParseException中的异常:在第12行第8列遇到了\“ \”?weight \“ \” 期望以下之一:       ...      ...      ...     \“存在\” ...      。     

解决方法

您需要在过滤器表达式周围加上括号:
FILTER (?weight > ?uraniumWeight)
    

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...