yomguithereal / decypher Goto Github PK
View Code? Open in Web Editor NEWA handful of cypher utilities for Node.js
License: MIT License
A handful of cypher utilities for Node.js
License: MIT License
at the moment you can't do something like
var cypher = new Query();
cypher
.match(...)
.call('apoc.create.setLabels(...)');
At this moment there seems to be no way to add multiple labels to a nodePattern since they are escaped. Maybe allow array and concatenate escaped labels?
As mentionned in shesek/cypher-query#1.
var cypher = new Query();
cypher.foreach('name in {names}', {names: ['a']}).merge('(c {name: name})');
cypher.toString(); // 'FOREACH name in {names}\nMERGE (c:colPHI {name: name});'
Foreach should have the following format:
FOREACH ( iterator
in list
| list of statements
)
query.union();
Should be able to do:
query.limit(10);
// or, using string coercion
query.limit(database.int(10));
I have made a few generic functions to do things like get some set of nodes (see pseudo code simple example below):
function getLabel
cypher.match('(n:Label)')
.return('n);
return cypher;
I would like to reuse the base cypher query I wrote (in the above case MATCH (n:label)
) in other functions. e.g.:
function deleteNodesWithLabel
var getLabelQuery = getLabel();
var deleteQuery = new Query();
deleteQuery.add(getLabelQuery)
.delete('n');
return deleteQuery;
The above is a pretty forced pseudo code example but being able to make modular cypher queries for reuse would be very powerful.
I could, for the interim, just wait to put my .return('n')
until I am actually about to run my query. However that forces all my functions to know about what my node variables are.
with a project folder structure like so:
queries
| read_graph.cypher
src
| queries
| read_graph.cypher
| file.js
index.js
I expect decypher('./queries/read_graph.cypher')
to load either the one file (./queries/read_graph.cypher
when calling decypher()
in index.js
) or the other (./src/queries/read_graph.cypher
when calling decypher()
in file.js
).
decypher
always loads ./queries/read_graph.cypher
even when calling it from file.js
because it uses fs.readFileSync
here which seems to work with the working directory instead of the directory where the file is present.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.