{
bNodesMap = new HashMap();
factory = getValueFactory();
}
StatementIterator iter = graph.getStatements();
while (iter.hasNext())
{
Statement st = iter.next();
Resource subject = st.getSubject();
URI predicate = st.getPredicate();
Value object = st.getObject();
if (!joinBlankNodes)
{
if (subject instanceof BNode)
{
String bNodeId = ((BNode)subject).getID();
if (bNodesMap.containsKey(bNodeId))
{
subject = (Resource)bNodesMap.get(bNodeId);
}
else
{
subject = factory.createBNode();
// bNodesMap.put(bNodeId, subject);
}
}
if (object instanceof BNode)
{
String bNodeId = ((BNode)object).getID();
if (bNodesMap.containsKey(bNodeId))
{
object = (Resource)bNodesMap.get(bNodeId);
}
else
{
object = factory.createBNode();
}
}
}
addSingleStatement(subject, predicate, object);
}
iter.close();
}