Search in sources :

Example 1 with StageGenerator

use of org.apache.jena.sparql.engine.main.StageGenerator in project jena by apache.

the class StageAltMain method main.

public static void main(String[] argv) {
    String[] queryString = { "PREFIX ns: <" + NS + ">", "SELECT ?v ", "{ ?s ns:p1 'xyz' ;", "     ns:p2 ?v }" };
    // Change the stage generator for all queries ...
    if (false) {
        StageGenerator origStageGen = (StageGenerator) ARQ.getContext().get(ARQ.stageGenerator);
        StageGenerator stageGenAlt = new StageGeneratorAlt(origStageGen);
        ARQ.getContext().set(ARQ.stageGenerator, stageGenAlt);
    }
    Query query = QueryFactory.create(String.join("\n", queryString));
    QueryExecution engine = QueryExecutionFactory.create(query, makeData());
    // ... or set on a per-execution basis.
    if (true) {
        StageGenerator origStageGen = (StageGenerator) engine.getContext().get(ARQ.stageGenerator);
        StageGenerator stageGenAlt = new StageGeneratorAlt(origStageGen);
        engine.getContext().set(ARQ.stageGenerator, stageGenAlt);
    }
    QueryExecUtils.executeQuery(query, engine);
}
Also used : StageGenerator(org.apache.jena.sparql.engine.main.StageGenerator)

Example 2 with StageGenerator

use of org.apache.jena.sparql.engine.main.StageGenerator in project jena by apache.

the class GraphCSVTest method wireIntoExecution.

private static void wireIntoExecution() {
    StageGenerator orig = (StageGenerator) ARQ.getContext().get(ARQ.stageGenerator);
    StageGenerator stageGenerator = new StageGeneratorPropertyTable(orig);
    StageBuilder.setGenerator(ARQ.getContext(), stageGenerator);
}
Also used : StageGenerator(org.apache.jena.sparql.engine.main.StageGenerator)

Example 3 with StageGenerator

use of org.apache.jena.sparql.engine.main.StageGenerator in project jena by apache.

the class Eval method executeBGP.

private static QueryIterator executeBGP(BasicPattern pattern, QueryIterator input, ExecutionContext execCxt) {
    if (pattern.isEmpty())
        return input;
    boolean hideBNodeVars = execCxt.getContext().isTrue(ARQ.hideNonDistiguishedVariables);
    StageGenerator gen = StageBuilder.executeInline;
    QueryIterator qIter = gen.execute(pattern, input, execCxt);
    // Project out only named variables.
    if (hideBNodeVars)
        qIter = new QueryIterDistinguishedVars(qIter, execCxt);
    return qIter;
}
Also used : QueryIterDistinguishedVars(org.apache.jena.sparql.engine.iterator.QueryIterDistinguishedVars) StageGenerator(org.apache.jena.sparql.engine.main.StageGenerator) QueryIterator(org.apache.jena.sparql.engine.QueryIterator)

Example 4 with StageGenerator

use of org.apache.jena.sparql.engine.main.StageGenerator in project jena by apache.

the class TDB method wireIntoExecution.

private static void wireIntoExecution() {
    // Globally change the stage generator to intercept BGP on TDB
    Context cxt = ARQ.getContext();
    StageGenerator orig = StageBuilder.chooseStageGenerator(cxt);
    // Wire in the TDB stage generator which will make TDB work whether
    // or not the TDB executor is used. This means that datasets of mixed
    // graph types inside a general purpose dataset work.
    StageGenerator stageGenerator = new StageGeneratorDirectTDB(orig);
    StageBuilder.setGenerator(ARQ.getContext(), stageGenerator);
}
Also used : Context(org.apache.jena.sparql.util.Context) StageGenerator(org.apache.jena.sparql.engine.main.StageGenerator) StageGeneratorDirectTDB(org.apache.jena.tdb.solver.StageGeneratorDirectTDB)

Aggregations

StageGenerator (org.apache.jena.sparql.engine.main.StageGenerator)4 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)1 QueryIterDistinguishedVars (org.apache.jena.sparql.engine.iterator.QueryIterDistinguishedVars)1 Context (org.apache.jena.sparql.util.Context)1 StageGeneratorDirectTDB (org.apache.jena.tdb.solver.StageGeneratorDirectTDB)1