Search in sources :

Example 11 with SerializationContext

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

the class PlanBase method output.

@Override
public void output(IndentedWriter out) {
    SerializationContext sCxt = new SerializationContext(ARQConstants.getGlobalPrefixMap());
    output(out, sCxt);
}
Also used : SerializationContext(org.apache.jena.sparql.serializer.SerializationContext)

Example 12 with SerializationContext

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

the class tdbreorder method print.

private static void print(BasicPattern bgp) {
    IndentedWriter out = IndentedWriter.stdout;
    PrefixMapping pmap = SSE.getPrefixMapWrite();
    SerializationContext sCxt = SSE.sCxt(pmap);
    boolean first = true;
    for (Triple t : bgp) {
        if (!first)
            out.print("\n");
        else
            first = false;
        // Adds (triple ...)
        // SSE.write(buff.getIndentedWriter(), t) ;
        out.print("(");
        WriterNode.outputPlain(out, t, sCxt);
        out.print(")");
    }
    out.flush();
}
Also used : IndentedWriter(org.apache.jena.atlas.io.IndentedWriter) SerializationContext(org.apache.jena.sparql.serializer.SerializationContext) Triple(org.apache.jena.graph.Triple) PrefixMapping(org.apache.jena.shared.PrefixMapping)

Example 13 with SerializationContext

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

the class sse method exec.

@Override
protected void exec(Item item) {
    if (!print)
        return;
    if (item == null) {
        System.err.println("No expression");
        throw new TerminationException(9);
    }
    divider();
    IndentedWriter out = new IndentedWriter(System.out, lineNumbers);
    // Need to check if used.
    //PrefixMapping pmap = SSE.getDefaultPrefixMapWrite() ;
    PrefixMapping pmap = null;
    SerializationContext sCxt = new SerializationContext(pmap);
    ItemWriter.write(out, item, sCxt);
    //item.output(out) ;
    out.ensureStartOfLine();
    out.flush();
}
Also used : IndentedWriter(org.apache.jena.atlas.io.IndentedWriter) SerializationContext(org.apache.jena.sparql.serializer.SerializationContext) PrefixMapping(org.apache.jena.shared.PrefixMapping) TerminationException(jena.cmd.TerminationException)

Example 14 with SerializationContext

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

the class SSE method write.

public static void write(IndentedWriter out, Graph graph) {
    WriterGraph.output(out, graph, new SerializationContext(graph.getPrefixMapping()));
    out.ensureStartOfLine();
}
Also used : SerializationContext(org.apache.jena.sparql.serializer.SerializationContext)

Example 15 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, Prologue prologue) {
    SerializationContext sCxt = new SerializationContext(prologue);
    output(iWriter, op, sCxt);
}
Also used : SerializationContext(org.apache.jena.sparql.serializer.SerializationContext)

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