use of edu.mit.simile.backstage.model.TupleQueryBuilder in project backstage by zepheira.
the class TileView method getComponentState.
@Override
public Scriptable getComponentState() {
_logger.debug("> getComponentState");
TupleQueryBuilder builder = new TupleQueryBuilder();
Var itemVar = getCollection().getRestrictedItems(builder, null);
String key = "tile-view-rendering:" + builder.getStringSerialization();
_logger.debug("component: " + key);
Scriptable result = (Scriptable) _context.getDatabase().cacheAndRun(key, new ViewRenderingCacheableQuery(builder, itemVar));
_logger.debug("< getComponentState");
return result;
}
use of edu.mit.simile.backstage.model.TupleQueryBuilder in project backstage by zepheira.
the class Collection method updateOneFacet.
protected void updateOneFacet(Facet facet, BackChannel backChannel) {
TupleQueryBuilder builder = new TupleQueryBuilder();
Var itemVar = getAllItems(builder, null);
computeRestrictedItems(builder, itemVar, facet);
try {
facet.update(builder, itemVar, backChannel);
} catch (ExpressionException e) {
_logger.error("Failed to update facet", e);
}
}
use of edu.mit.simile.backstage.model.TupleQueryBuilder 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