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

GraphRAG for Java Developers: Data with Context

GraphRAG for Java Developers: Data with Context

In today's connected world, traditional data stores often make it difficult to uncover valuable relationships. By making relationships a key component of the model, contextualizing data becomes incredibly simple.
In this session, we will walk through what a graph database is and how it can transform your applications and data. We’ll explore creating, querying, and displaying data using tools that interact with the database. Then, we’ll examine how graphs are powering advancements in AI through vectors and GraphRAG. Live, Java-focused demos will showcase how developers can interact with graph data and integrate it into technical systems.
Code: https://github.com/JMHReif/ai-pet-travel

Jennifer Reif

April 15, 2025
Tweet

More Decks by Jennifer Reif

Other Decks in Technology

Transcript

  1. 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
  2. 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 ATTENDED ATTENDED 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
  3. A knowledge graph is a specific implementation of a graph

    database, where information is integrated from many different sources, representing the inherent knowledge of a particular domain.
  4. AI

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

    strengths: • human-consumable data • probabilistic answers • LLM weaknesses: • complex logic • recognizing nuances • Solo LLM = great -> integrated LLM = more great?
  6. 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
  7. Lexical to Semantic search Semantic layer • Keyword searches aren’t

    enough • Data dictionaries are complex and limited • How do we search relevant/contextual info?
  8. Embeddings / Vectors Convert data to a point in space

    • Series of numbers • 100s or 1000s of dimensions • Dimension = interesting feature / characteristic
  9. Vectors in the technical realm Kings and Queens king −

    man + woman ≈ queen king man wom an 1 king man wom an 2 queen? 3
  10. How do we search the vectors? Similarity search • Expensive

    queries (compare to every vector) • Approximate nearest neighbor (k-ANN) • Example: Library • Book classi fi cation - genre vs location of plot • Smaller search set = smaller retrieval time! Photo by Martin Adams on Unsplash
  11. Vector-only RAG Similarity is insu ff i cient for rich

    reasoning/explainability • Missing context, relationships • Vector similarity != relevance • Lack explainability
  12. GraphRAG layer Graph DB as a data source • More

    relevant data to provide as context • Quality connected data, higher accuracy • Explainability, veri fi ability
  13. Explainable AI Why graph with GenAI? • How did the

    LLM get this answer? • Graphs: • Incorporating siloed data into result • Add extra context/related info to graph • Better veri fi cation through understandable format Photo by No Revisions on Unsplash
  14. Nothing is a silver bullet LLM is (of sorts) mind

    of its own • Can’t guarantee a consistent answer • Prompt engineering • Context window limits
  15. Resources • Github repository (today’s code): github.com/JMHReif/ai-pet-travel • 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