if (!triples.isEmpty()) {
logger.trace("triples={}", triples);
}
}
for (final RDFTriple triple : triples) {
RDFTriple tripleToRender = triple;
RDFResourceBlankNode remappedNode = null;
if (triplesWithRemappedNodes != null) {
remappedNode = triplesWithRemappedNodes.get(tripleToRender);
}
if (remappedNode != null) {
tripleToRender = new RDFTriple(tripleToRender.getSubject(),
tripleToRender.getPredicate(), remappedNode);
}
if (!node.equals(tripleToRender.getSubject())) {
// the node will not match the triple subject if the node itself
// is a remapped blank node
// in which case the triple subject needs remapping as well
tripleToRender = new RDFTriple(node,
tripleToRender.getPredicate(),
tripleToRender.getObject());
}
try {
if (!renderedStatements.contains(tripleToRender)) {
renderedStatements.add(tripleToRender);
// then we go back and get context-sensitive statements and
// actually pass those to the RDFHandler
for (Statement statement : RioUtils.tripleAsStatements(
tripleToRender, contexts)) {
writer.handleStatement(statement);
if (tripleToRender.getObject() instanceof RDFResource) {
render((RDFResource) tripleToRender.getObject());
}
}
} else if (logger.isTraceEnabled()) {
logger.trace(
"not printing duplicate statement, or recursing on its object: {}",