Export a (sub)graph to Cypher script and import it again

Oftentimes you want to export a full (or partial) database to a file and import it again without copying the actual database files. If you want to do the latter, use neo4j-admin dump/load. Here are two ways on how to… Read more →

Explore:  


How do I convert Neo4j logs from base UTC to local timezone

With the introduction of Neo4j 3.3.1 it is possible to represent date timestamps in your $NEO4J_HOME/logs/* in either UTC or SYSTEM timezone through the implementation of dbms.logs.timezone However for prior releases all Neo4j logs will preface each line with a… Read more →

Explore:  


Why does my CREATE CONSTRAINT take so long to complete

When creating a constraint, for example CREATE CONSTRAINT ON (n:ZipCode) ASSERT n.name IS UNIQUE; this will require a lock on all nodes with the label the constraint is being created for, in this case ZipCode If you have another transaction… Read more →

Explore:  


Properly escaping input data for neo4j-import

Note neo4j-import is intended to populate a new, empty database. It cannot be used to import into an existing database. When importing data using neo4j-import, make sure to review the required CSV file structure and considerations before moving on. http://neo4j.com/docs/stable/import-tool.html… Read more →

Explore:  


Explanation of error “DeadlockDetectedException: ForsetiClient[0] can’t acquire ExclusiveLock…​ …​”

Under specific scenarios a DeadlockDetectedException may be encountered and the behavior is described at http://neo4j.com/docs/stable/transactions-deadlocks.html. When a DeadlockDetected is encountered one option is to simply retry the statement. As a deadlock detection error is a safe-to-retry error and the user… Read more →

Explore:  


How do I configure init and max java heap when running bin/neo4j-backup

When running $NEO4J_HOME/bin/neo4j-backup if a Java out of heap/memory error occurs you may want define the init and max Java heap to be used by neo4j-backup. The default behavior is to allow the JVM to define the init and max… Read more →

Explore:  


A light weight approach to validating network port connectivity

If it becomes necessary to validate, particularly in a clustered environment whether Causal Cluster or High Availability, whether or not 1 instance can talk to another instance on a given port one can use linux command netcat. To Validate connectivity… Read more →

Explore:  


Comparing relationship properties within a path

You want to compare relationship-properties of a path, either by a global value or parameter, or with each other within a path. Basic model: (:Person {person_id:’123′})-[:FRIEND {date:’1972-01-01′}]->(m:Person {person_id:’456′}) Make sure to have an constraint OR index on your nodes: Constraint… Read more →

Explore:  


Limiting MATCH results per row

Since LIMIT applies to the total number of rows of the query, it can’t be used in cases when matching from multiple nodes where the limit must be on match results per row. Take an example case using the Movies… Read more →

Explore:  


How do I use LOAD CSV with data including quotes

When using LOAD CSV to read a file which includes data with double quote characters (“), the quotes need to be escaped as 2 double quote characters For example if your data file (courses.csv) included the following content COURSE_ID|COURSE_TITLE 1215,”””Graphs… Read more →

Explore:  


How to estimate initial memory configuration

The initial and eventual memory configuration parameters can be a moving target, based on how your store changes in size and how your workload increases or changes over time. This guidance is meant for the initial configuration. In order to… Read more →

Explore:  


Explanation of error LOAD CSV error of “Couldn’t load the external resource …​”

When running a LOAD CSV Cypher statement, for example LOAD CSV WITH HEADERS FROM “http://10.12.1.2/Neo4j/cities.csv” AS row WITH row create (c:cities {name:row.city}); whether through bin/neo4j-shell or the browser at http://localhost:7474 this may result in an error as follows Couldn’t load… Read more →

Explore:  


How do I define, display, and use parameters with neo4j-shell

bin/neo4j-shell allows for a command line interface to query your graph via Cypher statements and to include parameters to those statements. Usage of parameters, rather than hard coding values, will allow for re-use of the query plan cache. A parameter… Read more →

Explore:  


Alternatives to UNION queries

While UNIONs can be useful for certain cases, they can often be avoided completely with small changes to the query. In this article we’ll present various example cases where a UNION isn’t necessary, and a simple Cypher query will do.… Read more →

Explore:  


How do I define a LOAD CSV FIELDTERMINATOR in hexidecimal notation

When using LOAD CSV one can define the field delimiter used, whereby the default is the ‘,’ character. If you want to override the default this can be accomplished via the paramter FIELDTERMINATOR, for example LOAD CSV WITH HEADERS from… Read more →

Explore:  


All shortest paths between a set of nodes

Consider a number of arbitrary nodes, A,B,C,D,E,F,…​.. I wish to return all of the shortest paths between these nodes. The nodes may have many edges between them, but anticipate a maximum of 4. The graph is complex and non hierarchical… Read more →

Explore:  


Using the ACTUAL data type with neo4j-import

When importing data using neo4j-admin import, make sure to review the required CSV file structure and considerations before moving on. https://neo4j.com/docs/operations-manual/current/tools/import/ ACTUAL vs. String (default) or Integer: Each node in the CSV must have an :ID, which can be in… Read more →

Explore:  


Performing match intersection

Match intersection is a common use case where you’re searching for nodes which have relationships to all of a set of input nodes. For the rest of the article we’ll use the built-in movies graph for demonstration. The example use… Read more →

Explore:  


How to List and Install Neo4j Versions Using yum

Warning Prior to Neo4j 3.2, the rpm distribution of Neo4j was experimental at this time. Use with caution and we advise installing from the linux tarball in production environments. For Neo4j 3.2 please follow the instructions here Neo4j 3.0 does… Read more →

Explore:  


Updating a node but returning its state from before the update

Some use cases require updating node (or relationship) properties, but returning the node (or relationship) as it was prior to the update. You’ll need to get a ‘snapshot’ of the node before the update, and return that snapshot instead of… Read more →

Explore:  


Warm the cache to improve performance from cold start

Note For Neo4j 2.3+ there is no object cache anymore, so this warms up the page-cache which maps the Neo4j store files into memory. You may find that some queries run much faster the second time they run. This is… Read more →

Explore:  


Tuning Cypher queries by understanding cardinality

Cardinality issues are the most frequent culprit in slow or incorrect Cypher queries. Because of this, understanding cardinality, and using this understanding to manage cardinality issues, is a critical component in Cypher query tuning, and query correctness in general. A… Read more →

Explore:  


Retired: Modifying the http.log Format on Neo4j 2.x

Prior to Neo4j 3.0, the http.log format was controlled by neo4j-http-logging.xml. The default format works fine, except when you need to diagnose problematic long-running queries. The HTTP requests to the /db/data/cypher or /db/data/transaction endpoints do not log the json payload… Read more →

Explore:  


How do I quickly identify long gc pauses via the messages or debug logs

Java Garbage Collection (gc) pauses are monitored by the MonitorGc process in Neo4j, and recorded in the $NEO4J_HOME/logs/debug.log ( or $NEO4J_HOME/data/graph.db/messages.log for Neo4j v2.3.x and prior). To quickly find the 10 longest pauses in Neo4j 3.0 through Neo4j 3.3 one… Read more →

Explore:  


How do I report on nodes with multiple labels

If your data model has choosen to define multiple labels on a node, for example create (n:Actor:Director {name:’Clint Eastwood’}) To find all nodes which are defined with both labels of Actor AND Director use the following Cypher: match (n) where… Read more →

Explore: