Java Code Examples for org.apache.tinkerpop.gremlin.process.computer.GraphComputer#ResultGraph

The following examples show how to use org.apache.tinkerpop.gremlin.process.computer.GraphComputer#ResultGraph . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InputOutputHelper.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
public static HadoopGraph getOutputGraph(final Configuration configuration, final GraphComputer.ResultGraph resultGraph, final GraphComputer.Persist persist) {
    final HadoopConfiguration hadoopConfiguration = new HadoopConfiguration(configuration);
    final BaseConfiguration newConfiguration = new BaseConfiguration();
    newConfiguration.copy(org.apache.tinkerpop.gremlin.hadoop.structure.io.InputOutputHelper.getOutputGraph(configuration, resultGraph, persist).configuration());
    if (resultGraph.equals(GraphComputer.ResultGraph.NEW) && hadoopConfiguration.containsKey(Constants.GREMLIN_HADOOP_GRAPH_WRITER)) {
        if (null != InputOutputHelper.getInputFormat(hadoopConfiguration.getGraphWriter()))
            newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_READER, InputOutputHelper.getInputFormat(hadoopConfiguration.getGraphWriter()).getCanonicalName());
    }
    return HadoopGraph.open(newConfiguration);
}
 
Example 2
Source File: InputOutputHelper.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
public static HadoopGraph getOutputGraph(final Configuration configuration, final GraphComputer.ResultGraph resultGraph, final GraphComputer.Persist persist) {
    final HadoopConfiguration hadoopConfiguration = new HadoopConfiguration(configuration);
    final BaseConfiguration newConfiguration = new BaseConfiguration();
    newConfiguration.copy(hadoopConfiguration);
    if (resultGraph.equals(GraphComputer.ResultGraph.NEW)) {
        newConfiguration.setProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION, hadoopConfiguration.getOutputLocation());
        if (hadoopConfiguration.containsKey(Constants.GREMLIN_HADOOP_GRAPH_WRITER))
            if (null != InputOutputHelper.getInputFormat(hadoopConfiguration.getGraphWriter()))
                newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_READER, InputOutputHelper.getInputFormat(hadoopConfiguration.getGraphWriter()).getCanonicalName());
        newConfiguration.setProperty(Constants.GREMLIN_HADOOP_GRAPH_READER_HAS_EDGES, persist.equals(GraphComputer.Persist.EDGES));
    }
    newConfiguration.setProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION, hadoopConfiguration.getOutputLocation() + "/_");
    return HadoopGraph.open(newConfiguration);
}
 
Example 3
Source File: PeerPressureVertexProgram.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public GraphComputer.ResultGraph getPreferredResultGraph() {
    return GraphComputer.ResultGraph.NEW;
}
 
Example 4
Source File: PersistedOutputRDD.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public boolean supportsResultGraphPersistCombination(final GraphComputer.ResultGraph resultGraph, final GraphComputer.Persist persist) {
    return persist.equals(GraphComputer.Persist.NOTHING) || resultGraph.equals(GraphComputer.ResultGraph.NEW);
}
 
Example 5
Source File: ProgramTest.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public GraphComputer.ResultGraph getPreferredResultGraph() {
    return GraphComputer.ResultGraph.NEW;
}
 
Example 6
Source File: GraphComputerHelper.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
public static GraphComputer.ResultGraph getResultGraphState(final Optional<VertexProgram> vertexProgram, final Optional<GraphComputer.ResultGraph> resultGraph) {
    return resultGraph.isPresent() ? resultGraph.get() : vertexProgram.isPresent() ? vertexProgram.get().getPreferredResultGraph() : GraphComputer.ResultGraph.ORIGINAL;
}
 
Example 7
Source File: CloneVertexProgram.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public GraphComputer.ResultGraph getPreferredResultGraph() {
    return GraphComputer.ResultGraph.NEW;
}
 
Example 8
Source File: VertexProgramStrategy.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
public Builder result(final GraphComputer.ResultGraph resultGraph) {
    this.computer = this.computer.result(resultGraph);
    return this;
}
 
Example 9
Source File: TraversalVertexProgram.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public GraphComputer.ResultGraph getPreferredResultGraph() {
    return GraphComputer.ResultGraph.ORIGINAL;
}
 
Example 10
Source File: ShortestPathVertexProgram.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public GraphComputer.ResultGraph getPreferredResultGraph() {
    return GraphComputer.ResultGraph.ORIGINAL;
}
 
Example 11
Source File: GraknVertexProgram.java    From grakn with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public GraphComputer.ResultGraph getPreferredResultGraph() {
    return GraphComputer.ResultGraph.ORIGINAL;
}
 
Example 12
Source File: ConnectedComponentVertexProgram.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public GraphComputer.ResultGraph getPreferredResultGraph() {
    return GraphComputer.ResultGraph.NEW;
}
 
Example 13
Source File: PageRankVertexProgram.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public GraphComputer.ResultGraph getPreferredResultGraph() {
    return GraphComputer.ResultGraph.NEW;
}
 
Example 14
Source File: CommonFileOutputFormat.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public boolean supportsResultGraphPersistCombination(final GraphComputer.ResultGraph resultGraph, final GraphComputer.Persist persist) {
    return persist.equals(GraphComputer.Persist.NOTHING) || resultGraph.equals(GraphComputer.ResultGraph.NEW);
}
 
Example 15
Source File: ShortestDistanceVertexProgram.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
@Override
public GraphComputer.ResultGraph getPreferredResultGraph() {
    return GraphComputer.ResultGraph.ORIGINAL;
}
 
Example 16
Source File: PageRankVertexProgram.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
@Override
public GraphComputer.ResultGraph getPreferredResultGraph() {
    return GraphComputer.ResultGraph.ORIGINAL;
}
 
Example 17
Source File: PersistResultGraphAware.java    From tinkerpop with Apache License 2.0 votes vote down vote up
public boolean supportsResultGraphPersistCombination(final GraphComputer.ResultGraph resultGraph, final GraphComputer.Persist persist);