// Do better
  @Override
  public void output(IndentedWriter out, SerializationContext sCxt) {
    // Linear form.
    getInput().output(out, sCxt);
    out.ensureStartOfLine();
    details(out, sCxt);
    out.ensureStartOfLine();

    //        details(out, sCxt) ;
    //        out.ensureStartOfLine() ;
    //        out.incIndent() ;
    //        getInput().output(out, sCxt) ;
    //        out.decIndent() ;
    //        out.ensureStartOfLine() ;
  }
Esempio n. 2
0
    private void visitDropClear(String name, UpdateDropClear update) {
      out.ensureStartOfLine();
      out.print(name);
      out.print(" ");
      if (update.isSilent()) out.print("SILENT ");

      printTarget(update.getTarget());
    }
Esempio n. 3
0
    public void visit(UpdateCreate update) {
      out.ensureStartOfLine();
      out.print("CREATE");
      out.print(" ");
      if (update.isSilent()) out.print("SILENT ");

      String s = FmtUtils.stringForNode(update.getGraph(), sCxt);
      out.print(s);
    }
Esempio n. 4
0
  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();
  }
Esempio n. 5
0
    public void visit(UpdateLoad update) {
      out.ensureStartOfLine();
      out.print("LOAD");
      out.print(" ");
      if (update.getSilent()) out.print("SILENT ");

      outputStringAsURI(update.getSource());

      if (update.getDest() != null) {
        out.print(" INTO GRAPH ");
        output(update.getDest());
      }
    }
Esempio n. 6
0
    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);
    }
Esempio n. 7
0
 public void visit(UpdateDeleteWhere update) {
   out.ensureStartOfLine();
   out.println("DELETE WHERE ");
   outputQuadsBraced(update.getQuads());
 }
Esempio n. 8
0
 public void visit(UpdateDataDelete update) {
   out.ensureStartOfLine();
   out.print("DELETE DATA ");
   outputQuadsBraced(update.getQuads());
 }
Esempio n. 9
0
 public void visit(UpdateDataInsert update) {
   out.ensureStartOfLine();
   out.print("INSERT DATA ");
   outputQuadsBraced(update.getQuads());
 }