查询本体时的异常

时间:2011-04-14 10:04:27

标签: semantics sparql jena

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:在第12行第8列遇到“”?weight“”。 期待以下之一:       ...      ...      ...     “存在”......      

1 个答案:

答案 0 :(得分:1)

您需要围绕过滤器表达式使用括​​号:

FILTER (?weight > ?uraniumWeight)