-
Notifications
You must be signed in to change notification settings - Fork 274
Neo4j Implementation
spmallette edited this page Mar 29, 2012
·
20 revisions
<dependency>
<groupId>com.tinkerpop.blueprints</groupId>
<artifactId>blueprints-neo4j-graph</artifactId>
<version>??</version>
</dependency>
Graph graph = new Neo4jGraph("/tmp/neo4j");
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 make it not completely faithful to the property graph model as specified by Blueprints. These are itemized below.
- No user defined element identifiers: Neo4j is the gatekeeper and creator of vertex and edge identifiers. Thus, when creating a new vertex or edge, the provided object identifier is ignored.
-
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 andjava.lang.String
values.Neo4jElement
will also accept aCollection
of like primitives orjava.lang.String
values and will convert those to the appropriate array type for storage in Neo4j.
It is possible to parameterize the indices created through Blueprints. Learn more about the types of indices supported by Neo4j at this location.
graph.createAutomaticIndex("myIdx", Vertex.class, null, new Parameter("analyzer", LowerCaseKeywordAnalyzer.class.getName()));
Vertex a = graph.addVertex(null);
a.setProperty("name", "marko");
Iterator itty = graph.getIndex("myIdx", Vertex.class).get("name", Neo4jTokens.QUERY_HEADER + "MaRkO").iterator();
assertEquals(itty.next(), a);