An open API service indexing awesome lists of open source software.

https://github.com/jexp/cypher-utils

javascript cypher utils
https://github.com/jexp/cypher-utils

Last synced: over 1 year ago
JSON representation

javascript cypher utils

Awesome Lists containing this project

README

          

= Cypher-Utils =

== Cypher Create Parser ==

Simple Cypher create statement parser, generates d3 json.

http://jexp.github.io/cypher-utils/d3[Sample page]

Supports:

* nodes with (multiple) labels
* nodes with properties: strings, numbers, boolean, arrays
* incoming, outgoing relationships
* separate declaration of nodes and rels

Usage:

[source,cypher]
----
create (me:Person {name:"Michael"})
create (peter:Person {name:"Peter"})
create (graphgist:Project {name:"GraphGist"})
create (me)-[:KNOWS {since:2006}]->(peter),
(me)-[:WORKS_ON]->(graphgist)
CREATE (graphgist)<-[:WORKS_ON]-(peter)
----

[source,javascript]
----
function render() {
var utils = new CypherUtils();
var elements = document.getElementsByTagName("pre");
for (var i=0;i<elements.length;i++) {
var cypher=elements[i].innerText;
var graph=utils.parseCreate(cypher);
forceLayout(graph);
}
}
----

Run tests: ./test.sh

License: MIT