neo4j-script-procedures
                                
                                 neo4j-script-procedures copied to clipboard
                                
                                    neo4j-script-procedures copied to clipboard
                            
                            
                            
                        Neo4j Procedures to declare, store and run Javascript, Python, R, Ruby based procedures
= Neo4j Script Procedures
image:https://travis-ci.org/neo4j-contrib/neo4j-script-procedures.svg?branch=3.1["Build Status", link="https://travis-ci.org/neo4j-contrib/neo4j-script-procedures"]
This project demonstrates how to create dynamic procedures and functions on top of Neo4j's built in infrastructure.
You can create JavaScript functions in your database that can be later run using the 'nashorn' engine.
[Note] This project requires Neo4j 3.x
== Installation
- Download the jar from the http://github.com/neo4j-contrib/neo4j-script-procedures/releases/latest[latest release]
- Copy it into your $NEO4J_HOME/pluginsdirectory.
- Add dbms.security.procedures.unrestricted=scripts.*to$NEO4J_HOME/conf/neo4j.conf
- Restart your server.
== Operations
The operations are:
.create function [source,cypher]
CALL scripts.function({name}, {code})
{"name" : "users", "code" : "function users() { return collection(db.findNodes(label('User'))) }"}
.run function as procedure [source,cypher]
CALL scripts.run({name}[, {params}])
CALL scripts.run('users', null) CALL scripts.run('users')
-> returns one user per row
.run function as function [source,cypher]
RETURN scripts.run({name}[, {params}])
RETURN scripts.run('users', null) as users
or
RETURN scripts.run('users') as users
-> returns a list of users
.list functions [source,cypher]
CALL scripts.list()
.helper functions [source,javascript]
function label(s) { return org.neo4j.graphdb.Label.label(s); }
function type(s) { return org.neo4j.graphdb.RelationshipType.withName(s); }
function collection(it) { r=[]; while (it.hasNext()) r.push(it.next()); return Java.to(r); }
== Building it yourself
This project uses maven, to build a jar-file with the procedure in this project, simply package the project with maven:
mvn clean package
This will produce a jar-file,target/neo4j-script-procedures-*-SNAPSHOT.jar, that can be copied in the $NEO4J_HOME/plugins directory of your Neo4j instance.
== License
Apache License V2, see LICENSE