use of org.apache.jena.sparql.serializer.FormatterElement in project jena by apache.
the class UpdateWriterVisitor method visit.
@Override
public void visit(UpdateModify update) {
out.ensureStartOfLine();
if (update.getWithIRI() != null) {
//out.ensureStartOfLine() ;
out.print("WITH ");
output(update.getWithIRI());
}
if (update.hasDeleteClause()) {
List<Quad> deleteQuads = update.getDeleteQuads();
out.ensureStartOfLine();
out.print("DELETE ");
outputQuadsBraced(deleteQuads);
}
if (update.hasInsertClause()) {
List<Quad> insertQuads = update.getInsertQuads();
out.ensureStartOfLine();
out.print("INSERT ");
outputQuadsBraced(insertQuads);
}
if (!update.hasInsertClause() && !update.hasDeleteClause()) {
// Fake a clause to make it legal syntax.
out.ensureStartOfLine();
out.println("INSERT { }");
}
for (Node x : update.getUsing()) {
out.ensureStartOfLine();
out.print("USING ");
output(x);
}
for (Node x : update.getUsingNamed()) {
out.ensureStartOfLine();
out.print("USING NAMED ");
output(x);
}
Element el = update.getWherePattern();
out.ensureStartOfLine();
out.print("WHERE");
out.incIndent(BLOCK_INDENT);
out.newline();
if (el != null) {
FormatterElement fmtElement = prepareElementFormatter();
fmtElement.visitAsGroup(el);
} else
out.print("{}");
out.decIndent(BLOCK_INDENT);
}
Aggregations