Skip to content

sebinsua/graphviz-config-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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