Neo4j tips

How to get nodes without labels ?

To get nodes which don't have label specified, we can use this Cypher query: MATCH n WHERE LENGTH(LABELS(n)) = 0 RETURN n ...

Continue Reading β†’

How to set label in Cypher ?

Labels, as other node properties, can be defined with SET clause. This query should add label "Animal" to label only with "Cat": CREATE (c:Cat); MATCH (c:Cat) SET c :Animal RETURN LABELS(c) /...

Continue Reading β†’

How to execute file from Neo4j shell ?

Without starting new shell session, we can do that with this command: bartosz@home:~/dev/NEO4J_HOME$ ./bin/neo4j-shell -file cypher_queries_to_execute.cql ...

Continue Reading β†’

How to backup database on the fly ?

Normally we can backup Neo4j database by stopping it, archiving graph.db (or another pointed by org.neo4j.server.database.location attribute), and restarting Neo4j. But another, simpler possibility, i...

Continue Reading β†’

How execute Cypher queries from file ?

To achieve this task Neo4j shell can be used. Imagine that you want to import following file: CREATE (:Somebody); MATCH (s:Somebody) CREATE (s)-[:LIVE]->(:Europe); To execute these 2 querie...

Continue Reading β†’

How to activate debug mode ?

Because Neo4j launches separate JVM, debug mode can be configures as for other Java programs, in command line. All additionnal Neo4j JVM options are defined in neo4j-wrapper.conf file. The values need...

Continue Reading β†’