use of com.thinkaurelius.titan.graphdb.olap.QueryContainer in project titan by thinkaurelius.
the class IndexRemoveJob method getQueries.
@Override
public List<SliceQuery> getQueries() {
if (isGlobalGraphIndex()) {
//Everything
return ImmutableList.of(new SliceQuery(BufferUtil.zeroBuffer(1), BufferUtil.oneBuffer(128)));
} else {
RelationTypeIndexWrapper wrapper = (RelationTypeIndexWrapper) index;
InternalRelationType wrappedType = wrapper.getWrappedType();
Direction direction = null;
for (Direction dir : Direction.values()) if (wrappedType.isUnidirected(dir))
direction = dir;
assert direction != null;
StandardTitanTx tx = (StandardTitanTx) graph.get().buildTransaction().readOnly().start();
try {
QueryContainer qc = new QueryContainer(tx);
qc.addQuery().type(wrappedType).direction(direction).relations();
return qc.getSliceQueries();
} finally {
tx.rollback();
}
}
}
use of com.thinkaurelius.titan.graphdb.olap.QueryContainer in project titan by thinkaurelius.
the class VertexProgramScanJob method getQueries.
@Override
public void getQueries(QueryContainer queries) {
if (vertexProgram instanceof TraversalVertexProgram) {
//TraversalVertexProgram currently makes the assumption that the entire star-graph around a vertex
//is available (in-memory). Hence, this special treatment here.
//TODO: After TraversalVertexProgram is adjusted, remove this
queries.addQuery().direction(Direction.BOTH).edges();
return;
}
for (MessageScope scope : vertexMemory.getPreviousScopes()) {
if (scope instanceof MessageScope.Global) {
queries.addQuery().direction(Direction.BOTH).edges();
} else {
assert scope instanceof MessageScope.Local;
TitanVertexStep<Vertex> startStep = FulgoraUtil.getReverseTitanVertexStep((MessageScope.Local) scope, queries.getTransaction());
QueryContainer.QueryBuilder qb = queries.addQuery();
startStep.makeQuery(qb);
qb.edges();
}
}
}
Aggregations