How do I specify the field and array delimiter to neo4j-import as a ASCII character

neo4j-import allows one to initially load a graph.db via CSV files. There may be times when using a ‘,’ as a field or array delimiter is not appropriate as your data may contain this character as part of its data.… 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:  


How do I quickly switch between multiple graphs without modifying neo4j.conf?

If you have multiple graphs set up and want to quickly switch between each without modifying dbms.active_database in conf/neo4j.conf, you can accomplish this with a neo4j restart and with the environment variable NEO4J_CONF defined pointing to the appropriate/corresponding neo4j.conf file.… Read more →

Explore:  


How Neo4j Browser uses bolt+routing

There are two kinds of Bolt drivers specified by URI scheme: the bolt:// scheme is used to create a direct driver and the bolt+routing:// scheme is used to create a routing driver. Neo4j Browser will always: Use a direct driver… 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:  


Using APOC to parse JSON results from Trello API

Prior to Neo4j 3.0, if you wanted to parse the JSON results from a call to a Web API, it would require you use one of the database drivers to fetch and parse the JSON data. This is described here.… Read more →

Explore:  


How to log to neo4j.log in an Unmanaged Extension

As part of the major changes in 3.0, the way to log to the user log, now neo4j.log (in server mode), has changed. To log within an Unmanaged Extension is quite straightforward: Include this package: import org.neo4j.logging.Log; In the method… Read more →

Explore:  


How to get a high level inventory of objects in your graph (part 2)

Following the knowledge base article on How to get a high level inventory of objects in your graph, this article will cover how to get more detailed high level inventory of objects in your graph. The first article showed how… Read more →

Explore:  


Using apt to download a specific Neo4j debian package

By default, using apt-get to install Neo4j allows you to grab the current and previous stable releases. However, if you would like to install an older version, you can specify that. For reference, the Debian repo is located here: http://debian.neo4j.org/… 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:  


An approach to parsing the query.log

When one has enabled query.log through Neo4j Enterprise parameter dbms.logs.query.enabled the included bash shell script can be used to quickly parse the log and identify the top 10 most expensive queries based upon total execution time and if one has… 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:  


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:  


Understanding Neo4j’s data on disk

Neo4j database files are persisted to storage for long term durability. Data related files located in data/databases/graph.db (v3.x+) by default in the Neo4j data directory. Below will give you an idea of the type of files you’ll find, prefaced with… Read more →

Explore:  


How do I zoom in/out within the graph visualization of the browser?

Within the graph visualization pane of the browser (reached locally at http://localhost:7474), to zoom in/out of the graph display one first needs to select Full Screen mode. The zoom in/out controls are located in the bottom-right corner. To enter Full… Read more →

Explore:  


Understanding the Query Plan Cache

When a Cypher statement is first submitted Neo4j will attempt to determine if the query is in the plan cache before planning it. By default Neo4j will keep 1000 query plans in cache based upon the conf/neo4j.conf parameter of dbms.query_cache_size.… 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:  


Linux Out of Memory killer

The Out Of Memory Killer or OOM Killer is a process that the linux kernel employs when the system is critically low on memory. This situation occurs because the linux kernel has over allocated memory to its processes. When a… Read more →

Explore:  


A note on OPTIONAL MATCHes

An OPTIONAL MATCH matches patterns against your graph database, just like a MATCH does. The difference is that if no matches are found, OPTIONAL MATCH will use a null for missing parts of the pattern. OPTIONAL MATCH could be considered… Read more →

Explore:  


Understanding how MERGE works

What is MERGE, and how does it work? The MERGE clause ensures that a pattern exists in the graph. Either the pattern already exists, or it needs to be created. In this way, it’s helpful to think of MERGE as… Read more →

Explore:  


How to write a Cypher query to return the top N results per category

The following Cypher describes how you can display the Top 5 test scores within an entire :Score population broken out by a field_of_study property. create (n:Score {student_id: ‘DC001’, score: 89, field_of_study: ‘chemistry’}); create (n:Score {student_id: ‘MK812’, score: 97, field_of_study: ‘chemistry’});… Read more →

Explore:  


Resetting query cardinality

As queries execute, they build up result rows. Cypher executes operations per-row. When a query is made up of completely separate parts, unrelated to each other, and you don’t want to split the single query into multiple queries, you sometimes… Read more →

Explore:  


How to get a high level inventory of objects in your graph

The following Cypher can be used to get a simple high level view of the number of objects within your graph database. This may be used if one is trying to compare the contents of two databases: match (n) return… Read more →

Explore:  


How do I achieve the equivalent of a SQL Having clause with Cypher

With a traditional SQL based database a HAVING clause will restrict aggregated values. For example select zipcode, count(*) as population from Person group by zipcode having population>100000; will return all zipcodes which have more than 100k residents. To achieve the… Read more →

Explore: