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(); }
@Override protected void details(IndentedWriter out, SerializationContext sCxt) { out.println(Utils.className(this)); out.incIndent(); op.output(out, sCxt); out.decIndent(); }
private void outputQuadsBraced(List<Quad> quads) { if (quads.size() == 0) { out.print("{ }"); return; } out.println("{"); outputQuads(quads); out.print("}"); }
private void outputQuad(Quad quad) { String qs = FmtUtils.stringForQuad(quad, sCxt.getPrefixMapping()); if (quad.getGraph() != null) { String g = FmtUtils.stringForNode(quad.getGraph(), sCxt); out.print(g); out.print(" "); } outputTripleOfQuad(quad); out.println(" ."); }
// 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); }
public static void output(UpdateRequest request, IndentedWriter out, SerializationContext sCxt) { if (sCxt == null) sCxt = new SerializationContext(request); prologue(out, sCxt.getPrologue()); boolean addSeparator = (request.getOperations().size() > 1); boolean first = true; for (Update update : request.getOperations()) { out.ensureStartOfLine(); if (!first) out.println(); first = false; outputUpdate(update, out, sCxt); if (addSeparator) out.print(" ;"); } // Update requests always end in newline. out.ensureStartOfLine(); out.flush(); }
protected void details(IndentedWriter out, SerializationContext sCxt) { out.println(Utils.className(this)); }
public void visit(UpdateDeleteWhere update) { out.ensureStartOfLine(); out.println("DELETE WHERE "); outputQuadsBraced(update.getQuads()); }