[FEATURE] Add RDF/SPARQL graph store with optional Neptune IAM authentication - #405
Draft
KilianTrunk wants to merge 4 commits into
Draft
[FEATURE] Add RDF/SPARQL graph store with optional Neptune IAM authentication#405KilianTrunk wants to merge 4 commits into
KilianTrunk wants to merge 4 commits into
Conversation
Co-authored-by: Matic <majericmatic@gmail.com> Co-authored-by: Tom Soru <tom@tommaso-soru.it>
Co-authored-by: Matic <majericmatic@gmail.com> Co-authored-by: Tom Soru <tom@tommaso-soru.it>
Co-authored-by: Matic <majericmatic@gmail.com> Co-authored-by: Tom Soru <tom@tommaso-soru.it>
charlesivie
reviewed
Jul 17, 2026
|
|
||
| Supported schemes are: | ||
|
|
||
| | Scheme | Endpoint transport | |
There was a problem hiding this comment.
Are all these bespoke scheme extensions really nessecary? It measn that developers will have to do some string concatination any time they want to pass in a SPARQL endpoint. I would prefer we found another way to specify specific headers for authentication.
…book Add lexical_graph.ttl, the RDF schema for the lexical-graph vocabulary (lg:Source, lg:Chunk, lg:Topic, lg:Statement, lg:Fact, lg:Entity, lg:Relation, lg:SysClass, lg:SysRelation and their properties), inside the sparql package so it installs and ships with the backend. Verified against a live store: every term the write path emits is declared. lg:subject and lg:object deliberately carry no rdfs:range, because each takes either an Entity IRI or a plain literal. Source and Chunk metadata keys become lg:<key> properties dynamically and are documented as a note rather than enumerated. Add 00-SPARQL-Setup.ipynb so the published image can be pointed at any SPARQL 1.1 endpoint without a source checkout. It registers the contrib SPARQLGraphStoreFactory - the one step environment variables cannot do - wires the graph and vector stores from GRAPH_STORE/VECTOR_STORE, verifies endpoint connectivity, loads the ontology into its own named graph so the schema stays separate from tenant instance data, and documents tenant named-graph scoping. The other notebooks in the folder target Neo4j. Add Dockerfile.hub and a repo-root .dockerignore that build the self-contained image: lexical-graph and the RDF/SPARQL contrib baked in, an embedded empty pgvector as the vector store, the example notebooks and JupyterLab. The graph store (RDFox, Fuseki, Neptune, ...) stays external.
KilianTrunk
marked this pull request as draft
July 23, 2026 13:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new
lexical-graph-contrib/sparqlpackage for storing and retrieving the lexical graph through SPARQL 1.1 query and update endpoints.The package uses RDFLib and supports generic HTTP endpoints. It also provides optional IAM authentication for the Amazon Neptune SPARQL endpoint.
Lexical graph builders and retrievers now pass a
GraphOperationvalue together with the existing graph query. The SPARQL graph store uses this value to select its native SPARQL implementation. Existing graph stores continue to execute their existing queries.Changes
graphrag-toolkit-lexical-graph-sparqlcontributor package.sparql,sparql+http,sparql+https, andsparql+neptuneconnection schemes.neptune-dbservice.GraphOperationthrough retries, batched writes, query trees, and multi-tenant graph stores.local-devtographrag-toolkit-rdf-dev.root, applyfix-permissionsto the Conda and notebook-user directories, and then return to thejovyanuser.Problem
The toolkit did not provide a
GraphStoreimplementation for SPARQL query and update endpoints.Because of this, the lexical graph storage interface could not be used with an RDF store through SPARQL. The toolkit also did not provide an IAM-signed transport for requests to the Amazon Neptune SPARQL endpoint.
This PR adds the missing SPARQL graph store as a contributor package while keeping the current graph stores and query execution paths.
Related issue (if any): N/A
Testing
pytest)Test results:
pytest lexical-graph-contrib/sparql/tests: 108 passedpytest lexical-graph/tests: 1,756 passed and 1 skippedgit diff --check upstream/main...HEAD: no errorsEndpoint behavior was tested manually against RDFox, GraphDB, and Amazon Neptune.
Checklist
The new
GraphOperationargument is optional. Graph stores without an operation-specific implementation continue to execute their existing query.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.