/** * Helper method that will attempt to get a transactional graph instance if the graph can be cast to such. * * @return the transactional graph or null if it is not transactional */ public TransactionalGraph tryGetTransactionalGraph() { TransactionalGraph transactionalGraph = null; if (this.graph.getFeatures().supportsTransactions && this.graph instanceof TransactionalGraph) { transactionalGraph = (TransactionalGraph) graph; } return transactionalGraph; }
public ReadOnlyGraph(final T baseGraph) { this.baseGraph = baseGraph; this.features = this.baseGraph.getFeatures().copyFeatures(); this.features.isWrapper = true; }
public WrappedGraph(final T baseGraph) { this.baseGraph = baseGraph; this.features = this.baseGraph.getFeatures().copyFeatures(); this.features.isWrapper = true; }
/** * @return The features of the underlying graph but with transactions supported. */ @Override public Features getFeatures() { Features f = graph.getFeatures().copyFeatures(); f.isWrapper = true; f.supportsTransactions = true; return f; }
public PartitionGraph(final T baseGraph, final String partitionKey, final String writePartition, final Set<String> readPartitions) { this.baseGraph = baseGraph; this.partitionKey = partitionKey; this.writePartition = writePartition; this.readPartitions.addAll(readPartitions); this.features = this.baseGraph.getFeatures().copyFeatures(); this.features.isWrapper = true; }
public EventGraph(final T baseGraph) { this.baseGraph = baseGraph; this.features = this.baseGraph.getFeatures().copyFeatures(); this.features.isWrapper = true; this.trigger = new EventTrigger(this, false); }
public Features getFeatures() { Features features = config.getConfiguredGraph().getFeatures().copyFeatures(); features.isWrapper = true; return features; }
public Features getFeatures() { Features features = config.getConfiguredGraph().getFeatures().copyFeatures(); features.isWrapper = true; return features; }
/** * Retrieves the base graph of the {@code graph}. * * @param graph the graph from which to retrieve the base graph * * @return the base graph of the {@code graph}, or {@code graph} is it is not a wrapper. * * @see com.tinkerpop.blueprints.Features#isWrapper * @see WrapperGraph */ @Nonnull private static Graph getOrigin(Graph graph) { Graph origin; if (graph.getFeatures().isWrapper) { final WrapperGraph<?> wrapperGraph = (WrapperGraph) graph; origin = getOrigin(wrapperGraph.getBaseGraph()); } else { origin = graph; } return origin; }
public void execute() { Preconditions.checkArgument(this.graph.getFeatures().supportsVertexIteration); final long time = System.currentTimeMillis(); this.vertexMemory.setComputeKeys(this.vertexProgram.getComputeKeys()); this.vertexProgram.setup(this.graphMemory); boolean done = false; while (!done) { final ExecutorService executor = Executors.newFixedThreadPool(this.threads); final Iterator<Vertex> vertices = this.graph.getVertices().iterator(); while (vertices.hasNext()) { final Runnable worker = new VertexThread(vertices); executor.execute(worker); } executor.shutdown(); while (!executor.isTerminated()) { } this.vertexMemory.completeIteration(); this.graphMemory.incrIteration(); done = this.vertexProgram.terminate(this.graphMemory); } this.graphMemory.setRuntime(System.currentTimeMillis() - time); }
@Nonnull @Override protected Backend createLocalBackend(Path directory, BaseBlueprintsConfig<?> config) { config.setLocation(directory); Graph graph = GraphFactory.open(config.getOptions(s -> s.startsWith(BaseBlueprintsConfig.BLUEPRINTS_PREFIX))); checkArgument(graph.getFeatures().supportsKeyIndices, "%s does not support key indices", graph.getClass().getSimpleName()); if (config.isReadOnly()) { graph = new ReadOnlyKeyIndexableGraph<>((KeyIndexableGraph) graph); } return createMapper(config.getMapping(), graph); } }
if (graph.getFeatures().supportsVertexIndex && graph instanceof KeyIndexableGraph) { ((KeyIndexableGraph) graph).createKeyIndex("name", Vertex.class);
public void execute() { final long time = System.currentTimeMillis(); this.vertexMemory.setComputeKeys(this.vertexProgram.getComputeKeys()); this.vertexProgram.setup(this.graphMemory); final CoreShellVertex coreShellVertex = new CoreShellVertex(this.vertexMemory); Preconditions.checkArgument(this.graph.getFeatures().supportsVertexIteration); boolean done = false; while (!done) { for (final Vertex vertex : this.graph.getVertices()) { coreShellVertex.setBaseVertex(vertex); this.vertexProgram.execute(coreShellVertex, this.graphMemory); } this.vertexMemory.completeIteration(); this.graphMemory.incrIteration(); done = this.vertexProgram.terminate(this.graphMemory); } this.graphMemory.setRuntime(System.currentTimeMillis() - time); } }