🎨 Templates as visual graph configuration.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
preview
src
test
.editorconfig
.gitignore
.npmignore
.travis.yml
CHANGELOG.md
README.md
package.json
yarn.lock

README.md

graphviz-config-template Build Status npm version

🎨 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.

Example

Farm

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()

Install

yarn add graphviz-config-template