This is a simple Java + Spring Boot project which uses Neo4J with Spring Data. The project shows how a simple domain model can be implemented with some basic use-cases.
- To show different approaches, the same thing might be implemented in different ways in the code.
- I've used comments throughout the code to underline the ideas.
- Basic project setup (Java + Spring Boot + Neo4J + Spring Data)
- Domain Model (Product <> Shop <> Location)
- Implementation of repositories
- Partial read and write operations using projections
- Some REST-controllers
- Tests
- Use of Lombok for clean code
docker run --publish=7474:7474 --publish=7687:7687 --env=NEO4J_AUTH=none neo4j:4.3.6
./gradlew bootrun
./gradlew check
http://localhost:8080/swagger-ui/index.html
http://localhost:7474/browser/
With: neo4j / neo4j
See: https://hub.docker.com/_/neo4j
Find all products which are sold in "Karlsruhe":
MATCH (p:product)-[r:SOLD_BY]->(s:shop)
WHERE EXISTS {
MATCH (s)-[:LOCATED_AT]->(:location {city: 'Karlsruhe'})
}
RETURN p.name, s.name
Result:
p.name | s.name
-----------------+------------
"USB Cabel" | "ATU"
"Cleaning Spray" | "ATU"