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

Pouring Coffee into the Matrix: Building Java Applications on Neo4j

Pouring Coffee into the Matrix: Building Java Applications on Neo4j

Many of us have built applications for traditional data structures (like relational database tables), but is it different for graph data stores? Do developers need to retool and relearn? In this session, Jennifer Reif will cover a brief intro to graphs and walk through writing a typical Java application with Spring and connect it to a graph database. We will walk through interacting with the graph data from the application, and show it in the cloud, as well. Come to this session to apply your business applications to graph data!

10f2b035856eef2b59c02267e3ee9e63?s=128

Jennifer Reif

August 12, 2021
Tweet

Transcript

  1. Jennifer Reif Email: jennifer.reif@neo4j.com Twitter: @JMHReif LinkedIn: linkedin.com/in/jmhreif Github: GitHub.com/JMHReif

    Website: jmhreif.com Pouring Coffee into the Matrix Building Java applications on Neo4j
  2. Who Am I? • Developer • Continuous learner • Technical

    content writer • Conference speaker • Other: geek
  3. What is graph?

  4. What is a graph? • Set of discrete objects, each

    of which has some set of relationships with other objects Seven Bridges of Konigsberg problem. Leonhard Euler, 1735
  5. Shows how data is connected

  6. Relational Graph

  7. Other NoSQL Graph

  8. What does graph have to offer?

  9. Graphs add context and meaning

  10. A few graph use cases… Social network Fraud detection Network

    & IT operations Identity & access management Graph-based search
  11. (Graphs)-[ARE]->(Everywhere) The Internet Bank Fraud

  12. Literally… NASA space satellite Game of Thrones family trees

  13. Whiteboard friendliness

  14. Graph model

  15. Graph data

  16. Graph components • Node (vertex) • Objects Michael Jennifer Neo4j

    Graphs
  17. Graph components • Node (vertex) • Objects • Relationship (edge)

    • Connections Michael Jennifer Neo4j Graphs :LIKES :WORKS_FOR :IS_FRIENDS_WITH
  18. Graph components • Node (vertex) • Objects • Relationship (edge)

    • Connections • Label • Node category (optional) Person Person Company Technology Hobby :LIKES :WORKS_FOR :IS_FRIENDS_WITH
  19. Graph components • Node (vertex) • Objects • Relationship (edge)

    • Connections • Label • Node category (optional) • Properties • Enrich node/relationship • No need for nulls Person Person Company Technology :LIKES :WORKS_FOR :IS_FRIENDS_WITH name: Michael name: Neo4j name: Jennifer type: Graphs
  20. Cypher query language…

  21. Cypher: SQL for graphs • Functional and visual • Based

    on ASCII-art • Declarative query language • Focuses on what to retrieve • Not how A B LIKES MATCH ( A ) - [ : LIKES] - > ( B )
  22. Cypher Powerful and Expressive Jennifer Neo4j WORKS_FOR CREATE (:Person {

    name: ‘Jennifer’}) -[:WORKS_FOR]-> (:Company { name: ‘Neo4j’}) NODE LABEL NODE LABEL PROPERTY PROPERTY
  23. Cypher Powerful and Expressive Jennifer Neo4j WORKS_FOR MATCH (:Person {

    name: ‘Jennifer’}) -[:WORKS_FOR]-> (whom) 
 RETURN whom
  24. Developing applications

  25. Language drivers • Java driver (o ffi cial) • Spring

    Data Neo4j • Uses Java driver at base • Other options: • O ffi cial drivers-> Python, JavaScript, Go, .NET • Java frameworks-> Quarkus, Helidon, Micronaut, etc
  26. Spring Data Neo4j architecture

  27. Spring Data What does it give developers? • Can connect

    to variety of databases out of the box • Consistency across data sources • Out-of-the-box repository and custom object-mapping • Dynamic query derivation (plus DSL for custom queries)
  28. Spring Data Neo4j What does it give developers? • Connects

    to Neo4j - a graph database • Actively developed and supported by Spring and Neo4j teams • Contains both imperative and reactive capabilities
  29. Why Spring? • Simple and familiar for others to copy

    • Spring Initializr • Spring Boot’s reduction of boilerplate • Annotation-based OGM for POJOs • Spring Data’s easy connection to Neo4j • BOLT, HTTP, or embedded
  30. None
  31. github.com/spring-projects/spring-data-neo4j

  32. Let’s see some code! Demo time!

  33. Resources • Source code: https://github.com/JMHReif/sdn-aura-java-versions • Spring Data Neo4j documentation:

    dev.neo4j.com/sdn-docs • SDN reactive: https://github.com/JMHReif/sdnrx-marvel-basic • Neo4j Aura: https://dev.neo4j.com/aura Jennifer Reif Email: jennifer.reif@neo4j.com Twitter: @JMHReif LinkedIn: linkedin.com/in/jmhreif Github: GitHub.com/JMHReif Website: jmhreif.com