Search in sources :

Example 6 with SerializationContext

use of org.apache.jena.sparql.serializer.SerializationContext in project jena by apache.

the class QueryOutputUtils method printPlan.

// ModQueryOut
public static void printPlan(Query query, QueryExecution qe) {
    QueryEngineFactory f = QueryEngineRegistry.findFactory(query, qe.getDataset().asDatasetGraph(), ARQ.getContext());
    if (f == null)
        System.err.println("printPlan: Unknown engine type: " + Lib.className(qe));
    Plan plan = f.create(query, qe.getDataset().asDatasetGraph(), BindingRoot.create(), ARQ.getContext());
    SerializationContext sCxt = new SerializationContext(query);
    IndentedWriter out = IndentedWriter.stdout;
    plan.output(out, sCxt);
    out.flush();
}
Also used : SerializationContext(org.apache.jena.sparql.serializer.SerializationContext) IndentedWriter(org.apache.jena.atlas.io.IndentedWriter) QueryEngineFactory(org.apache.jena.sparql.engine.QueryEngineFactory) Plan(org.apache.jena.sparql.engine.Plan)

Example 7 with SerializationContext

use of org.apache.jena.sparql.serializer.SerializationContext in project jena by apache.

the class QueryOutputUtils method toString.

// ---- PrintSerializable
public static String toString(PrintSerializable item, PrefixMapping pmap) {
    IndentedLineBuffer buff = new IndentedLineBuffer();
    SerializationContext sCxt = new SerializationContext(pmap);
    item.output(buff, sCxt);
    return buff.toString();
}
Also used : SerializationContext(org.apache.jena.sparql.serializer.SerializationContext) IndentedLineBuffer(org.apache.jena.atlas.io.IndentedLineBuffer)

Example 8 with SerializationContext

use of org.apache.jena.sparql.serializer.SerializationContext in project jena by apache.

the class WriterOp method output.

// Actual work
public static void output(final IndentedWriter iWriter, final Op op, SerializationContext sCxt) {
    if (sCxt == null)
        sCxt = new SerializationContext();
    final SerializationContext sCxt2 = sCxt;
    WriterBasePrefix.Fmt fmt = new WriterBasePrefix.Fmt() {

        @Override
        public void format() {
            op.visit(new OpWriterWorker(iWriter, sCxt2));
        }
    };
    WriterBasePrefix.output(iWriter, fmt, sCxt2.getPrologue());
}
Also used : SerializationContext(org.apache.jena.sparql.serializer.SerializationContext)

Example 9 with SerializationContext

use of org.apache.jena.sparql.serializer.SerializationContext in project jena by apache.

the class WriterOp method output.

public static void output(IndentedWriter iWriter, Op op, PrefixMapping pMap) {
    if (pMap == null)
        pMap = OpPrefixesUsed.used(op, ARQConstants.getGlobalPrefixMap());
    SerializationContext sCxt = new SerializationContext(pMap);
    output(iWriter, op, sCxt);
}
Also used : SerializationContext(org.apache.jena.sparql.serializer.SerializationContext)

Example 10 with SerializationContext

use of org.apache.jena.sparql.serializer.SerializationContext in project jena by apache.

the class WriterExpr method asString.

public static String asString(Expr expr) {
    IndentedLineBuffer b = new IndentedLineBuffer();
    output(b, expr, new SerializationContext());
    return b.asString();
}
Also used : SerializationContext(org.apache.jena.sparql.serializer.SerializationContext) IndentedLineBuffer(org.apache.jena.atlas.io.IndentedLineBuffer)

Aggregations

SerializationContext (org.apache.jena.sparql.serializer.SerializationContext)22 IndentedLineBuffer (org.apache.jena.atlas.io.IndentedLineBuffer)5 IndentedWriter (org.apache.jena.atlas.io.IndentedWriter)5 Triple (org.apache.jena.graph.Triple)3 PrefixMapping (org.apache.jena.shared.PrefixMapping)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 MatchResult (java.util.regex.MatchResult)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 TerminationException (jena.cmd.TerminationException)1 Node (org.apache.jena.graph.Node)1 RDFNode (org.apache.jena.rdf.model.RDFNode)1 BasicPattern (org.apache.jena.sparql.core.BasicPattern)1 Prologue (org.apache.jena.sparql.core.Prologue)1 Quad (org.apache.jena.sparql.core.Quad)1 Plan (org.apache.jena.sparql.engine.Plan)1 QueryEngineFactory (org.apache.jena.sparql.engine.QueryEngineFactory)1 FmtExprSPARQL (org.apache.jena.sparql.serializer.FmtExprSPARQL)1 NodeToLabelMapBNode (org.apache.jena.sparql.util.NodeToLabelMapBNode)1 Test (org.junit.Test)1