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

What you need to know: Data, apps, and AI for g...

What you need to know: Data, apps, and AI for graph databases

Graphs are different from other types of databases because they store relationships between data points. This makes them ideal for applications where the connections between data provides additional context, improving decision-making with existing data.
In this session, we will walk through what a graph database is and how it can transform your applications and data. We will explore creating, querying, and displaying data and learn how to integrate a graph database into applications. Finally, we will discuss how graph databases can be used in AI applications and the strengths they bring to the table. Code: https://github.com/JMHReif/springai-goodreads

Jennifer Reif

January 08, 2025
Tweet

More Decks by Jennifer Reif

Other Decks in Technology

Transcript

  1. What you need to know: Data, apps, and AI for

    graph databases Jennifer Reif [email protected] @JMHReif github.com/JMHReif jmhreif.com linkedin.com/in/jmhreif
  2. Who is Jennifer Reif? Developer Advocate, Neo4j • Continuous learner

    • Technical speaker • Tech blogger, podcaster • Other: geek Jennifer Reif [email protected] @JMHReif github.com/JMHReif jmhreif.com linkedin.com/in/jmhreif
  3. What is a graph? Degree Degree Company Jennifer Jacob School

    W ORKED_FOR WORKED_FOR EN RO LLED_IN ENROLLED_IN ATTENDED ATTENDED
  4. What is a graph? Adrian Degree Degree Company Jennifer Jacob

    School W ORKED_FOR WORKED_FOR EN RO LLED_IN ENROLLED_IN ENROLLED_IN Degree C O M PLETED COM PLETED ATTENDED ATTENDED
  5. What is a graph? Person Degree Degree Company Person Person

    School W ORKED_FOR WORKED_FOR EN RO LLED_IN ENROLLED_IN ENROLLED_IN Degree C O M PLETED COM PLETED Edward Jones Jacob Jennifer SIUE Music CMIS CS Adrian ATTENDED ATTENDED
  6. What is a graph? Answers through relationships • How many

    coworkers shared classes/degrees? • What are common degree journeys? • How many alumni re- enroll for higher degrees? • Who else went to a school and works for company? Person Degree Degree Company Person Person School W ORKED_FOR WORKED_FOR EN RO LLED_IN ENROLLED_IN ENROLLED_IN Degree C O M PLETED COM PLETED Edward Jones Jacob Jennifer SIUE Music CMIS CS Adrian ATTENDED ATTENDED
  7. Nodes (vertices) Objects or entities • Can have labels •

    May have properties Person Degree Degree Company Person Person School Degree Edward Jones Jacob Jennifer SIUE Music CMIS CS Adrian
  8. Relationships (edges) Connect entities • Must have type (label) •

    Must have direction • May have properties Person Degree Degree Company Person Person School W ORKED_FOR WORKED_FOR EN RO LLED_IN ENROLLED_IN ENROLLED_IN Degree C O M PLETED COM PLETED Edward Jones Jacob Jennifer SIUE Music CMIS CS Adrian ATTENDED ATTENDED
  9. Logistics • Where fi rst? • Depends on when ready

    to leave house Home School Opens: 08:00 Donation Opens: 09:00 Shipping Opens: 10:00 Grocery Opens: 07:00
  10. Logistics Criteria • Where is time critical? • Personal preferences

    for refrigerated food? • How long at each store? Music Home School Opens: 08:00 Donation Opens: 09:00 Shipping Opens: 10:00 Grocery Opens: 07:00 WENT_1 W ENT_2 WENT_3 WENT_4 W ENT_5 WENT_6
  11. Answer questions Habits/preferences • E ffi ciency improvements? • Adding

    stop? Where/time? • Share load across more people? • Distance and location calculations? Music Home School Opens: 08:00 Donation Opens: 09:00 Shipping Opens: 10:00 Grocery Opens: 07:00 WENT_1 W ENT_2 WENT_3 WENT_4 W ENT_5 WENT_6
  12. Other use cases • Fraud detection • Identity and access

    management • Recommendations • Supply chain
  13. Translates to app model, too! • Java, OOM language •

    Entity-based mapping • Very little change • Neo4j/Java types nearly same @Node public class Order { @Id String orderId; LocalDate orderDate; LocalTime orderTime; String inStore; @Relationship(value = "BOUGHT", direction = Relationship.Direction.INCOMING) Customer customer; [ { "customer": { "customerId": "1", "customerName": "Kelly Key", "loyaltyId": "908-424-2890" }, "inStore": "N", "orderDate": "2019-04-01", "orderId": "76", "orderTime": "07:52:17" }, { "customer": { "customerId": "1", "customerName": "Kelly Key", "loyaltyId": "908-424-2890" }, "inStore": "N", "orderDate": "2019-04-01", "orderId": "662", "orderTime": "14:53:06" },
  14. AI

  15. Throw an LLM at it Doesn’t often work • LLM

    strengths: • human-consumable data • general/public info • LLM weaknesses: • context/big picture • private knowledge • Solo LLM = great -> integrated LLM = more great?
  16. RAG architecture • Retrieval • Data retrieved from external source

    • Augmented • Augments response with facts • Generation • Response in natural language Prompt + Relevant Information LLM API LLM
 Chat API User Database Search Prompt Response Relevant Results / Documents 2 3 1 Database
  17. GraphRAG Graph DB as a data source • Graph fi

    lls in LLM weaknesses! • Store relevant knowledge
  18. GraphRAG benefits Graph DB as a data source • Higher

    accuracy (more relevance in result) • Using existing, quality data • Explainability, veri fi ability
  19. Resources • Github repository (today’s code): github.com/JMHReif/springai-goodreads • GraphAcademy LLM

    courses: graphacademy.neo4j.com/categories/llms/ • Docs for Spring AI: docs.spring.io/spring-ai/reference/api/vectordbs/neo4j.html • Knowledge graph ebook: https://neo4j.com/whitepapers/developers-guide-how- to-build-knowledge-graph/ Jennifer Reif [email protected] @JMHReif github.com/JMHReif jmhreif.com linkedin.com/in/jmhreif