-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-2761] - Neo4j Interpreter #2478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
35b4e29
First commit
conker84 8e4690e
Create connection manager class
conker84 2f88e98
Moved business logic to the connection manager
conker84 9eb568d
Final behavior after discussion
conker84 b5c2c66
Added docs
conker84 aaf618e
Review by 1ambda 26/07
conker84 1e3d611
Review by felixcheung (09/08)
conker84 5fb97ce
review by felixcheung 18/09
conker84 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| --- | ||
| layout: page | ||
| title: "Neo4j Interpreter for Apache Zeppelin" | ||
| description: "Neo4j is a native graph database, designed to store and process graphs from bottom to top." | ||
| group: interpreter | ||
| --- | ||
| <!-- | ||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --> | ||
| {% include JB/setup %} | ||
|
|
||
| # Neo4j Interpreter for Apache Zeppelin | ||
|
|
||
| <div id="toc"></div> | ||
|
|
||
| ## Overview | ||
| [Neo4j](https://neo4j.com/product/) is a native graph database, designed to store and process graphs from bottom to top. | ||
|
|
||
|
|
||
|  | ||
|
|
||
| ## Configuration | ||
| <table class="table-configuration"> | ||
| <tr> | ||
| <th>Property</th> | ||
| <th>Default</th> | ||
| <th>Description</th> | ||
| </tr> | ||
| <tr> | ||
| <td>neo4j.url</td> | ||
| <td>bolt://localhost:7687</td> | ||
| <td>The Neo4j's BOLT url.</td> | ||
| </tr> | ||
| <tr> | ||
| <td>neo4j.auth.type</td> | ||
| <td>BASIC</td> | ||
| <td>The Neo4j's authentication type (NONE, BASIC).</td> | ||
| </tr> | ||
| <tr> | ||
| <td>neo4j.auth.user</td> | ||
| <td>neo4j</td> | ||
| <td>The Neo4j user name.</td> | ||
| </tr> | ||
| <tr> | ||
| <td>neo4j.auth.password</td> | ||
| <td>neo4j</td> | ||
| <td>The Neo4j user password.</td> | ||
| </tr> | ||
| <tr> | ||
| <td>neo4j.max.concurrency</td> | ||
| <td>50</td> | ||
| <td>Max concurrency call from Zeppelin to Neo4j server.</td> | ||
| </tr> | ||
| </table> | ||
|
|
||
| <center> | ||
|  | ||
| </center> | ||
|
|
||
|
|
||
| ## 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](http://neo4j.com/docs/cypher-refcard/current/) | ||
|
|
||
| ```bash | ||
| %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](../usage/display_system/basic.html#network) allowing to visualize the them directly from the paragraph. | ||
|
|
||
|
|
||
| ### Write your Cypher queries and navigate your graph | ||
|
|
||
| This query: | ||
|
|
||
| ```bash | ||
| %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](../usage/dynamic_form/intro.html) inside your queries. This query: | ||
|
|
||
| ```bash | ||
| %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: | ||
|  | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| ~ Licensed to the Apache Software Foundation (ASF) under one or more | ||
| ~ contributor license agreements. See the NOTICE file distributed with | ||
| ~ this work for additional information regarding copyright ownership. | ||
| ~ The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| ~ (the "License"); you may not use this file except in compliance with | ||
| ~ the License. You may obtain a copy of the License at | ||
| ~ | ||
| ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| ~ | ||
| ~ Unless required by applicable law or agreed to in writing, software | ||
| ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| ~ See the License for the specific language governing permissions and | ||
| ~ limitations under the License. | ||
| --> | ||
|
|
||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <artifactId>zeppelin</artifactId> | ||
| <groupId>org.apache.zeppelin</groupId> | ||
| <version>0.8.0-SNAPSHOT</version> | ||
| <relativePath>..</relativePath> | ||
| </parent> | ||
|
|
||
| <groupId>org.apache.zeppelin</groupId> | ||
| <artifactId>zeppelin-neo4j</artifactId> | ||
| <packaging>jar</packaging> | ||
| <version>0.8.0-SNAPSHOT</version> | ||
| <name>Zeppelin: Neo4j interpreter</name> | ||
|
|
||
| <properties> | ||
| <neo4j.driver.version>1.4.3</neo4j.driver.version> | ||
| <test.neo4j.kernel.version>3.2.3</test.neo4j.kernel.version> | ||
| <neo4j.version>3.2.3</neo4j.version> | ||
| <jackson.version>2.8.9</jackson.version> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>zeppelin-interpreter</artifactId> | ||
| <version>${project.version}</version> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>com.fasterxml.jackson.core</groupId> | ||
| <artifactId>jackson-databind</artifactId> | ||
| <version>${jackson.version}</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.neo4j.driver</groupId> | ||
| <artifactId>neo4j-java-driver</artifactId> | ||
| <version>${neo4j.driver.version}</version> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-api</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.slf4j</groupId> | ||
| <artifactId>slf4j-log4j12</artifactId> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
|
|
||
| <dependency> | ||
| <groupId>org.neo4j.test</groupId> | ||
| <artifactId>neo4j-harness</artifactId> | ||
| <version>${neo4j.version}</version> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <artifactId>maven-enforcer-plugin</artifactId> | ||
| <version>1.3.1</version> | ||
| <executions> | ||
| <execution> | ||
| <id>enforce</id> | ||
| <phase>none</phase> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
|
|
||
| <plugin> | ||
| <artifactId>maven-dependency-plugin</artifactId> | ||
| <version>2.8</version> | ||
| <executions> | ||
| <execution> | ||
| <id>copy-dependencies</id> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>copy-dependencies</goal> | ||
| </goals> | ||
| <configuration> | ||
| <outputDirectory>${project.build.directory}/../../interpreter/neo4j</outputDirectory> | ||
| <overWriteReleases>false</overWriteReleases> | ||
| <overWriteSnapshots>false</overWriteSnapshots> | ||
| <overWriteIfNewer>true</overWriteIfNewer> | ||
| <includeScope>runtime</includeScope> | ||
| </configuration> | ||
| </execution> | ||
| <execution> | ||
| <id>copy-artifact</id> | ||
| <phase>package</phase> | ||
| <goals> | ||
| <goal>copy</goal> | ||
| </goals> | ||
| <configuration> | ||
| <outputDirectory>${project.build.directory}/../../interpreter/neo4j</outputDirectory> | ||
| <overWriteReleases>false</overWriteReleases> | ||
| <overWriteSnapshots>false</overWriteSnapshots> | ||
| <overWriteIfNewer>true</overWriteIfNewer> | ||
| <includeScope>runtime</includeScope> | ||
| <artifactItems> | ||
| <artifactItem> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>${project.artifactId}</artifactId> | ||
| <version>${project.version}</version> | ||
| <type>${project.packaging}</type> | ||
| </artifactItem> | ||
| </artifactItems> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
|
|
||
| </project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add the index into https://github.com/apache/zeppelin/blob/master/docs/_includes/themes/zeppelin/_navigation.html#L138 as well
Otherwise, it will not appear in navbar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!