Skip to content
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ hugegraph-server/hugegraph-dist/docker/data/

# AI-IDE prompt files (We only keep AGENTS.md, other files could soft-linked it when needed)
# Serena MCP memories
.serena/
.serena/*
!.serena/project.yml
!.serena/memories/
.mcp.json
# Claude Projects
CLAUDE.md
CLAUDE_*.md
Expand All @@ -114,3 +117,4 @@ codeium-instructions.md
.ai-instructions.md
*.ai-prompt.md
WARP.md
.mcp.json
106 changes: 21 additions & 85 deletions .serena/memories/architecture_and_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,97 +3,33 @@
## Three-Tier Architecture

### 1. Client Layer
- Gremlin/Cypher query interfaces
- REST API endpoints
- Multiple client language bindings
- Gremlin/Cypher queries, REST APIs, Swagger UI

### 2. Server Layer (hugegraph-server)
- **REST API Layer** (hugegraph-api): GraphAPI, SchemaAPI, GremlinAPI, CypherAPI, AuthAPI
- **Graph Engine Layer** (hugegraph-core): Schema management, traversal optimization, task scheduling
- **Backend Interface**: Abstraction over storage backends
### 2. Server Layer (hugegraph-server, 13 submodules)
- **REST API** (hugegraph-api): GraphAPI, SchemaAPI, GremlinAPI, CypherAPI, AuthAPI, GraphSpaceAPI (distributed only), ManagerAPI (distributed only)
- **Graph Engine** (hugegraph-core): Schema (with TTL update), traversal, task scheduling, GraphSpace multi-tenancy
- **Backend Interface**: Pluggable via `BackendStore`

### 3. Storage Layer
- Pluggable backend implementations
- Each backend extends `hugegraph-core` abstractions
- Implements `BackendStore` interface
- RocksDB (default/embedded), HStore (distributed/production)
- Legacy (≤1.5.0, deprecated, excluded from context): MySQL, PostgreSQL, Cassandra, ScyllaDB, HBase, Palo

## Multi-Module Structure
## Module Structure (7 top-level modules)

The project consists of 7 main modules:
### hugegraph-server (13 submodules)
`hugegraph-core`, `hugegraph-api` (includes `opencypher/`, `space/`), `hugegraph-dist`, `hugegraph-test`, `hugegraph-example`, plus backends: `hugegraph-rocksdb`, `hugegraph-hstore`, `hugegraph-hbase`, `hugegraph-mysql`, `hugegraph-postgresql`, `hugegraph-cassandra`, `hugegraph-scylladb`, `hugegraph-palo`

### 1. hugegraph-server (13 submodules)
Core graph engine, REST APIs, and backend implementations:
- `hugegraph-core` - Core graph engine and abstractions
- `hugegraph-api` - REST API implementations (includes OpenCypher in `opencypher/`)
- `hugegraph-dist` - Distribution packaging and scripts
- `hugegraph-test` - Test suites (unit, core, API, TinkerPop)
- `hugegraph-example` - Example code
- Backend implementations:
- `hugegraph-rocksdb` (default)
- `hugegraph-hstore` (distributed)
- `hugegraph-hbase`
- `hugegraph-mysql`
- `hugegraph-postgresql`
- `hugegraph-cassandra`
- `hugegraph-scylladb`
- `hugegraph-palo`
### hugegraph-pd (8 submodules)
Placement Driver: `hg-pd-core`, `hg-pd-service`, `hg-pd-client`, `hg-pd-common`, `hg-pd-grpc`, `hg-pd-cli`, `hg-pd-dist`, `hg-pd-test`

### 2. hugegraph-pd (8 submodules)
Placement Driver for distributed deployments (meta server):
- `hg-pd-core` - Core PD logic
- `hg-pd-service` - PD service implementation
- `hg-pd-client` - Client library
- `hg-pd-common` - Shared utilities
- `hg-pd-grpc` - gRPC protocol definitions (auto-generated)
- `hg-pd-cli` - Command line interface
- `hg-pd-dist` - Distribution packaging
- `hg-pd-test` - Test suite
### hugegraph-store (9 submodules)
Distributed storage + Raft: `hg-store-core`, `hg-store-node`, `hg-store-client`, `hg-store-common`, `hg-store-grpc`, `hg-store-rocksdb`, `hg-store-cli`, `hg-store-dist`, `hg-store-test`

### 3. hugegraph-store (9 submodules)
Distributed storage backend with RocksDB and Raft:
- `hg-store-core` - Core storage logic
- `hg-store-node` - Storage node implementation
- `hg-store-client` - Client library
- `hg-store-common` - Shared utilities
- `hg-store-grpc` - gRPC protocol definitions (auto-generated)
- `hg-store-rocksdb` - RocksDB integration
- `hg-store-cli` - Command line interface
- `hg-store-dist` - Distribution packaging
- `hg-store-test` - Test suite
### Others
- **hugegraph-commons**: Shared utilities, RPC framework
- **hugegraph-struct**: Data structures (must build before PD/Store)
- **install-dist**: Distribution packaging, license files
- **hugegraph-cluster-test**: Cluster integration tests

### 4. hugegraph-commons
Shared utilities across modules:
- Locks and concurrency utilities
- Configuration management
- RPC framework components

### 5. hugegraph-struct
Data structure definitions shared between modules.
**Important**: Must be built before PD and Store modules.

### 6. install-dist
Distribution packaging and release management:
- License and NOTICE files
- Dependency management scripts
- Release documentation

### 7. hugegraph-cluster-test
Cluster integration tests for distributed deployments

## Cross-Module Dependencies

```
hugegraph-commons → (shared by all modules)
hugegraph-struct → hugegraph-pd + hugegraph-store
hugegraph-core → (extended by all backend implementations)
```

## Distributed Architecture (Optional)

For production distributed deployments:
- **hugegraph-pd**: Service discovery, partition management, metadata
- **hugegraph-store**: Distributed storage with Raft (3+ nodes)
- **hugegraph-server**: Multiple server instances (3+)
- Communication: All use gRPC with Protocol Buffers

**Status**: Distributed components (PD + Store) are in BETA
## Distributed Deployment (BETA)
PD + Store + Server (3+ nodes each), all gRPC. Docker compose configs in `docker/` directory, using bridge networking (migrated from host mode).
115 changes: 26 additions & 89 deletions .serena/memories/code_style_and_conventions.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,28 @@
# Code Style and Conventions

## Code Style Configuration
- **EditorConfig**: `.editorconfig` file defines style rules
- **Checkstyle**: `style/checkstyle.xml` defines additional rules and enforcement

## Core Style Rules (from .editorconfig)

### General
- Charset: UTF-8
- End of line: LF (Unix-style)
- Insert final newline: true
- Max line length: 100 characters (120 for XML)
- Visual guides at column 100

### Java Files
- Indent: 4 spaces (not tabs)
- Continuation indent: 8 spaces
- Wrap on typing: true
- Wrap long lines: true

### Import Organization
```
$*
|
java.**
|
javax.**
|
org.**
|
com.**
|
*
```
- Class count to use import on demand: 100
- Names count to use import on demand: 100

### Formatting Rules
- Line comments not at first column
- Align multiline: chained methods, parameters in calls, binary operations, assignments, ternary, throws, extends, array initializers
- Wrapping: normal (wrap if necessary)
- Brace forcing:
- if: if_multiline
- do-while: always
- while: if_multiline
- for: if_multiline
- Enum constants: split_into_lines

### Blank Lines
- Max blank lines in declarations: 1
- Max blank lines in code: 1
- Blank lines between package declaration and header: 1
- Blank lines before right brace: 1
- Blank lines around class: 1
- Blank lines after class header: 1

### Documentation
- Add `<p>` tag on empty lines: true
- Do not wrap if one line: true
- Align multiline annotation parameters: true

### XML Files
- Indent: 4 spaces
- Max line length: 120
- Text wrap: off
- Space inside empty tag: true

### Maven
- Compiler source/target: Java 11
- Max compiler errors: 500
- Compiler args: `-Xlint:unchecked`
- Source encoding: UTF-8

## Lombok Usage
- Version: 1.18.30
- Scope: provided
- Optional: true

## License Headers
- All source files MUST include Apache Software License header
- Validated by apache-rat-plugin and skywalking-eyes
- Exclusions defined in pom.xml (line 171-221)
- gRPC generated code excluded from license check

## Naming Conventions
- Package names: lowercase, dot-separated (e.g., org.apache.hugegraph)
- Class names: PascalCase
- Method names: camelCase
- Constants: UPPER_SNAKE_CASE
- Variables: camelCase
## Style Tools
- `.editorconfig` — Primary style definition
- `style/checkstyle.xml` — Enforcement (note: `hugegraph-style.xml` was removed)
- `.licenserc.yaml` + apache-rat-plugin + skywalking-eyes — License header validation

## Core Rules
- **Line length**: 100 chars (120 for XML)
- **Indent**: 4 spaces, continuation 8 spaces
- **Charset**: UTF-8, LF line endings, final newline
- **Imports**: Sorted `$*` → `java` → `javax` → `org` → `com` → `*`, no star imports (threshold 100)
- **Braces**: `if`/`while`/`for` forced if multiline, `do-while` always
- **Blank lines**: Max 1 in code/declarations
- **JavaDoc**: `<p>` on empty lines, no wrap if one line

## Naming
- Packages: `org.apache.hugegraph.*` (lowercase dot-separated)
- Classes: PascalCase, Methods/Variables: camelCase, Constants: UPPER_SNAKE_CASE

## License
- All source files require Apache 2.0 header
- gRPC generated code excluded from checks
- Validate: `mvn apache-rat:check -ntp` + `mvn editorconfig:check`

## Build
- Java 11 target, `-Xlint:unchecked`, Lombok 1.18.30 (provided/optional)
- Swagger: `io.swagger.core.v3:swagger-jaxrs2-jakarta` for REST API docs
70 changes: 15 additions & 55 deletions .serena/memories/ecosystem_and_related_projects.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,23 @@
# HugeGraph Ecosystem and Related Projects

## Core Repository (This Project)
**Repository**: apache/hugegraph (server)
**Purpose**: Core graph database engine (OLTP)
## This Repo: apache/hugegraph (server, OLTP)

## Related Repositories
## Ecosystem
| Repo | Purpose |
|------|---------|
| hugegraph-toolchain | Loader, Hubble (visualization), Tools CLI, Java Client |
| hugegraph-computer | OLAP: PageRank, Connected Components, Shortest Path |
| incubator-hugegraph-ai | Graph RAG, KG construction, NL→Gremlin/Cypher |
| hugegraph-doc | Docs & website (hugegraph.apache.org) |

### 1. hugegraph-toolchain
**Repository**: https://github.com/apache/hugegraph-toolchain
**Components**:
- **hugegraph-loader**: Bulk data loading tool
- **hugegraph-hubble**: Web-based visualization dashboard
- **hugegraph-tools**: Command-line utilities
- **hugegraph-client**: Java client SDK

### 2. hugegraph-computer
**Repository**: https://github.com/apache/hugegraph-computer
**Purpose**: Distributed graph computing framework (OLAP)
**Features**: PageRank, Connected Components, Shortest Path, Community Detection

### 3. hugegraph-ai
**Repository**: https://github.com/apache/incubator-hugegraph-ai
**Purpose**: Graph AI, LLM, and Knowledge Graph integration
**Features**: Graph-enhanced LLM, KG construction, Graph RAG, NL to Gremlin/Cypher

### 4. hugegraph-website
**Repository**: https://github.com/apache/hugegraph-doc
**Purpose**: Official documentation and website
**URL**: https://hugegraph.apache.org/

## Integration Points

### Data Pipeline
## Data Flow
```
Data Sources → hugegraph-loader → hugegraph-server
┌───────────────────┼───────────────────┐
↓ ↓ ↓
hugegraph-hubble hugegraph-computer hugegraph-ai
(Visualization) (Analytics) (AI/ML)
Sources → hugegraph-loader → hugegraph-server → Hubble / Computer / AI
```

## External Integrations

### Big Data Platforms
- Apache Flink, Apache Spark, HDFS

### Storage Backends
- RocksDB (default), HBase, Cassandra, ScyllaDB, MySQL, PostgreSQL

### Query Languages
- Gremlin (Apache TinkerPop), Cypher (OpenCypher), REST API

## Version Compatibility
- Server: 1.7.0
- TinkerPop: 3.5.1
- Java: 11+ required
## Integrations
- Big Data: Flink, Spark, HDFS
- Queries: Gremlin (TinkerPop 3.5.1), OpenCypher, REST API + Swagger UI
- Storage: RocksDB (default), HStore (distributed)

## Use Cases
- Social networks, Fraud detection, Recommendation systems
- Knowledge graphs, Network analysis, Supply chain management
- IT operations, Bioinformatics
## Version: Server 1.7.0, TinkerPop 3.5.1, Java 11+
Loading
Loading