Search in sources :

Example 1 with TraversalVertexProgram

use of org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram in project janusgraph by JanusGraph.

the class VertexProgramScanJob method getQueries.

@Override
public void getQueries(QueryContainer queries) {
    Set<MessageScope> previousScopes = vertexMemory.getPreviousScopes();
    if (vertexProgram instanceof TraversalVertexProgram || vertexProgram instanceof ShortestPathVertexProgram || vertexProgram instanceof ConnectedComponentVertexProgram || previousScopes.contains(globalScope)) {
        // 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
        // Special handling for ShortestPathVertexProgram necessary until TINKERPOP-2187 is resolved
        // Apparently, ConnectedComponentVertexProgram also needs this special handling
        queries.addQuery().direction(Direction.BOTH).edges();
    }
    for (MessageScope scope : previousScopes) {
        if (scope instanceof MessageScope.Local) {
            JanusGraphVertexStep<Vertex> startStep = FulgoraUtil.getReverseJanusGraphVertexStep((MessageScope.Local) scope, queries.getTransaction());
            QueryContainer.QueryBuilder qb = queries.addQuery();
            startStep.makeQuery(qb);
            qb.edges();
        }
    }
}
Also used : ConnectedComponentVertexProgram(org.apache.tinkerpop.gremlin.process.computer.clustering.connected.ConnectedComponentVertexProgram) JanusGraphVertex(org.janusgraph.core.JanusGraphVertex) PreloadedVertex(org.janusgraph.graphdb.vertices.PreloadedVertex) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) ShortestPathVertexProgram(org.apache.tinkerpop.gremlin.process.computer.search.path.ShortestPathVertexProgram) TraversalVertexProgram(org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram) MessageScope(org.apache.tinkerpop.gremlin.process.computer.MessageScope) QueryContainer(org.janusgraph.graphdb.olap.QueryContainer)

Example 2 with TraversalVertexProgram

use of org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram 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();
        }
    }
}
Also used : PreloadedVertex(com.thinkaurelius.titan.graphdb.vertices.PreloadedVertex) TitanVertex(com.thinkaurelius.titan.core.TitanVertex) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) TraversalVertexProgram(org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram) MessageScope(org.apache.tinkerpop.gremlin.process.computer.MessageScope) QueryContainer(com.thinkaurelius.titan.graphdb.olap.QueryContainer)

Aggregations

MessageScope (org.apache.tinkerpop.gremlin.process.computer.MessageScope)2 TraversalVertexProgram (org.apache.tinkerpop.gremlin.process.computer.traversal.TraversalVertexProgram)2 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)2 TitanVertex (com.thinkaurelius.titan.core.TitanVertex)1 QueryContainer (com.thinkaurelius.titan.graphdb.olap.QueryContainer)1 PreloadedVertex (com.thinkaurelius.titan.graphdb.vertices.PreloadedVertex)1 ConnectedComponentVertexProgram (org.apache.tinkerpop.gremlin.process.computer.clustering.connected.ConnectedComponentVertexProgram)1 ShortestPathVertexProgram (org.apache.tinkerpop.gremlin.process.computer.search.path.ShortestPathVertexProgram)1 JanusGraphVertex (org.janusgraph.core.JanusGraphVertex)1 QueryContainer (org.janusgraph.graphdb.olap.QueryContainer)1 PreloadedVertex (org.janusgraph.graphdb.vertices.PreloadedVertex)1