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!

Jennifer Reif

August 12, 2021
Tweet

More Decks by Jennifer Reif

Other Decks in Programming

Transcript

  1. Jennifer Reif Email: [email protected] 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 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
  4. A few graph use cases… Social network Fraud detection Network

    & IT operations Identity & access management Graph-based search
  5. Graph components • Node (vertex) • Objects • Relationship (edge)

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

    • Connections • Label • Node category (optional) Person Person Company Technology Hobby :LIKES :WORKS_FOR :IS_FRIENDS_WITH
  7. 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
  8. 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 )
  9. Cypher Powerful and Expressive Jennifer Neo4j WORKS_FOR CREATE (:Person {

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

    name: ‘Jennifer’}) -[:WORKS_FOR]-> (whom) 
 RETURN whom
  11. 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
  12. 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)
  13. 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
  14. 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
  15. 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: [email protected] Twitter: @JMHReif LinkedIn: linkedin.com/in/jmhreif Github: GitHub.com/JMHReif Website: jmhreif.com