如果我想通過Netbeans在Sesame存儲庫中執行SPARQL SELECT查詢,我使用以下代碼(並在綁定集中獲得三個值)。我怎樣才能做一個只返回一個布爾值的ASK查詢?如何執行ASK查詢?
TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
TupleQueryResult result = tupleQuery.evaluate();
List<String> bindingNames = result.getBindingNames();
try {
while (result.hasNext()) {
BindingSet bindingSet = result.next();
Value firstValue1 = bindingSet.getValue(bindingNames.get(0));
Value firstValue2 = bindingSet.getValue(bindingNames.get(1));
Value firstValue3 = bindingSet.getValue(bindingNames.get(2));
}
}
代碼還要求,在http://answers.semanticweb.com/questions/24793/how-to-perfom-sparql-ask-query-in-sesame-回答repository-through-netbeans –