Object val = resultset.getObject(var);
if (val == null)
continue;
// xsd:strings are just annoying...
Node nodeVal;
if (val instanceof String)
nodeVal = Node.createLiteral((String) val);
else
{
LiteralLabel ll = new LiteralLabel(val);
nodeVal = Node.createLiteral(ll);
}
binding.put(var, nodeVal);
}
for (Node subject: pattern.getSubjects()) // bind subjects
{
if (subject.isConcrete()) continue; // nothing to do...
Table table = pattern.getTableForSubject(subject);
if (!table.hasPrimaryKeys()) // No row -> bnode mapping possible
{
binding.put(subject.getName(), Node.createAnon());
}
else
{
Map<String, Object> attvals = new HashMap<String, Object>();
for (Col col: table.getPrimaryCols())
{
Object value = resultset.getObject(subject.getName() + "$" + col.getName() + "$prim");
attvals.put(col.getName(), value);
}
Node node = table.keysToNode(attvals);
binding.put(subject.getName(), node);
}
}