use of org.openrdf.query.algebra.ProjectionElem in project backstage by zepheira.
the class Expression method computeOutputOnValue.
public ExpressionQueryResult computeOutputOnValue(Value value, Database database, SailRepositoryConnection connection) throws ExpressionException {
TupleQueryBuilder builder = new TupleQueryBuilder();
Var valueVar = builder.makeVar("value", value);
ExpressionResult expressionResult = computeOutputOnItem(database, builder, valueVar);
if (expressionResult.valueExpr instanceof Var) {
Var resultVar = (Var) expressionResult.valueExpr;
ProjectionElemList projectionElements = new ProjectionElemList();
projectionElements.addElement(new ProjectionElem(resultVar.getName()));
TupleExpr t = builder.makeFilterTupleExpr();
if (t == null) {
// TODO[dfhuynh]: This happens if the expression is just "value". I'm not sure what to do here.
return null;
}
Projection projection = new Projection(t, projectionElements);
TupleQuery query = new MyTupleQuery(new ParsedTupleQuery(projection), connection);
return new ExpressionQueryResult(query, expressionResult.valueType, resultVar);
}
return null;
}
Aggregations