@Override protected void details(IndentedWriter out, SerializationContext sCxt) { out.println(Utils.className(this)); out.incIndent(); op.output(out, sCxt); out.decIndent(); }
public void printSSE(PrintStream ps) { IndentedWriter out = new IndentedWriter(ps); out.println("(stats"); out.incIndent(); for (Pattern p : patterns) { p.output(out); out.println(); } out.decIndent(); out.println(")"); out.flush(); }
// Do better @Override public void output(IndentedWriter out, SerializationContext sCxt) { out.println(Utils.className(this)); out.incIndent(); out.print(Plan.startMarker); out.incIndent(); getLeft().output(out, sCxt); out.decIndent(); // out.ensureStartOfLine() ; out.println(Plan.finishMarker); out.print(Plan.startMarker); out.incIndent(); getRight().output(out, sCxt); out.decIndent(); // out.ensureStartOfLine() ; out.println(Plan.finishMarker); out.decIndent(); }
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 = new FormatterElement(out, sCxt); fmtElement.visitAsGroup(el); } else out.print("{}"); out.decIndent(BLOCK_INDENT); }
private void outputQuads(List<Quad> quads) { out.incIndent(BLOCK_INDENT); Node g = Quad.tripleInQuad; boolean inBlock = false; for (Quad q : quads) { if (q.getGraph() != g) { // New graph (default or named) if (inBlock) { // In named - end it. out.decIndent(BLOCK_INDENT); out.println("}"); inBlock = false; } g = q.getGraph(); // Start new block. // Two cases for no braces: // Quad.tripleInQuad and Quad.defaultGraphNodeGenerated ; if (!q.isTriple() && !q.isDefaultGraphGenerated()) { out.print("GRAPH "); output(g); out.println(" {"); out.incIndent(BLOCK_INDENT); inBlock = true; } } outputTripleOfQuad(q); out.println(" ."); } if (inBlock) { out.decIndent(BLOCK_INDENT); out.println("}"); inBlock = false; } out.decIndent(BLOCK_INDENT); }