use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class AggGroupConcat method asSparqlExpr.
protected static String asSparqlExpr(boolean isDistinct, String separator, ExprList exprs, SerializationContext sCxt) {
IndentedLineBuffer x = new IndentedLineBuffer();
x.append("GROUP_CONCAT(");
if (isDistinct)
x.append("DISTINCT ");
ExprUtils.fmtSPARQL(x, exprs, sCxt);
if (separator != null) {
x.append(" ; separator=");
String y = StrUtils.escapeString(separator);
x.append("'");
x.append(y);
x.append("'");
}
x.append(")");
return x.asString();
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class AggregatorBase method asSparqlExpr.
@Override
public String asSparqlExpr(SerializationContext sCxt) {
IndentedLineBuffer x = new IndentedLineBuffer();
x.append(getName());
x.append("(");
if (isDistinct)
x.append("DISTINCT ");
if (getExprList() != null)
ExprUtils.fmtSPARQL(x, getExprList(), sCxt);
x.append(")");
return x.asString();
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class TestSerialization method runTestWorker.
protected void runTestWorker(Query query, Syntax syntax) {
IndentedLineBuffer buff = new IndentedLineBuffer();
query.serialize(buff, syntax);
String baseURI = null;
if (!query.explicitlySetBaseURI())
// Not in query - use the same one (e.g. file read from) .
baseURI = query.getBaseURI();
try {
QueryUtils.checkParse(query);
} catch (RuntimeException ex) {
System.err.println("**** Test: " + getName());
System.err.println("** " + ex.getMessage());
System.err.println(query);
throw ex;
}
try {
QueryUtils.checkOp(query, true);
} catch (SSEParseException ex) {
System.err.println("**** Test: " + getName());
System.err.println("** Algebra error: " + ex.getMessage());
}
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class QueryValidatorJSON method string.
private static String string(Query query, Op op) {
final SerializationContext sCxt = new SerializationContext(query);
IndentedLineBuffer out = new IndentedLineBuffer();
op.output(out, sCxt);
return out.asString();
}
use of org.apache.jena.atlas.io.IndentedLineBuffer in project jena by apache.
the class QueryValidatorJSON method formatted.
private static void formatted(JsonBuilder obj, Query query) {
IndentedLineBuffer out = new IndentedLineBuffer();
query.serialize(out);
obj.key(jFormatted).value(out.asString());
}
Aggregations