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);
}
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);
}
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;
}
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);
}
Aggregations