Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Neo4j Foundations

Neo4j Foundations

Juan Guillermo Gómez Torres

November 27, 2020
Tweet

More Decks by Juan Guillermo Gómez Torres

Other Decks in Programming

Transcript

  1. 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
  2. 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|.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. Neo4j Graph Platform ❖ GRAPH ENGINE ❖ LANGUAGE AND DRIVER

    SUPPORT (APIS, CYPHER, BOLT) ❖ LIBRARIES ❖ TOOLS
  8. 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.
  9. 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
  10. 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
  11. ❖ 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
  12. 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