ragleap-graph (Java)
A Java port of the ragleap-graph Neo4j graph index, published to Maven Central. Regex or optional LLM entity extraction, deduplication, document upsert, relation, lineage and entity queries, and hybrid or graph-only retrieval over the Neo4j HTTP Query API.
Install
<dependency> <groupId>io.github.antonyrag</groupId> <artifactId>ragleap-graph</artifactId> <version>0.2.0</version> </dependency>
Requires Java 21. The only required runtime dependency is jackson-databind; ragleap-rag is optional and only needed for the two adapters. You need a Neo4j server with the HTTP Query API; only Neo4j 5.26 Community has been tested.
What is in 0.2.0
- Extraction: regex extraction stays the default. LLM extraction of entities and relations is optional, through a small
LlmClientinterface andExtractionConfig(regex or llm, entity types, relation ontology, cross-chunk relations, deduplication) - Deduplication:
EntityDeduplicator, with a port of Python's difflib similarity - Upsert:
GraphIndex.upsertDocumenthas the full write path (retries on transient errors, old-relation cleanup, an optional audit hook). It counts typed relations, runs the cross-chunk pass and merges near-duplicate entity names when configured - Queries:
findDocumentsByEntities,documentEntities,searchRelatedEntities,findRelations,findLineageandfindEntitiesByType - Retrieval:
GraphRetrieverandGraphRetrievalConfiggive hybrid (vector plus graph) or graph-only retrieval with chunk and graph-path citations, through theGraphSearch(implemented byGraphIndex) andVectorSearchinterfaces - Adapters over ragleap-rag (optional):
RagLeapGenerationClientfor LLM extraction andRagLeapVectorSearchfor the vector side of retrieval - Maintenance: one-time backfills (
backfillUserIdDefaults,backfillCompositeKey,backfillCoOccursWithCompositeKey) and the schema migration runner (Migration,MigrationRunner, two registered migrations) - Transport: Neo4j over the HTTP Query API v2 through a small
CypherRunnerinterface, with no Bolt driver.GraphConfigtakes an HTTP URL, not a Bolt URI. If the server cannot be reached, methods return empty results, like the Python package
How it was verified
- Compared with the real Python
ragleap-graph0.9.0 (pinned commit 226fa4d) by running the Python code against fakes that record every call: difflib similarity on 422 string pairs, 25 extraction-config cases, 59 entity and 42 relation extractor scenarios, 39 upsert-with-extraction scenarios (every Cypher statement and parameter, every model call), 24 backfill and 19 migration-runner scenarios, 28 retrieval scenarios and 21 retrieval-config cases. 27 deliberate breaks (mutation checks) across the new slices were each caught by the parity tests - Release build: 129 tests, 0 failures, 31 skipped (the parity tests need the Python-generated fixtures and the live tests need a Neo4j server, so both skip in a plain build and in CI). Full local run with fixtures and a live Neo4j 5.26.29 Community: 129 tests, 0 failures, 0 skipped
- After release, the published jar was resolved from Maven Central in a clean project (this jar plus jackson only) and exercised against a live Neo4j: health check, upsert, backfill and graph-only retrieval
Not live-verified
- LLM extraction against any real model provider (no paid keys): tested with scripted model answers and a local fake OpenAI-style server only
- Any Neo4j other than 5.26.29 Community, on a single server (bookmarks are not passed along)
RagLeapVectorSearch.of(RagLeap)was not run against a live ragleap-rag facade; its conversion and error handling are tested with a stand-in
Differences from Python
A model is reached through LlmClient instead of ragleap-rag ProviderConfig directly. Extraction failures throw ExtractionException (its pythonType() names the Python exception raised in the same situation), and results are records. The pull request bodies (#718, #722, #723, #743) list each difference. The source is in the repository.
Not ported yet
- The Postgres audit writer (a no-op audit sink is the default)