Neo4j Interpreter for Apache Zeppelin
Overview
Neo4j is a native graph database, designed to store and process graphs from bottom to top.
Configuration
Property | Default | Description |
---|---|---|
neo4j.url | bolt://localhost:7687 | The Neo4j's BOLT url. |
neo4j.auth.type | BASIC | The Neo4j's authentication type (NONE, BASIC). |
neo4j.auth.user | neo4j | The Neo4j user name. |
neo4j.auth.password | neo4j | The Neo4j user password. |
neo4j.max.concurrency | 50 | Max concurrency call from Zeppelin to Neo4j server. |
Enabling the Neo4j Interpreter
In a notebook, to enable the Neo4j interpreter, click the Gear icon and select Neo4j.
Using the Neo4j Interpreter
In a paragraph, use %neo4j
to select the Neo4j interpreter and then input the Cypher commands.
For list of Cypher commands please refer to the official Cyper Refcard
%neo4j
//Sample the TrumpWorld dataset
WITH
'https://docs.google.com/spreadsheets/u/1/d/1Z5Vo5pbvxKJ5XpfALZXvCzW26Cl4we3OaN73K9Ae5Ss/export?format=csv&gid=1996904412' AS url
LOAD CSV WITH HEADERS FROM url AS row
RETURN row.`Entity A`, row.`Entity A Type`, row.`Entity B`, row.`Entity B Type`, row.Connection, row.`Source(s)`
LIMIT 10
The Neo4j interpreter leverages the Network display system allowing to visualize the them directly from the paragraph.
Write your Cypher queries and navigate your graph
This query:
%neo4j
MATCH (vp:Person {name:"VLADIMIR PUTIN"}), (dt:Person {name:"DONALD J. TRUMP"})
MATCH path = allShortestPaths( (vp)-[*]-(dt) )
RETURN path
produces the following result_
Apply Zeppelin Dynamic Forms
You can leverage Zeppelin Dynamic Form inside your queries. This query:
%neo4j
MATCH (o:Organization)-[r]-()
RETURN o.name, count(*), collect(distinct type(r)) AS types
ORDER BY count(*) DESC
LIMIT ${Show top=10}
produces the following result: