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
- Host: GitHub
- URL: https://github.com/jexp/cypher-utils
- Owner: jexp
- License: mit
- Created: 2013-11-29T00:50:44.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-08-03T21:00:47.000Z (almost 11 years ago)
- Last Synced: 2025-02-10T08:31:21.003Z (over 1 year ago)
- Language: HTML
- Size: 198 KB
- Stars: 4
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.adoc
- License: LICENSE
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