Skip to content

Neo4j Implementation

okram edited this page May 14, 2012 · 20 revisions

<dependency>
   <groupId>com.tinkerpop.blueprints</groupId>
   <artifactId>blueprints-neo4j-graph</artifactId>
   <version>??</version>
</dependency>
Graph graph = new Neo4jGraph("/tmp/neo4j");

Neo4jGraph Feature List

Neo Technology are the developers of the Neo4j graph database. Neo4j natively supports the property graph data model. However, there are a few peculiarities in Neo4j that are itemized below.

  1. Only primitive property values: 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(itty.next(), a);