# Neo4j Foundations

#### Juan Guillermo Gómez Torres

November 27, 2020

## Transcript

2. ### Juan Guillermo Gómez ➢ Co-Leader y Co-Founder of GDG Cali.

➢ Tech Lead in WordBox & Founder DevHack ➢ Consultant and advisor on software architecture, cloud computing and software development. ➢ Experience in several languages and platforms. (C, C#, Java, NodeJS, android, GCP, Firebase). ➢ Google Developer Expert (GDE) in Firebase & GCP ➢ BS in System Engineering and a MS in Software Engineering. ➢ @jggomezt

4. ### What is a Graph? ❖ Graphs are mathematical structures used

to model pairwise relations between objects. ❖ A graph in this context is made up of vertices (also called nodes or points) which are connected by edges (also called links or lines). ❖ The order of a graph is its number of vertices |V|. The size of a graph is its number of edges |E|.
5. ### What is a Graph Database? ❖ ODMS (Online Database Management

System) with CRUD operations working on a graph model for use with OLTP systems. ❖ By assembling the simple abstractions of nodes and relationships into connected structures, graph databases enable us to build sophisticated models that map closely to our problem domain. ❖ The biggest value that graphs bring to the development stack is their ability to store relationships and connections as ﬁrst-class entities. ❖ The graphs are ﬁnite state machines and oriented graph.
6. ### What is a Graph Database? ❖ Nodes represents an entity

(a person, place, word, book, category, thing, etc) ❖ Nodes can have labels that are used to deﬁne types for nodes. ❖ Nodes can have one or more labels. ❖ Labels can be used to group nodes of the same type.
7. ### What is a Graph Database? ❖ Relationship represents how two

nodes are connected. ❖ A relationship represents the verb between two entities. ❖ Although the relationship is deﬁned as directional, it can be queried in a non-directional manner ❖ For some data models, the direction of the relationship is signiﬁcant.
8. ### What is a Graph Database? ❖ The nodes and relationship

can have properties

19. None

21. ### Neo4j Graph Platform The heart of the Neo4j Graph Platform

is the Neo4j Database. The Neo4j Graph Platform includes out-of-the-box tooling that enables you to access graphs in Neo4j Databases. In addition, Neo4j provides APIs and drivers that enable you to create applications and custom tooling for accessing and visualizing graphs.

26. ### Neo4j Graph Platform ❖ GRAPH ENGINE ❖ LANGUAGE AND DRIVER

SUPPORT (APIS, CYPHER, BOLT) ❖ LIBRARIES ❖ TOOLS

31. ### Cypher ❖ Cypher is a declarative query language that allows

for expressive and eﬃcient querying and updating of graph data. Cypher is a relatively simple and very powerful language. Complex database queries can easily be expressed through Cypher, allowing you to focus on your domain instead of getting lost in the syntax of database access. ❖ Cypher is designed to be a human-friendly query language, suitable for both developers and other professionals. The guiding goal is to make the simple things easy, and the complex things possible.
32. ### Cypher - Create ❖ CREATE ❖ CREATE RELATIONSHIP CREATE (player:PLAYER{name:”Juan”})

RETURN player CREATE (player:PLAYER{name:”Juan”}) CREATE (team:TEAM{name:”America”}) MERGE (player) - [rel:PLAYS_IN] -> (team) RETURN player, rel, team
33. ### Querying Nodes MATCH (variable) RETURN variable MATCH (variable:Label) RETURN variable

❖ All nodes in the graph ➢ MATCH (n) RETURN n ❖ ➢ MATCH (user:USER) WHERE user.id = “123345” RETURN user

35. ### ❖ Graph data science uses the relationships and network structures

in your data to help data scientists address complex questions about system dynamics and group behavior. ❖ Businesses use these insights to make valuable predictions, such as pinpointing interactions that indicate fraud, identifying similar entities or individuals, ﬁnding the most inﬂuential elements in patient or customer journeys, and how to ameliorate the spread of IT or phone outages. ❖ The Neo4j Graph Data Science™ Library makes addressing these questions feasible. Data scientists beneﬁt from a customized, ﬂexible data structure for global computations and a repository of powerful, robust algorithms to quickly compute results over tens of billions of nodes. ❖ Graph algorithms provide unsupervised machine learning methods and heuristics that learn and describe the topology of your graph. The GDS™ Library includes hardened graph algorithms with enterprise features, like deterministic seeding for consistent results and reproducible machine learning workﬂows. Harness the Predictive Power of Relationships

39. ### Recommender System MATCH (genre:Genre{name:"Comedy"})<-[:IN_GENRE]-(movie:Movie)<-[rating:RATED]-(user:User) RETURN movie, avg(rating.rating) AS score ORDER

BY score DESC MATCH (genre:Genre{name:"Comedy"})<-[:IN_GENRE]-(movie:Movie)<-[rating:RATED]-(user:User) MATCH (movie)-[:HAS_IMDB_RATING]->(imdbRating:ImdbRating) RETURN movie, avg(rating.rating)+avg(imdbRating.rating) AS score ORDER BY score MATCH (:User {id: "1"})-[r:RATED]->(m)-[:IN_GENRE]->(g) WHERE toInteger(r.rating) = 5.0 RETURN g.name AS genre, count(m) AS score ORDER BY score DESC MATCH (m1:Movie{name:"Iron Man"})-[:IN_GENRE]->(g)<-[:IN_GENRE]-(m2) RETURN m2 AS recommendation, count(g) AS score ORDER BY score