void WriteGraph(RdfGraph graph, RdfSourceWrapper sourcewrapper, StatementSink sink)
{
if (sink is RdfWriter)
((RdfWriter)sink).Namespaces.AddFrom(GetQueryPrefixes());
java.util.Iterator iter = graph.iterator();
while (iter.hasNext()) {
GraphStatement stmt = (GraphStatement)iter.next();
Statement s;
if (stmt is GraphStatementWrapper) {
s = ((GraphStatementWrapper)stmt).s;
} else {
s = new Statement(
sourcewrapper.ToEntity(stmt.getSubject()),
sourcewrapper.ToEntity(stmt.getPredicate()),
sourcewrapper.ToResource(stmt.getObject()),
stmt.getGraphName() == null ? Statement.DefaultMeta : sourcewrapper.ToEntity(stmt.getGraphName()));
}
if (s.AnyNull) continue; // unbound variable, or literal in bad position
sink.Add(s);
}
}