APiGen Graph Database Support
Comprehensive graph database support for APiGen with Neo4j, Amazon Neptune, and ArangoDB. Build social networks, recommendation engines, and fraud detection systems with native graph query languages.
Features
- Multi-Database Support: Neo4j (Cypher), Amazon Neptune (Gremlin), ArangoDB (AQL)
- Unified Repository Interface: Consistent API across all graph database providers
- Query Builders: Fluent interfaces for Cypher and Gremlin query construction
- Spring Boot Integration: Auto-configuration with properties-based setup
- Graph Operations:
- CRUD operations (create, read, update, delete)
- Relationship management
- Path finding (shortest path)
- Graph traversal (BFS, DFS)
- Full-text search support
Database-Specific Features
Neo4j (Cypher)
Best for: Complex relationship queries, social networks, knowledge graphs
java
// Query with Cypher
CypherQueryBuilder query = CypherQueryBuilder.matchNode("p", "Product")
.where("p.category = $category", "category", "Electronics")
.where("p.price > $minPrice", "minPrice", 100.0)
.returns("p")
.orderBy("p.price", true)
.limit(10)
.build();Amazon Neptune (Gremlin)
Best for: AWS-native deployments, real-time graph analysis
java
// Query with Gremlin
GremlinQueryBuilder query = GremlinQueryBuilder.vertices("Product")
.has("category", "Electronics")
.has("price", "gt", 100)
.out("HAS_REVIEW")
.limit(10)
.valueMap()
.build();ArangoDB (AQL)
Best for: Multi-model use cases, flexible document + graph operations
java
// AQL Query - built-in path finding
String query = """
FOR path IN 1..3 SHORTEST
(OUTBOUND @start edges FILTER e.type IN @types)
OUTBOUND @end
RETURN [v IN path RETURN v]
""";Supported Graph Databases
| Database | Version | Query Language | Status |
|---|---|---|---|
| Neo4j | 5.x | Cypher | ✅ Supported |
| Neptune | Latest | Gremlin/TinkerPop | ✅ Supported |
| ArangoDB | 3.10+ | AQL | ✅ Supported |
Quick Start
1. Add Dependency
gradle
dependencies {
implementation 'com.jnzader:apigen-graph:1.0.0'
}2. Create Your Entity
java
public class Product extends GraphEntity {
public String name;
public Double price;
public String category;
public Set<String> tags;
}3. Implement Repository
java
@Repository
public class ProductRepository extends Neo4jRepository<Product> {
public ProductRepository(Driver driver) {
super(driver, "Product", Product.class);
}
}