I am super excited about this project!
I was wondering if Bulbs support the use of Graph Algorithms ?
Such as the graph algorithms built-in for Neo4j ? Or https://github.com/tinkerpop/furnace/wiki that is used in Blueprint?
If so, is there a simple example to get me started ?
Hi Eugene -
Yes, you can use any Neo4j or Tinkerpop/Blueprints algorithm.
Neo4j Server and Rexster support server-side scripting through the Gremlin (https://github.com/tinkerpop/gremlin/wiki) plugin/extension:
If you look at the Bulbs source, you will see several gremlin.groovy files:
These are the Gremlin scripts that Bulbs uses for certain operations.
The top-level https://github.com/espeed/bulbs/blob/master/bulbs/gremlin.groovy are Gremlin methods that are generic and can be used on any Gremlin-enabled server.
The server-specific files are specific to each server and can override anything in the top-level file:
You can create your own custom Gremlin library, and Bulbs will parse the Groovy file and store each method in a dict, keyed by the Groovy method names.
You can add your custom Gremlin library to Bulbs like this:
>>> from bulbs.neo4jserver import Graph
>>> g = Graph()
You can then execute your custom Groovy scripts from Python like this:
>>> script = g.scripts.get('your_custom_query')
>>> params = dict(_id=3)
>>> elements = g.gremlin.query(script, params)
>>> element = elements.next()
>>> script = g.scripts.get('your_custom_command')
>>> params = dict(_id=5)
>>> resp = g.gremlin.command(script, params)
This executes the script on the server.
Use gremlin.query() when you want to return a list of initialized elements. Use gremlin.command() when you want to return non-element results (it returns the raw Response object).
If you are in the Python REPL and you update your Gremlin-Groovy library, you can refresh the scripts in the Python object like this:
Bulbs 0.3 is in GitHub master and is mostly commented. I am working on updating the docs on http://bulbflow.com right now, which are currently for 0.2.
wow thanks for the detailed response.
I'll check it out and get back to u.