Neo4j Implementation

jbmusso edited this page Jul 12, 2016 · 20 revisions

Attention: this Wiki hosts an outdated version of the TinkerPop framework and Gremlin language documentation.

Please visit the Apache TinkerPop website and latest documentation.


OR (for Neo4j2 support)

Graph graph = new Neo4jGraph("/tmp/neo4j");

GraphFactory Settings

If using GraphFactory to instantiate a Neo4jGraph, the following properties will apply:

key description
blueprints.graph com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph The directory of the Neo4jGraph instance.
blueprints.neo4j.conf.* The prefix to use for any Neo4j specific settings (e.g. blueprints.neo4j.conf.string_block_size).

Neo4jGraph Feature List

Neo Technology are the developers of the Neo4j graph database. Neo4j natively supports the property graph data model. Note that Neo4j requires that the value objects in the property map of an element be Java primitives, java.lang.String values, or arrays of primitives and java.lang.String values. Neo4jElement will also accept a Collection of like primitives or java.lang.String values and will convert those to the appropriate array type for storage in Neo4j.

supportsDuplicateEdges: true
supportsSelfLoops: true
supportsSerializableObjectProperty: false
supportsBooleanProperty: true
supportsDoubleProperty: true
supportsFloatProperty: true
supportsIntegerProperty: true
supportsPrimitiveArrayProperty: true
supportsUniformListProperty: true
supportsMixedListProperty: false
supportsLongProperty: true
supportsMapProperty: false
supportsStringProperty: true
ignoresSuppliedIds: true
isPersistent: true
isRDFModel: false
isWrapper: false
supportsIndices: true
supportsVertexIndex: true
supportsEdgeIndex: true
supportsKeyIndices: true
supportsVertexKeyIndex: true
supportsEdgeKeyIndex: true
supportsEdgeIteration: true
supportsVertexIteration: true
supportsTransactions: true
supportsThreadedTransactions: false

Indices with Neo4jGraph

It is possible to parameterize the indices created through Blueprints. Learn more about the types of indices supported by Neo4j at this location.

Index<Vertex> index = graph.createIndex("myIdx", Vertex.class, new Parameter("analyzer", LowerCaseKeywordAnalyzer.class.getName()));
Vertex a = graph.addVertex(null);
a.setProperty("name", "marko");
index.put("name", "marko", a);
Iterator itty = graph.getIndex("myIdx", Vertex.class).query("name", "MaRkO").iterator();
assertEquals(, a);