Slide 1

Slide 1 text

Neo4j - Foundations

Slide 2

Slide 2 text

Juan Guillermo Gómez ➢ Co-Leader y Co-Founder of GDG Cali. ➢ Tech Lead 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

Slide 3

Slide 3 text

FOUNDATIONS

Slide 4

Slide 4 text

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|.

Slide 5

Slide 5 text

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 first-class entities. ❖ The graphs are finite state machines and oriented graph.

Slide 6

Slide 6 text

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 define types for nodes. ❖ Nodes can have one or more labels. ❖ Labels can be used to group nodes of the same type.

Slide 7

Slide 7 text

What is a Graph Database? ❖ Relationship represents how two nodes are connected. ❖ A relationship represents the verb between two entities. ❖ Although the relationship is defined as directional, it can be queried in a non-directional manner ❖ For some data models, the direction of the relationship is significant.

Slide 8

Slide 8 text

What is a Graph Database? ❖ The nodes and relationship can have properties

Slide 9

Slide 9 text

Methodology - Design

Slide 10

Slide 10 text

Methodology - Design

Slide 11

Slide 11 text

Methodology - Design

Slide 12

Slide 12 text

RDBMS vs Graph

Slide 13

Slide 13 text

RDBMS vs Graph

Slide 14

Slide 14 text

RDBMS vs Graph

Slide 15

Slide 15 text

RDBMS vs Graph

Slide 16

Slide 16 text

SQL Problems

Slide 17

Slide 17 text

SQL Problems

Slide 18

Slide 18 text

NoSQL Problems

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

NEO4J

Slide 21

Slide 21 text

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.

Slide 22

Slide 22 text

Neo4j Graph Platform

Slide 23

Slide 23 text

Neo4j Graph Platform

Slide 24

Slide 24 text

Neo4j Graph Platform

Slide 25

Slide 25 text

Neo4j Graph Platform

Slide 26

Slide 26 text

Neo4j Graph Platform ❖ GRAPH ENGINE ❖ LANGUAGE AND DRIVER SUPPORT (APIS, CYPHER, BOLT) ❖ LIBRARIES ❖ TOOLS

Slide 27

Slide 27 text

Neo4j Graph Platform Architecture

Slide 28

Slide 28 text

Neo4j Development Environment

Slide 29

Slide 29 text

Neo4j Development Environment

Slide 30

Slide 30 text

Neo4j Development Environment

Slide 31

Slide 31 text

Cypher ❖ Cypher is a declarative query language that allows for expressive and efficient 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.

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

Neo4j Graph Data Science Library

Slide 35

Slide 35 text

❖ 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, finding the most influential 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 benefit from a customized, flexible 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 workflows. Harness the Predictive Power of Relationships

Slide 36

Slide 36 text

Harness the Predictive Power of Relationships

Slide 37

Slide 37 text

Harness the Predictive Power of Relationships

Slide 38

Slide 38 text

Harness the Predictive Power of Relationships

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

LINKS ● https://neo4j.com/developer/guide-data-modeling/ ● https://neo4j.com/developer/graph-platform/ ● https://neo4j.com/developer/cypher-basics-i/ ● https://neo4j.com/graph-data-science-library/

Slide 41

Slide 41 text

https://www.facebook.com/escueladevhack / Escuela de Hackers www.devhack.co https://github.com/escueladevhac k