Cyphex

Cyphex (Cypher for Elixir) is a thought experiment, mashing up a variety of concepts and technologies. Like Elixir and Erlang, it is based on the actor model. Like Neo4j, it uses the Cypher Query Language to manipulate graph-based data. Finally, it takes advantage of the Ecto DSL and extends it in assorted ways.

Here is a high-level overview of the ways in which these concepts (e.g., Actors, Cypher, Graphs) and technologies (e.g., Cyphex, Ecto, Elixir, Neo4j) are related:

Cyphex is envisaged as a Cypher-oriented, Elixir-based front end to Neo4j. As such, it provides a variety of services, including:

  • access to Neo4j's Java-oriented APIs
  • caching of retrieved graph information
  • editing of Neo4j queries and responses
  • scalable, distributed graph processing

Note: This page describes a WIP project. If you find it interesting, please get in touch! Also, a number of audio mix tracks are available under the name Cyphex. I don't think anyone is likely to be confused by this name overloading, but suggestions for alternative project names are welcome...

Auxiliary Communication

The main Cyphex data path goes from an Elixir program through Ecto and Cyphil (a filtering proxy server) and then into Neo4j's Transactional Cypher HTTP endpoint. This path can be used to perform a wide variety of actions, including retrieval of both row- and graph-based information. However, it cannot reach Neo4j's Java-based APIs. So, Cyphil can also drive another communication channel (Cyport).

Cyport is a JVM-based server application, running under Erjang. It handles messages from a client application (e.g., an Elixir program), interacting with Neo4j's Java APIs, custom plugins, unmanaged extensions, etc. Although the Cyphex server app must reside on a JVM instance, Erlang's support for inter-node message passing allows the client to be anywhere.

Cyphil can filter Ecto's emitted JSON in a number of ways. For example, it can perform code generation and/or editing, route queries to the appropriate interface, etc. Finally, Cyphex could be extended to interact with Gremlin, Spark, and/or other Neo4j "front ends". This could provide access to a wealth of graph processing functionality.

Graph Mapping

In order to provide the functions described above, Cyphex must support Graph_Mapping (e.g., creation of actors to model property graph nodes and edges). In addition, Cyphex should be able to parse and interpret Cypher queries, causing sets of Elixir processes to take appropriate actions.

Ronja Plugins

Writing (and maintaining!) a Cypher front end looks like a lot of work. Fortunately, it may be possible to take advantage of Ronja, Neo4j's new Cypher Query Optimizer. Specifically, we would need a way to get an AST for a Cypher query (as discussed here). As Michael Hunger points out, this requires a way to access Neo4j's internal data structures.

If Ronja were extended to support dynamic registration of callbacks, it would be possible for a programmer (e.g., using a REPL) to add intermediate processing steps to Ronja's query parsing and optimization pipeline. This could be used to retrieve intermediate data structures, add macro processing, and much more. I have submitted a Neo4j issue to this effect.

Resources


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r5 - 22 May 2015, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email