SlideShare a Scribd company logo
1 of 54
Download to read offline
© 2022 Neo4j, Inc. All rights reserved.
© 2022 Neo4j, Inc. All rights reserved.
Getting the Most from Today’s
Java Tooling With Neo4j
Gerrit Meier,
Staff Software Engineer (SDN/OGM)
© 2022 Neo4j, Inc. All rights reserved.
2
© 2022 Neo4j, Inc. All rights reserved.
3
Neo4j Java Driver
Let’s connect
© 2022 Neo4j, Inc. All rights reserved.
4
1
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>4.4.5</version>
</dependency
© 2022 Neo4j, Inc. All rights reserved.
5
1
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>4.4.5</version>
</dependency
2
var driver = GraphDatabase
.driver("neo4j://host:port",
AuthTokens.basic("neo4j", "secret")
);
© 2022 Neo4j, Inc. All rights reserved.
6
1
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>4.4.5</version>
</dependency
2
var driver = GraphDatabase
.driver("neo4j://host:port",
AuthTokens.basic("neo4j", "secret")
);
3
var records = session
.run("MATCH (m:Movie) return m")
.list();
© 2022 Neo4j, Inc. All rights reserved.
7
1
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>4.4.5</version>
</dependency
2
var driver = GraphDatabase
.driver("neo4j://host:port",
AuthTokens.basic("neo4j", "secret")
);
3 4
var records = session
.run("MATCH (m:Movie) return m")
.list();
var records = session
.run(
"MATCH (m:Movie) WHERE m.title = $title
return m",
Map.of("title", "The Matrix"))
.list();
© 2022 Neo4j, Inc. All rights reserved.
8
{
tagline=Welcome to …,
title=The Matrix,
released=1999
}
class Movie {
String title;
}
© 2022 Neo4j, Inc. All rights reserved.
9
5
{
tagline=Welcome to …,
title=The Matrix,
released=1999
}
class Movie {
String title;
}
var movies = session
.run("MATCH (m:Movie) return m")
.list(record -> {
var movieNode = record.get("m").asNode();
var title = movieNode.get("title")
.asString();
return new Movie(title);
});
System.out.println(movies);
// [Movie{title='The Matrix'}, ...]
© 2022 Neo4j, Inc. All rights reserved.
10
© 2022 Neo4j, Inc. All rights reserved.
11
6
© 2022 Neo4j, Inc. All rights reserved.
12
Object Graph Mapping
Sync the Graphs
© 2022 Neo4j, Inc. All rights reserved.
13
{
tagline=Welcome to …,
title=The Matrix,
released=1999
}
class Movie {
String title;
}
© 2022 Neo4j, Inc. All rights reserved.
14
{
tagline=Welcome to …,
title=The Matrix,
released=1999
}
class Movie {
String title;
}
1
12
7
© 2022 Neo4j, Inc. All rights reserved.
15
2a
2b
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>6.3.0</version>
</dependency>
© 2022 Neo4j, Inc. All rights reserved.
16
3
@Node
public class Movie {
@Id
public final String title;
public Movie(String title) {
this.title = title;
}
}
© 2022 Neo4j, Inc. All rights reserved.
17
3 4
@Node
public class Movie {
@Id
public final String title;
public Movie(String title) {
this.title = title;
}
}
@Node("Person")
public class Actor {
@Id
public final String name;
@Relationship("ACTED_IN")
public final List<Movie> movies;
public Actor(String name,
List<Movie> movies) {
this.name = name;
this.movies = movies;
}
}
© 2022 Neo4j, Inc. All rights reserved.
18
5
interface ActorRepository extends Neo4jRepository<Actor, String> {}
© 2022 Neo4j, Inc. All rights reserved.
19
5
6
interface ActorRepository extends Neo4jRepository<Actor, String> {}
Actor actor = repository.findById("Tom Hanks").get();
System.out.println(actor);
// Actor{name='Tom Hanks',
// movies=[
// Movie{title='Apollo 13'},
// Movie{title='You've Got Mail'},
// ..]
© 2022 Neo4j, Inc. All rights reserved.
20
7
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-core</artifactId>
<version>3.2.33</version>
</dependency>
© 2022 Neo4j, Inc. All rights reserved.
21
8 9
@NodeEntity("Person")
public class Actor {
@Id
public String name;
@Relationship("ACTED_IN")
public List<Movie> movies;
}
@NodeEntity
public class Movie {
@Id
public String title;
}
© 2022 Neo4j, Inc. All rights reserved.
22
10
var sessionFactory = new SessionFactory(
new Configuration.Builder()
.uri("neo4j://localhost:7687")
.credentials("neo4j", "secret")
.build(),
"domainPackage");
© 2022 Neo4j, Inc. All rights reserved.
23
10 11
var sessionFactory = new SessionFactory(
new Configuration.Builder()
.uri("neo4j://localhost:7687")
.credentials("neo4j", "secret")
.build(),
"domainPackage");
var session = sessionFactory.openSession();
var tomHanks =
session.queryForObject(Actor.class,
"MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
WHERE p.name = $name
return p, collect(r), collect(m)",
Map.of("name", "Tom Hanks"));
System.out.println(tomHanks);
// Actor{
// name='Tom Hanks',
// movies=[
// Movie{title='Apollo 13'},
// Movie{title='The Polar Express'},
// ...
// ]}
© 2022 Neo4j, Inc. All rights reserved.
24
12
quarkus.neo4j.uri=neo4j://localhost:7687
quarkus.neo4j.authentication.username=neo4j
quarkus.neo4j.authentication.password=secret
org.neo4j.ogm.base-packages=
com.meistermeier.graphconnect2022.domain
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-core</artifactId>
<version>3.2.33</version>
</dependency>
© 2022 Neo4j, Inc. All rights reserved.
25
13
@Inject
SessionFactory sessionFactory;
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
var session = sessionFactory.openSession();
var tomHanks = session.queryForObject(
Actor.class,
"MATCH (p:Person)...",
Map.of("name", "Tom Hanks"));
return tomHanks.name;
}
➜ ~ curl http://localhost:8080/hello
Tom Hanks%
12
quarkus.neo4j.uri=neo4j://localhost:7687
quarkus.neo4j.authentication.username=neo4j
quarkus.neo4j.authentication.password=secret
org.neo4j.ogm.base-packages=
com.meistermeier.graphconnect2022.domain
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-core</artifactId>
<version>3.2.33</version>
</dependency>
© 2022 Neo4j, Inc. All rights reserved.
26
14
© 2022 Neo4j, Inc. All rights reserved.
27
14
15
© 2022 Neo4j, Inc. All rights reserved.
28
Cypher-DSL
Writing Cypher in a type-safe way
© 2022 Neo4j, Inc. All rights reserved.
29
MATCH
CREATE
MERGE
WHERE n.name=$name
CALL
RETURN n{...}
© 2022 Neo4j, Inc. All rights reserved.
30
1
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-dsl</artifactId>
<version>2022.4.0</version>
</dependency>
© 2022 Neo4j, Inc. All rights reserved.
31
1 2
var query; = "MATCH
(p:Person)-[r:ACTED_IN]->(m:Movie) WHERE
p.name = $name return p, collect(r),
collect(m)";
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-dsl</artifactId>
<version>2022.4.0</version>
</dependency>
© 2022 Neo4j, Inc. All rights reserved.
32
1 2
var query; = "MATCH
(p:Person)-[r:ACTED_IN]->(m:Movie) WHERE
p.name = $name return p, collect(r),
collect(m)";
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-dsl</artifactId>
<version>2022.4.0</version>
</dependency>
© 2022 Neo4j, Inc. All rights reserved.
33
1 2
var query; = "MATCH
(p:Person)-[r:ACTED_IN]->(m:Movie) WHERE
p.name = $name return p, collect(r),
collect(m)";
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-dsl</artifactId>
<version>2022.4.0</version>
</dependency>
3
Cypher.node("Person").named("p")
Cypher.node("Movie").named("m")
© 2022 Neo4j, Inc. All rights reserved.
34
4 var personNode = Cypher.node("Person").named("p");
var movieNode = Cypher.node("Movie").named("m");
var actedIn = personNode.relationshipTo(movieNode).named("r");
var condition = personNode.property("name").eq(Cypher.parameter("name"));
Cypher.match(actedIn).where(condition).returning(
personNode.as("person"),
Functions.collect(movieNode).as("movies"),
Functions.collect(actedIn).as("relationships"));
© 2022 Neo4j, Inc. All rights reserved.
35
4
5
var personNode = Cypher.node("Person").named("p");
var movieNode = Cypher.node("Movie").named("m");
var actedIn = personNode.relationshipTo(movieNode).named("r");
var condition = personNode.property("name").eq(Cypher.parameter("name"));
Cypher.match(actedIn).where(condition).returning(
personNode.as("person"),
Functions.collect(movieNode).as("movies"),
Functions.collect(actedIn).as("relationships"));
var renderedStatement = Renderer.getDefaultRenderer().render(statement);
System.out.println(renderedStatement);
// MATCH (p:`Person`)-[r]->(m:`Movie`)
// WHERE p.name = $name
// RETURN p AS person,
// collect(m) AS movies,
// collect(r) AS relationships
© 2022 Neo4j, Inc. All rights reserved.
36
Neo4j-Migrations
Friends do let friends write upgrade scripts
© 2022 Neo4j, Inc. All rights reserved.
37
© 2022 Neo4j, Inc. All rights reserved.
38
1
12
9
7
© 2022 Neo4j, Inc. All rights reserved.
39
1
<dependency>
<groupId>eu.michael-simons.neo4j</groupId>
<artifactId>neo4j-migrations</artifactId>
<version>1.6.0</version>
</dependency>
© 2022 Neo4j, Inc. All rights reserved.
40
1 2
<dependency>
<groupId>eu.michael-simons.neo4j</groupId>
<artifactId>neo4j-migrations</artifactId>
<version>1.6.0</version>
</dependency>
// V001__InitialImport.cypher
CREATE (:Movie{title: 'The Matrix'});
© 2022 Neo4j, Inc. All rights reserved.
41
1 2
3
<dependency>
<groupId>eu.michael-simons.neo4j</groupId>
<artifactId>neo4j-migrations</artifactId>
<version>1.6.0</version>
</dependency>
// V001__InitialImport.cypher
CREATE (:Movie{title: 'The Matrix'});
var config = MigrationsConfig.defaultConfig();
var migrations = new Migrations(config,
driver);
migrations.apply()
© 2022 Neo4j, Inc. All rights reserved.
42
1 2
4
<dependency>
<groupId>eu.michael-simons.neo4j</groupId>
<artifactId>neo4j-migrations</artifactId>
<version>1.6.0</version>
</dependency>
// V001__InitialImport.cypher
CREATE (:Movie{title: 'The Matrix'});
3
var config = MigrationsConfig.defaultConfig();
var migrations = new Migrations(config,
driver);
migrations.apply()
© 2022 Neo4j, Inc. All rights reserved.
43
5
public class V002__InitialImport implements JavaBasedMigration {
@Override
public void apply(MigrationContext context) {
try (Session session = context.getSession()) {
session.run("CREATE (m:Movie{title:'The Matrix'})").consume();
}
}
}
© 2022 Neo4j, Inc. All rights reserved.
44
5
public class V002__InitialImport implements JavaBasedMigration {
@Override
public void apply(MigrationContext context) {
try (Session session = context.getSession()) {
session.run("CREATE (m:Movie{title:'The Matrix'})").consume();
}
}
}
6
© 2022 Neo4j, Inc. All rights reserved.
45
7
8
<dependency>
<groupId>eu.michael-simons.neo4j</groupId>
<artifactId>neo4j-migrations-spring-boot-starter</artifactId>
<version>1.6.0</version>
</dependency>
org.neo4j.migrations.packages-to-scan=com.meistermeier.graphconnect2022
© 2022 Neo4j, Inc. All rights reserved.
46
9
10
org.neo4j.migrations.packages-to-scan=com.meistermeier.graphconnect2022
<dependency>
<groupId>eu.michael-simons.neo4j</groupId>
<artifactId>neo4j-migrations-quarkus</artifactId>
<version>1.6.0</version>
</dependency>
© 2022 Neo4j, Inc. All rights reserved.
47
11
© 2022 Neo4j, Inc. All rights reserved.
48
12
sdk install neo4jmigrations
jbang neo4j-migrations@neo4j
© 2022 Neo4j, Inc. All rights reserved.
49
12 13
sdk install neo4jmigrations
jbang neo4j-migrations@neo4j
neo4j-migrations
--username=neo4j
--password=secret
--location=file:<..>
apply
© 2022 Neo4j, Inc. All rights reserved.
50
12 13
14
sdk install neo4jmigrations
jbang neo4j-migrations@neo4j
neo4j-migrations
--username=neo4j
--password=secret
--location=file:<..>
apply
Applied migration 001
("InitDatabase").
Database migrated to version 001.
© 2022 Neo4j, Inc. All rights reserved.
51
…and many more
1 3
Testcontainers
Neo4j
Liquibase
Neo4j Plugin
2Neo4j GraphQL
Java
© 2022 Neo4j, Inc. All rights reserved.
© 2022 Neo4j, Inc. All rights reserved.
52
All the links
Spring Data Neo4j https://github.com/spring-projects/spring-data-neo4j/
CypherDSL https://github.com/neo4j-contrib/cypher-dsl
Neo4j-Migrations https://github.com/michael-simons/neo4j-migrations
Developer Guides https://neo4j.com/developer/language-guides/
© 2022 Neo4j, Inc. All rights reserved.
© 2022 Neo4j, Inc. All rights reserved.
53
IDEA-INSTRUCTIONS.COM
CC by-nc-sa 4.0 Sebastian Morr
© 2022 Neo4j, Inc. All rights reserved.
© 2022 Neo4j, Inc. All rights reserved.
54
Thank you!
twitter.com/meistermeier
github.com/meistermeier

More Related Content

Similar to Getting the Most From Today's Java Tooling With Neo4j

Training Week: Introduction to Neo4j
Training Week: Introduction to Neo4jTraining Week: Introduction to Neo4j
Training Week: Introduction to Neo4jNeo4j
 
From Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfFrom Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfJosé Paumard
 
How to Import JSON Using Cypher and APOC
How to Import JSON Using Cypher and APOCHow to Import JSON Using Cypher and APOC
How to Import JSON Using Cypher and APOCNeo4j
 
Neo4j GraphSummit Copenhagen - The path to success with Graph Database and Gr...
Neo4j GraphSummit Copenhagen - The path to success with Graph Database and Gr...Neo4j GraphSummit Copenhagen - The path to success with Graph Database and Gr...
Neo4j GraphSummit Copenhagen - The path to success with Graph Database and Gr...Neo4j
 
Gg Code Mash2009 20090106
Gg Code Mash2009 20090106Gg Code Mash2009 20090106
Gg Code Mash2009 20090106Jim Shingler
 
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac...
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac..."Full Stack frameworks or a story about how to reconcile Front (good) and Bac...
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac...Fwdays
 
G*なクラウド 雲のかなたに ショートバージョン
G*なクラウド 雲のかなたに ショートバージョンG*なクラウド 雲のかなたに ショートバージョン
G*なクラウド 雲のかなたに ショートバージョンTsuyoshi Yamamoto
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraDataStax Academy
 
テストを書いてGradleプラグインの開発効率を改善しよう
テストを書いてGradleプラグインの開発効率を改善しようテストを書いてGradleプラグインの開発効率を改善しよう
テストを書いてGradleプラグインの開発効率を改善しようShunsuke Maeda
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJiayun Zhou
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extremeyinonavraham
 
Prototyping in the cloud
Prototyping in the cloudPrototyping in the cloud
Prototyping in the cloudKirsten Hunter
 
Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPJeremy Kendall
 
A Importância do JavaFX no Mercado Embedded
A Importância do JavaFX no Mercado EmbeddedA Importância do JavaFX no Mercado Embedded
A Importância do JavaFX no Mercado EmbeddedBruno Borges
 
De CRUD à DDD pas à pas
De CRUD à DDD pas à pasDe CRUD à DDD pas à pas
De CRUD à DDD pas à pasCharles Desneuf
 
Introduction to Spring Boot.pdf
Introduction to Spring Boot.pdfIntroduction to Spring Boot.pdf
Introduction to Spring Boot.pdfShaiAlmog1
 
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)James Titcumb
 

Similar to Getting the Most From Today's Java Tooling With Neo4j (20)

Training Week: Introduction to Neo4j
Training Week: Introduction to Neo4jTraining Week: Introduction to Neo4j
Training Week: Introduction to Neo4j
 
From Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdfFrom Java 11 to 17 and beyond.pdf
From Java 11 to 17 and beyond.pdf
 
MeteorJS Meetup
MeteorJS MeetupMeteorJS Meetup
MeteorJS Meetup
 
How to Import JSON Using Cypher and APOC
How to Import JSON Using Cypher and APOCHow to Import JSON Using Cypher and APOC
How to Import JSON Using Cypher and APOC
 
Neo4j GraphSummit Copenhagen - The path to success with Graph Database and Gr...
Neo4j GraphSummit Copenhagen - The path to success with Graph Database and Gr...Neo4j GraphSummit Copenhagen - The path to success with Graph Database and Gr...
Neo4j GraphSummit Copenhagen - The path to success with Graph Database and Gr...
 
Gg Code Mash2009 20090106
Gg Code Mash2009 20090106Gg Code Mash2009 20090106
Gg Code Mash2009 20090106
 
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac...
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac..."Full Stack frameworks or a story about how to reconcile Front (good) and Bac...
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac...
 
G*なクラウド 雲のかなたに ショートバージョン
G*なクラウド 雲のかなたに ショートバージョンG*なクラウド 雲のかなたに ショートバージョン
G*なクラウド 雲のかなたに ショートバージョン
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache Cassandra
 
テストを書いてGradleプラグインの開発効率を改善しよう
テストを書いてGradleプラグインの開発効率を改善しようテストを書いてGradleプラグインの開発効率を改善しよう
テストを書いてGradleプラグインの開発効率を改善しよう
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSF
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
 
Prototyping in the cloud
Prototyping in the cloudPrototyping in the cloud
Prototyping in the cloud
 
Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHP
 
ChtiJUG - Cassandra 2.0
ChtiJUG - Cassandra 2.0ChtiJUG - Cassandra 2.0
ChtiJUG - Cassandra 2.0
 
A Importância do JavaFX no Mercado Embedded
A Importância do JavaFX no Mercado EmbeddedA Importância do JavaFX no Mercado Embedded
A Importância do JavaFX no Mercado Embedded
 
De CRUD à DDD pas à pas
De CRUD à DDD pas à pasDe CRUD à DDD pas à pas
De CRUD à DDD pas à pas
 
Introduction to Spring Boot.pdf
Introduction to Spring Boot.pdfIntroduction to Spring Boot.pdf
Introduction to Spring Boot.pdf
 
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)
 

More from Neo4j

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansQIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansNeo4j
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...Neo4j
 
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosBBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosNeo4j
 
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Neo4j
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j
 
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfRabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j
 
Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Neo4j
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeNeo4j
 
Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j
 
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdfNeo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdfNeo4j
 
Enabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge GraphsEnabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge GraphsNeo4j
 
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdfNeo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdfNeo4j
 
Neo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with GraphNeo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with GraphNeo4j
 

More from Neo4j (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansQIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
 
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosBBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
 
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
 
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfRabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
 
Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)
 
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdfNeo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
 
Enabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge GraphsEnabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge Graphs
 
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdfNeo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
 
Neo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with GraphNeo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with Graph
 

Recently uploaded

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Getting the Most From Today's Java Tooling With Neo4j

  • 1. © 2022 Neo4j, Inc. All rights reserved. © 2022 Neo4j, Inc. All rights reserved. Getting the Most from Today’s Java Tooling With Neo4j Gerrit Meier, Staff Software Engineer (SDN/OGM)
  • 2. © 2022 Neo4j, Inc. All rights reserved. 2
  • 3. © 2022 Neo4j, Inc. All rights reserved. 3 Neo4j Java Driver Let’s connect
  • 4. © 2022 Neo4j, Inc. All rights reserved. 4 1 <dependency> <groupId>org.neo4j.driver</groupId> <artifactId>neo4j-java-driver</artifactId> <version>4.4.5</version> </dependency
  • 5. © 2022 Neo4j, Inc. All rights reserved. 5 1 <dependency> <groupId>org.neo4j.driver</groupId> <artifactId>neo4j-java-driver</artifactId> <version>4.4.5</version> </dependency 2 var driver = GraphDatabase .driver("neo4j://host:port", AuthTokens.basic("neo4j", "secret") );
  • 6. © 2022 Neo4j, Inc. All rights reserved. 6 1 <dependency> <groupId>org.neo4j.driver</groupId> <artifactId>neo4j-java-driver</artifactId> <version>4.4.5</version> </dependency 2 var driver = GraphDatabase .driver("neo4j://host:port", AuthTokens.basic("neo4j", "secret") ); 3 var records = session .run("MATCH (m:Movie) return m") .list();
  • 7. © 2022 Neo4j, Inc. All rights reserved. 7 1 <dependency> <groupId>org.neo4j.driver</groupId> <artifactId>neo4j-java-driver</artifactId> <version>4.4.5</version> </dependency 2 var driver = GraphDatabase .driver("neo4j://host:port", AuthTokens.basic("neo4j", "secret") ); 3 4 var records = session .run("MATCH (m:Movie) return m") .list(); var records = session .run( "MATCH (m:Movie) WHERE m.title = $title return m", Map.of("title", "The Matrix")) .list();
  • 8. © 2022 Neo4j, Inc. All rights reserved. 8 { tagline=Welcome to …, title=The Matrix, released=1999 } class Movie { String title; }
  • 9. © 2022 Neo4j, Inc. All rights reserved. 9 5 { tagline=Welcome to …, title=The Matrix, released=1999 } class Movie { String title; } var movies = session .run("MATCH (m:Movie) return m") .list(record -> { var movieNode = record.get("m").asNode(); var title = movieNode.get("title") .asString(); return new Movie(title); }); System.out.println(movies); // [Movie{title='The Matrix'}, ...]
  • 10. © 2022 Neo4j, Inc. All rights reserved. 10
  • 11. © 2022 Neo4j, Inc. All rights reserved. 11 6
  • 12. © 2022 Neo4j, Inc. All rights reserved. 12 Object Graph Mapping Sync the Graphs
  • 13. © 2022 Neo4j, Inc. All rights reserved. 13 { tagline=Welcome to …, title=The Matrix, released=1999 } class Movie { String title; }
  • 14. © 2022 Neo4j, Inc. All rights reserved. 14 { tagline=Welcome to …, title=The Matrix, released=1999 } class Movie { String title; } 1 12 7
  • 15. © 2022 Neo4j, Inc. All rights reserved. 15 2a 2b <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-neo4j</artifactId> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-neo4j</artifactId> <version>6.3.0</version> </dependency>
  • 16. © 2022 Neo4j, Inc. All rights reserved. 16 3 @Node public class Movie { @Id public final String title; public Movie(String title) { this.title = title; } }
  • 17. © 2022 Neo4j, Inc. All rights reserved. 17 3 4 @Node public class Movie { @Id public final String title; public Movie(String title) { this.title = title; } } @Node("Person") public class Actor { @Id public final String name; @Relationship("ACTED_IN") public final List<Movie> movies; public Actor(String name, List<Movie> movies) { this.name = name; this.movies = movies; } }
  • 18. © 2022 Neo4j, Inc. All rights reserved. 18 5 interface ActorRepository extends Neo4jRepository<Actor, String> {}
  • 19. © 2022 Neo4j, Inc. All rights reserved. 19 5 6 interface ActorRepository extends Neo4jRepository<Actor, String> {} Actor actor = repository.findById("Tom Hanks").get(); System.out.println(actor); // Actor{name='Tom Hanks', // movies=[ // Movie{title='Apollo 13'}, // Movie{title='You've Got Mail'}, // ..]
  • 20. © 2022 Neo4j, Inc. All rights reserved. 20 7 <dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j-ogm-core</artifactId> <version>3.2.33</version> </dependency>
  • 21. © 2022 Neo4j, Inc. All rights reserved. 21 8 9 @NodeEntity("Person") public class Actor { @Id public String name; @Relationship("ACTED_IN") public List<Movie> movies; } @NodeEntity public class Movie { @Id public String title; }
  • 22. © 2022 Neo4j, Inc. All rights reserved. 22 10 var sessionFactory = new SessionFactory( new Configuration.Builder() .uri("neo4j://localhost:7687") .credentials("neo4j", "secret") .build(), "domainPackage");
  • 23. © 2022 Neo4j, Inc. All rights reserved. 23 10 11 var sessionFactory = new SessionFactory( new Configuration.Builder() .uri("neo4j://localhost:7687") .credentials("neo4j", "secret") .build(), "domainPackage"); var session = sessionFactory.openSession(); var tomHanks = session.queryForObject(Actor.class, "MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE p.name = $name return p, collect(r), collect(m)", Map.of("name", "Tom Hanks")); System.out.println(tomHanks); // Actor{ // name='Tom Hanks', // movies=[ // Movie{title='Apollo 13'}, // Movie{title='The Polar Express'}, // ... // ]}
  • 24. © 2022 Neo4j, Inc. All rights reserved. 24 12 quarkus.neo4j.uri=neo4j://localhost:7687 quarkus.neo4j.authentication.username=neo4j quarkus.neo4j.authentication.password=secret org.neo4j.ogm.base-packages= com.meistermeier.graphconnect2022.domain <dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j-ogm-core</artifactId> <version>3.2.33</version> </dependency>
  • 25. © 2022 Neo4j, Inc. All rights reserved. 25 13 @Inject SessionFactory sessionFactory; @GET @Produces(MediaType.TEXT_PLAIN) public String hello() { var session = sessionFactory.openSession(); var tomHanks = session.queryForObject( Actor.class, "MATCH (p:Person)...", Map.of("name", "Tom Hanks")); return tomHanks.name; } ➜ ~ curl http://localhost:8080/hello Tom Hanks% 12 quarkus.neo4j.uri=neo4j://localhost:7687 quarkus.neo4j.authentication.username=neo4j quarkus.neo4j.authentication.password=secret org.neo4j.ogm.base-packages= com.meistermeier.graphconnect2022.domain <dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j-ogm-core</artifactId> <version>3.2.33</version> </dependency>
  • 26. © 2022 Neo4j, Inc. All rights reserved. 26 14
  • 27. © 2022 Neo4j, Inc. All rights reserved. 27 14 15
  • 28. © 2022 Neo4j, Inc. All rights reserved. 28 Cypher-DSL Writing Cypher in a type-safe way
  • 29. © 2022 Neo4j, Inc. All rights reserved. 29 MATCH CREATE MERGE WHERE n.name=$name CALL RETURN n{...}
  • 30. © 2022 Neo4j, Inc. All rights reserved. 30 1 <dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j-cypher-dsl</artifactId> <version>2022.4.0</version> </dependency>
  • 31. © 2022 Neo4j, Inc. All rights reserved. 31 1 2 var query; = "MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE p.name = $name return p, collect(r), collect(m)"; <dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j-cypher-dsl</artifactId> <version>2022.4.0</version> </dependency>
  • 32. © 2022 Neo4j, Inc. All rights reserved. 32 1 2 var query; = "MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE p.name = $name return p, collect(r), collect(m)"; <dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j-cypher-dsl</artifactId> <version>2022.4.0</version> </dependency>
  • 33. © 2022 Neo4j, Inc. All rights reserved. 33 1 2 var query; = "MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) WHERE p.name = $name return p, collect(r), collect(m)"; <dependency> <groupId>org.neo4j</groupId> <artifactId>neo4j-cypher-dsl</artifactId> <version>2022.4.0</version> </dependency> 3 Cypher.node("Person").named("p") Cypher.node("Movie").named("m")
  • 34. © 2022 Neo4j, Inc. All rights reserved. 34 4 var personNode = Cypher.node("Person").named("p"); var movieNode = Cypher.node("Movie").named("m"); var actedIn = personNode.relationshipTo(movieNode).named("r"); var condition = personNode.property("name").eq(Cypher.parameter("name")); Cypher.match(actedIn).where(condition).returning( personNode.as("person"), Functions.collect(movieNode).as("movies"), Functions.collect(actedIn).as("relationships"));
  • 35. © 2022 Neo4j, Inc. All rights reserved. 35 4 5 var personNode = Cypher.node("Person").named("p"); var movieNode = Cypher.node("Movie").named("m"); var actedIn = personNode.relationshipTo(movieNode).named("r"); var condition = personNode.property("name").eq(Cypher.parameter("name")); Cypher.match(actedIn).where(condition).returning( personNode.as("person"), Functions.collect(movieNode).as("movies"), Functions.collect(actedIn).as("relationships")); var renderedStatement = Renderer.getDefaultRenderer().render(statement); System.out.println(renderedStatement); // MATCH (p:`Person`)-[r]->(m:`Movie`) // WHERE p.name = $name // RETURN p AS person, // collect(m) AS movies, // collect(r) AS relationships
  • 36. © 2022 Neo4j, Inc. All rights reserved. 36 Neo4j-Migrations Friends do let friends write upgrade scripts
  • 37. © 2022 Neo4j, Inc. All rights reserved. 37
  • 38. © 2022 Neo4j, Inc. All rights reserved. 38 1 12 9 7
  • 39. © 2022 Neo4j, Inc. All rights reserved. 39 1 <dependency> <groupId>eu.michael-simons.neo4j</groupId> <artifactId>neo4j-migrations</artifactId> <version>1.6.0</version> </dependency>
  • 40. © 2022 Neo4j, Inc. All rights reserved. 40 1 2 <dependency> <groupId>eu.michael-simons.neo4j</groupId> <artifactId>neo4j-migrations</artifactId> <version>1.6.0</version> </dependency> // V001__InitialImport.cypher CREATE (:Movie{title: 'The Matrix'});
  • 41. © 2022 Neo4j, Inc. All rights reserved. 41 1 2 3 <dependency> <groupId>eu.michael-simons.neo4j</groupId> <artifactId>neo4j-migrations</artifactId> <version>1.6.0</version> </dependency> // V001__InitialImport.cypher CREATE (:Movie{title: 'The Matrix'}); var config = MigrationsConfig.defaultConfig(); var migrations = new Migrations(config, driver); migrations.apply()
  • 42. © 2022 Neo4j, Inc. All rights reserved. 42 1 2 4 <dependency> <groupId>eu.michael-simons.neo4j</groupId> <artifactId>neo4j-migrations</artifactId> <version>1.6.0</version> </dependency> // V001__InitialImport.cypher CREATE (:Movie{title: 'The Matrix'}); 3 var config = MigrationsConfig.defaultConfig(); var migrations = new Migrations(config, driver); migrations.apply()
  • 43. © 2022 Neo4j, Inc. All rights reserved. 43 5 public class V002__InitialImport implements JavaBasedMigration { @Override public void apply(MigrationContext context) { try (Session session = context.getSession()) { session.run("CREATE (m:Movie{title:'The Matrix'})").consume(); } } }
  • 44. © 2022 Neo4j, Inc. All rights reserved. 44 5 public class V002__InitialImport implements JavaBasedMigration { @Override public void apply(MigrationContext context) { try (Session session = context.getSession()) { session.run("CREATE (m:Movie{title:'The Matrix'})").consume(); } } } 6
  • 45. © 2022 Neo4j, Inc. All rights reserved. 45 7 8 <dependency> <groupId>eu.michael-simons.neo4j</groupId> <artifactId>neo4j-migrations-spring-boot-starter</artifactId> <version>1.6.0</version> </dependency> org.neo4j.migrations.packages-to-scan=com.meistermeier.graphconnect2022
  • 46. © 2022 Neo4j, Inc. All rights reserved. 46 9 10 org.neo4j.migrations.packages-to-scan=com.meistermeier.graphconnect2022 <dependency> <groupId>eu.michael-simons.neo4j</groupId> <artifactId>neo4j-migrations-quarkus</artifactId> <version>1.6.0</version> </dependency>
  • 47. © 2022 Neo4j, Inc. All rights reserved. 47 11
  • 48. © 2022 Neo4j, Inc. All rights reserved. 48 12 sdk install neo4jmigrations jbang neo4j-migrations@neo4j
  • 49. © 2022 Neo4j, Inc. All rights reserved. 49 12 13 sdk install neo4jmigrations jbang neo4j-migrations@neo4j neo4j-migrations --username=neo4j --password=secret --location=file:<..> apply
  • 50. © 2022 Neo4j, Inc. All rights reserved. 50 12 13 14 sdk install neo4jmigrations jbang neo4j-migrations@neo4j neo4j-migrations --username=neo4j --password=secret --location=file:<..> apply Applied migration 001 ("InitDatabase"). Database migrated to version 001.
  • 51. © 2022 Neo4j, Inc. All rights reserved. 51 …and many more 1 3 Testcontainers Neo4j Liquibase Neo4j Plugin 2Neo4j GraphQL Java
  • 52. © 2022 Neo4j, Inc. All rights reserved. © 2022 Neo4j, Inc. All rights reserved. 52 All the links Spring Data Neo4j https://github.com/spring-projects/spring-data-neo4j/ CypherDSL https://github.com/neo4j-contrib/cypher-dsl Neo4j-Migrations https://github.com/michael-simons/neo4j-migrations Developer Guides https://neo4j.com/developer/language-guides/
  • 53. © 2022 Neo4j, Inc. All rights reserved. © 2022 Neo4j, Inc. All rights reserved. 53 IDEA-INSTRUCTIONS.COM CC by-nc-sa 4.0 Sebastian Morr
  • 54. © 2022 Neo4j, Inc. All rights reserved. © 2022 Neo4j, Inc. All rights reserved. 54 Thank you! twitter.com/meistermeier github.com/meistermeier