use of org.apache.jena.sdb.core.SDBRequest in project jena by apache.
the class TupleTable method iterator.
public QueryIterator iterator() {
SDBRequest request = new SDBRequest(store, null);
String tableName = desc.getTableName();
SQLBridge b = store.getSQLBridgeFactory().create(request, sqlTable, vars);
b.build();
try {
String sqlStr = store.getSQLGenerator().generateSQL(request, b.getSqlNode());
//System.out.println(sqlStr) ;
ResultSetJDBC tableData = store.getConnection().execQuery(sqlStr);
ExecutionContext execCxt = new ExecutionContext(new Context(), null, null, null);
return b.assembleResults(tableData, BindingRoot.create(), execCxt);
} catch (SQLException ex) {
throw new SDBExceptionSQL(ex);
}
}
use of org.apache.jena.sdb.core.SDBRequest in project jena by apache.
the class QueryEngineSDB method init.
// @Override
// protected Op modifyOp(Op op)
// {
// return op ;
// }
private void init(DatasetGraphSDB dsg, Query query, Binding initialBinding, Context context) {
if (context == null)
context = ARQ.getContext().copy();
// See "DynamicDatasets" -- this could be enabled.
if (query != null) {
if (query.hasDatasetDescription())
throw new SDBException("Queries with dataset descriptions (FROM/FROM NAMED) not supported");
}
if (context.isDefined(ARQConstants.sysDatasetDescription))
throw new SDBException("Queries with dataset descriptions set in the context not supported");
this.store = dsg.getStore();
this.request = new SDBRequest(store, query, context);
this.originalOp = getOp();
// Enable transformations : use own choice of transformations.
// e.g. don't place filters
// Op op = Algebra.optimize(originalOp, context) ;
Op op = originalOp;
// Do property functions.
op = Transformer.transform(new TransformPropertyFunction(context), op);
op = Transformer.transform(new TransformFilterEquality(), op);
// Quad it now so it can be passed to Compile.compile
op = Algebra.toQuadForm(op);
// Compile to SQL / extract parts to execute as SQL.
op = SDBCompile.compile(store, op, initialBinding, context, request);
setOp(op);
}
Aggregations