🎨 Templates as visual graph configuration.
NOTE: This is an alpha version. It needs a refactor and possibly further design work.
Describe the configuration of your graph using the dot
graph description language and get a save
function in return that'll generate Neo4j Cypher queries when given some data.
The purpose of this is to experiment with visualising small DSLs within the IDE.
A companion atom plugin atom-graphviz-config-template
is in early development.
const graphConfig = require('graphviz-config-template')
const createCypherStream = require('cypher-stream')
const { digraph } = graphConfig();
const cypher = createCypherStream('bolt://localhost', 'username', 'password')
const transaction = cypher.transaction()
const farmer = { id: 1, name: 'Old McDonald' }
const farm = { id: 1, name: 'Animal Farm' }
const animal = { id: 1, name: 'Duck' }
transaction.write(
digraph`farmer -> farm -> animal`({ farmer, farm, animal })
)
transaction.commit()
yarn add graphviz-config-template