int i = 0;
// result order is defined...
if (resultOrder != null && resultOrder.size() > 0) {
for (final String s : resultOrder) {
if (variables.contains(new Variable(s))) {
tableHead[i++] = "?" + s;
}
}
} else {
// result order is not defined...
for (final Variable v : variables) {
tableHead[i++] = v.toString();
}
}
// --- generate table head - end ---
// --- generate table rows - begin ---
final Object[][] rows = new Object[qr.size()][];
i = 0;
for (final Bindings ba : qr) {
final Object[] row = new Object[variables.size()];
int j = 0;
// result order is defined...
if (resultOrder != null && resultOrder.size() > 0) {
for (final String s : resultOrder) {
if (variables.contains(new Variable(s))) {
final Literal literal = ba.get(new Variable(s));
String value = "";
if (literal != null) {
value = literal.toString(prefixInstance);
}