Skip to content

Factories and Modules

Bryn Cooke edited this page Jun 30, 2013 · 5 revisions

Factories

To obtain a framed graph use a FramedGraphFactory.

FramedGraphFactory factory = new FramedGraphFactory();
FramedGraph framedGraph = factory.create(baseGraph);

A factory should be reused to create many graphs. Under the hood it may share resources between graphs where appropriate. This can make a big difference to performance and memory footprint.

Modules

Modules are used to extend the capability of FramedGraph. They are registered in the constructor of the FramedGraphFactory.

In this example the framed graph will now support the @GremlinGroovy annotation on frames.

FramedGraphFactory factory = new FramedGraphFactory(new GremlinGroovyModule());
FramedGraph framedGraph = factory.create(baseGraph);

Any number of modules can be added to the factory, but a FramedGraph will always support the Core Annotations.
Clone this wiki locally