neo4j - 如何执行neo4j密码代码格式化

标签 neo4j cypher

有没有办法/网站/崇高插件等来格式化密码代码(使其对齐和整洁)?

与本网站为 javascript 所做的相同,例如:
http://jsbeautifier.org/

最佳答案

虽然不完美,但这是我一直在做的。 (希望其他人会加入并改进它)

var Cypher = document.body.innerText
Cypher = Cypher.replace(/(?:\s*(OPTIONAL MATCH|MATCH|WHERE|WITH|RETURN|DETACH DELETE|DELETE|UNWIND|CASE)\s*)/gi, function(match) {
  return '\n' + match.toUpperCase() + ' '
});

Cypher = Cypher.replace(/(?:\s*(AND|NOT|DISTINCT)\s*)/gi, function(match) {
  return ' ' + match.toUpperCase().trim() + ' '
});

Cypher = Cypher.replace(/(?:\s*(\w+)\(\s*)/gi, function(match) {
  return ' ' + match.toUpperCase().trim()
});

document.body.innerText = Cypher
match (n), (n)--(m) where n.car=1 and not n.id="rawr" with n.name return collect(n) as cars


( JSFiddle version )

关于neo4j - 如何执行neo4j密码代码格式化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39646901/

相关文章:

spring-boot - 使用 Spring Data neo4j - SDN/ReactiveNeo4j 创建重复关系(neo4j 社区版 4.4.4)

go - 最初未知时在 neo4j 中建模关系

neo4j - 使用附加过滤器查找节点之间的最短路径

Neo4j 密码 : why does this 0-length path not MATCH?

database - Cypher 访问空间分隔的关系属性 neo4j

java - 是否可以在 Neo4J Java Driver v1.0.3 中为 asList 方法指定元素类型

database - 有没有办法在 neo4j 中创建超图?

java - neo4j - 使用 neo4j rest graph db 批量插入

neo4j - 加载 Neo4j 数据库转储 (neo4j-shell)

neo4j - 查询以显示 Neo4j 中的二级(间接)关系