I have seen that good old org.openrdf.query.BindingSet
has been wraped/replaced by com.stardog.stark.query.BindingSet
in Stardog 6.
I used to do something similar to:
TupleQueryResult qResult = query.execute()) {
while (qResult.hasNext()) {
BindingSet bindingSet = qResult.next();
// Check first if getValue() is not null or face NullPointer
String val = bindingSet.getValue("label").stringValue()
....
Now it seems I can do something similar:
String val = bindingSet.get("label").toString()
But this is now giving me additional datatype information, such as: ^^<http://www.w3.org/2001/XMLSchema#date>
My questions are:
- Is what I am doing the most efficient way to get the results from a query?
- How can I simply get the value, with no associated datatype, as I used to?
(By the way, the latest DOCs are outdated, they still use TupleQueryResult
)
EDIT:
I have found a way for the second question, although I'm not sure this is the right way:
String val = bindingSet.literal("label").get().label()