Join GitHub today
Attention: this Wiki hosts an outdated version of the TinkerPop framework and Gremlin language documentation.
<dependency> <groupId>com.tinkerpop.blueprints</groupId> <artifactId>blueprints-core</artifactId> <version>??</version> </dependency>
TinkerGraph is a lightweight, POJO based, in-memory property graph that serves as the reference implementation for the property graph model. If you have a small graph that can be loaded and saved using the GraphML reader and writer library, then TinkerGraph can be handy to use. It is also great for use in writing unit tests in place of other implementations that require greater resources. TinkerGraph packaged with the core Blueprints distribution.
// in-memory Graph graph = new TinkerGraph(); // on graph.shutdown() the graph is serialized to disk with Java serialization Graph graph = new TinkerGraph("/tmp/tinkergraph");
There is a hardcoded representation of the graph diagrammed in Property Graph Model. This is useful as a small, play dataset to get acquainted with the Blueprints API.
Graph graph = TinkerGraphFactory.createTinkerGraph();
By default, TinkerGraph uses standard Java serialization for persisting its contents to disk, but there are other more portable options as well using the Blueprints IO functions: GML, GraphML and GraphSON.
Graph graph = new TinkerGraph("/tmp/tinkergraph", TinkerGraph.FileType.GML); Graph graph = new TinkerGraph("/tmp/tinkergraph", TinkerGraph.FileType.GRAPHML); Graph graph = new TinkerGraph("/tmp/tinkergraph", TinkerGraph.FileType.GRAPHSON); // the following is the same as the constructor that simply specifies the directory Graph graph = new TinkerGraph("/tmp/tinkergraph", TinkerGraph.FileType.JAVA);
In the case of GML, GraphML and GraphSON, TinkerGraph will write two files to the specified directory. One will contain the data for the graph which will be obviously prefixed with an appropriate
.json extension depending on the option selected. The other file will be a binary metadata file.
Note that TinkerGraph can store any Java object within its properties, however the storage type chosen will limit the property types that can be persisted on
If using GraphFactory to instantiate a
TinkerGraph, the following properties will apply:
|| When absent the
|| If the
TinkerGraph Feature List
supportsDuplicateEdges: true supportsSelfLoops: true supportsSerializableObjectProperty: true supportsBooleanProperty: true supportsDoubleProperty: true supportsFloatProperty: true supportsIntegerProperty: true supportsPrimitiveArrayProperty: true supportsUniformListProperty: true supportsMixedListProperty: true supportsLongProperty: true supportsMapProperty: true supportsStringProperty: true ignoresSuppliedIds: false isPersistent: true isRDFModel: false isWrapper: false supportsIndices: true supportsVertexIndex: true supportsEdgeIndex: true supportsKeyIndices: true supportsVertexKeyIndex: true supportsEdgeKeyIndex: true supportsEdgeIteration: true supportsVertexIteration: true supportsTransactions: false supportsThreadedTransactions: false