use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class ExprUtils method fmtSPARQL.
public static String fmtSPARQL(Expr expr) {
IndentedLineBuffer buff = new IndentedLineBuffer();
fmtSPARQL(buff, expr);
return buff.toString();
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class uparse method execOne.
private void execOne(String updateString, Syntax syntax) {
UpdateRequest req;
try {
req = UpdateFactory.create(updateString, syntax);
} catch (QueryParseException ex) {
System.err.print("Parse error: ");
System.err.println(ex.getMessage());
return;
}
//req.output(IndentedWriter.stderr) ;
if (printUpdate)
System.out.print(req);
if (printNone)
return;
// And some checking.
IndentedLineBuffer w = new IndentedLineBuffer();
UpdateWriter.output(req, w);
String updateString2 = w.asString();
UpdateRequest req2 = null;
try {
req2 = UpdateFactory.create(updateString2, syntax);
} catch (QueryParseException ex) {
System.err.println("Can not reparse update after serialization");
System.err.println(updateString2);
}
if (!req.equalTo(req2))
System.err.println("Reparsed update does not .equalTo original parsed request");
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class MgtFunctions method prefixes.
/** Return prefixes for the datasets, SPARQL syntax. */
public static String prefixes(HttpServletRequest request) {
String dsName = dataset(request);
DatasetRef desc = getFromRegistry(dsName);
if (desc == null)
return "<not found>";
DatasetGraph dsg = desc.dataset;
if (dsg instanceof DatasetGraphTDB) {
PrefixMapping pmap = ((DatasetGraphTDB) dsg).getPrefixes().getPrefixMapping();
Prologue prologue = new Prologue(pmap);
IndentedLineBuffer buff = new IndentedLineBuffer();
PrologueSerializer.output(buff, prologue);
buff.append("\n");
return buff.asString();
}
return "";
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class SqlExprBase method asSQL.
public static String asSQL(SqlExpr expr) {
IndentedLineBuffer buff = new IndentedLineBuffer();
SqlExprVisitor v = new SqlExprGenerateSQL(buff);
expr.visit(v);
return buff.toString();
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class TableFinder method toString.
@Override
public String toString() {
IndentedLineBuffer buff = new IndentedLineBuffer();
output(buff, true);
return buff.asString();
}
Aggregations