use of org.janusgraph.core.JanusGraph in project grakn by graknlabs.
the class TxFactoryJanus method newJanusGraph.
private synchronized JanusGraph newJanusGraph(boolean batchLoading) {
JanusGraph JanusGraph = configureGraph(batchLoading);
buildJanusIndexes(JanusGraph);
JanusGraph.tx().onClose(Transaction.CLOSE_BEHAVIOR.ROLLBACK);
if (!strategiesApplied.getAndSet(true)) {
TraversalStrategies strategies = TraversalStrategies.GlobalCache.getStrategies(StandardJanusGraph.class);
strategies = strategies.clone().addStrategies(new JanusPreviousPropertyStepStrategy());
// TODO: find out why Tinkerpop added these strategies. They result in many NoOpBarrier steps which slowed down our queries so we had to remove them.
strategies.removeStrategies(PathRetractionStrategy.class, LazyBarrierStrategy.class);
TraversalStrategies.GlobalCache.registerStrategies(StandardJanusGraph.class, strategies);
TraversalStrategies.GlobalCache.registerStrategies(StandardJanusGraphTx.class, strategies);
}
return JanusGraph;
}
use of org.janusgraph.core.JanusGraph in project grakn by graknlabs.
the class TxFactoryJanusTest method getGraph.
private static JanusGraph getGraph() {
Keyspace name = Keyspace.of("hehe" + UUID.randomUUID().toString().replaceAll("-", ""));
when(session.keyspace()).thenReturn(name);
janusGraphFactory = new TxFactoryJanus(session);
Graph graph = janusGraphFactory.open(GraknTxType.WRITE).getTinkerPopGraph();
assertThat(graph, instanceOf(JanusGraph.class));
return (JanusGraph) graph;
}
use of org.janusgraph.core.JanusGraph in project janusgraph by JanusGraph.
the class GraphOfTheGodsFactory method create.
public static JanusGraph create(final String directory) {
JanusGraphFactory.Builder config = JanusGraphFactory.build();
config.set("storage.backend", "berkeleyje");
config.set("storage.directory", directory);
config.set("index." + INDEX_NAME + ".backend", "elasticsearch");
JanusGraph graph = config.open();
GraphOfTheGodsFactory.load(graph);
return graph;
}
use of org.janusgraph.core.JanusGraph in project janusgraph by JanusGraph.
the class BerkeleyElasticsearchTest method testGraphOfTheGodsFactoryCreate.
/**
* Test {@link org.janusgraph.example.GraphOfTheGodsFactory#create(String)}.
*/
@Test
public void testGraphOfTheGodsFactoryCreate() {
File bdbtmp = new File("target/gotgfactory");
IOUtils.deleteDirectory(bdbtmp, true);
JanusGraph gotg = GraphOfTheGodsFactory.create(bdbtmp.getPath());
JanusGraphIndexTest.assertGraphOfTheGods(gotg);
gotg.close();
}
use of org.janusgraph.core.JanusGraph in project janusgraph by JanusGraph.
the class HadoopVertexScanMapper method setup.
@Override
protected void setup(Context context) throws IOException, InterruptedException {
/* Don't call super implementation super.setup(context); */
org.apache.hadoop.conf.Configuration hadoopConf = DEFAULT_COMPAT.getContextConfiguration(context);
ModifiableHadoopConfiguration scanConf = ModifiableHadoopConfiguration.of(JanusGraphHadoopConfiguration.MAPRED_NS, hadoopConf);
VertexScanJob vertexScan = getVertexScanJob(scanConf);
ModifiableConfiguration graphConf = getJanusGraphConfiguration(context);
JanusGraph graph = JanusGraphFactory.open(graphConf);
job = VertexJobConverter.convert(graph, vertexScan);
metrics = new HadoopContextScanMetrics(context);
finishSetup(scanConf, graphConf);
}
Aggregations