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? In this session, we will cover a brief intro to graphs and build a typical Java application for a graph database. We will interact with the graph data from the application, and explore some deployment possibilities. See how to amplify the power of connected data with applications!

10f2b035856eef2b59c02267e3ee9e63?s=128

Jennifer Reif

July 09, 2021
Tweet

Transcript

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

    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 since: 2018
  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. Neo4j in the cloud

  34. Cloud options • Google Cloud Platform, AWS, Microsoft Azure •

    Neo4j Aura • Database-as-a-service (DBaaS) • Neo4j-managed • Cost: capacity-based (storage, i/o, backup, data transfer)
  35. Neo4j Aura neo4j.com/cloud/aura/

  36. Other ways to run Neo4j • Docker • Neo4j Desktop

    • Neo4j Sandbox • Community/enterprise server
  37. Resources • Source code: github.com/JMHReif/sdn-venmo-social • Spring Data Neo4j documentation:

    dev.neo4j.com/sdn-docs • Neo4j Aura info: neo4j.com/cloud/aura/ • Neo4j Aura Feedback: dev.neo4j.com/aura-feedback • Neo4j - Discord, Discourse, Twitch, YouTube, Twitter, LinkedIn, etc! Jennifer Reif Email: jennifer.reif@neo4j.com Twitter: @JMHReif LinkedIn: linkedin.com/in/jmhreif Github: GitHub.com/JMHReif