Tuesday, March 16, 2021

Data Science Study Notes: Neo4j for beginer

What's Neo4j?

Neo4j a database, a graph database, a property graph database.
What's the difference btw the trational relational database and this Neo4j database?
How do we query that graph database? We can't use the traditional SQL relational tool, instead, we are using some new "graph SQL" called: Cypher:
Some example of using Cypher code, after installing the desktop, open the "example project" (movie database) in browswer, and run the code after the dollar sign:

// Get some sampel data to start: 
MATCH (n1)-[r]->(n2) RETURN r, n1, n2 LIMIT 25

//use the following exercise to demo:
:play https://guides.neo4j.com/intro-neo4j-exercises/01.html

//Retrieve all Movie nodes that have a released property value of 2003.
MATCH (m:Movie {released:2003}) RETURN m

// Count all nodes
RETURN count(n)

// List relationship types
CALL db.relationshipTypes()

// Count all relationships
MATCH ()-->() RETURN count(*);

// Hello World! create a database if needed:
CREATE (database:Database {name:"Neo4j"})-[r:SAYS]->(message:Message {name:"Hello World!"}) 
RETURN database, message, r
here are some examples of doing some exploration analytics:
Some examples of pattern matching:
some examples of removing duplicates:

Another data visivulization tool: CytoScape, open tool to show the complex graph network.

No comments:

Post a Comment

Python Study notes: How to run Scala and Spark in the Jupyter notebook

Here we provide some tutorial of running scala in jupyter notebook. It can also be used for scala development with the spylon-kernel. This ...