Description
The Neo4j plugin enables lightweight access to database functionality using Neo4j. This plugin does NOT provide domain classes nor dynamic finders like GORM does.
Installation
The current version of griffon-neo4j is 0.1
To install just issue the following command
Usage
Upon installation the plugin will generate the following artifacts at $appdir/griffon-app/conf:
- Neo4jConfig.groovy - contains the database definition properties.
- BootstrapNeo4j.groovy - defines init/destroy hooks for data to be manipulated during app startup/shutdown.
A new dynamic method named withNeo4j will be injected into all controllers, giving you access to an org.neo4j.graph.GraphDatabaseService instance, with which you'll be able to make calls to the database. Remember to make all calls to the database off the EDT otherwise your application may appear unresponsive when doing long computations inside the EDT.
Scripts
- create-relationship-type - creates a new enum that implements
RelationshipTypeatsrc/main.
Dynamic methods
The following methods and properties are added via MOP to Neo4j classes:
- Object getAt(String name) - enables array subscript notation to retrieve a property. Added to
NodeandRelationship. - void putAt(String name, Object value) - enables array subscript notation to set a property. Added to
NodeandRelationship. - Relationship relate(RelationshipType type, Node other) - another way to create a relationship between nodes. Maps to Node.createRelationshipTo(Node, RelationshipType).
- indexBy(String name) - indexes a node property using the current index and the property value. Added to Node.
- indexBy(List<String> names) - indexes a node by the specified property names and their values using the current index. Added to Node.
Configuration
Dynamic method injection
The withNeo4j() dynamic method will be added to controllers by default. You can change this setting by adding a configuration flag in Application.groovy
IndexService
The plugin will create an instance of LuceneIndexService by default. You may change this setting by setting a configuration flag in Application.groovy
Value fulltext resolves to LuceneFulltextIndexService.
Value query resolves to LuceneFulltextQueryIndexService.
History
Version |
Date |
Notes |
|---|---|---|
0.1 |
02-xx-10 |
Initial release |