Skip to content

Comments

Neptune GSP: Use UUID graph URIs instead of explicit default graph#345

Merged
jpmccu merged 3 commits intofeature/neptunefrom
copilot/update-gsp-implementation-graph-uri
Jan 4, 2026
Merged

Neptune GSP: Use UUID graph URIs instead of explicit default graph#345
jpmccu merged 3 commits intofeature/neptunefrom
copilot/update-gsp-implementation-graph-uri

Conversation

Copy link
Contributor

Copilot AI commented Jan 4, 2026

Neptune's GSP implementation was inserting all triples into an explicit default graph (via ?default parameter), breaking graph-aware semantics for TriG and other multi-graph formats. Named graphs were being flattened instead of preserved.

Changes

  • GSP operations (publish, put, post): Generate temporary UUID graph URI (urn:uuid:...), POST/PUT to that graph, then DELETE it. This forces Neptune to process graph-aware RDF correctly.
  • Configuration: Added _use_temp_graph option (default: True) for opt-out backward compatibility
  • Error handling: Cleanup DELETE always executes, even on POST/PUT failure
  • Documentation: Updated Neptune plugin README with feature explanation and config examples

Usage

# In system.conf
KNOWLEDGE_TYPE = 'neptune'
KNOWLEDGE_ENDPOINT = 'https://neptune.cluster.amazonaws.com:8182/sparql'
KNOWLEDGE_REGION = 'us-east-1'
KNOWLEDGE_USE_TEMP_GRAPH = True  # Default, enables graph-aware semantics

The UUID graph approach triggers Neptune's union graph semantics instead of explicit default graph insertion, preserving named graph structure from TriG data.

Note

Code review identified pre-existing serialization behavior in put()/post() that may serialize entire store instead of target graph. This matches existing database_utils.py implementation and is outside scope of this fix.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • neptune.example.com
    • Triggering command: /usr/bin/python3 python3 -m pytest tests/unit/test_neptune_plugin.py::TestNeptuneGSPOperations -v (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

The current GSP implementation (including the publish() call) inserts triples into an explicit default graph, as signified by the ?default parameter. This is incorrect because all RDF passed to neptune by Whyis is graph aware (usually as TRIG), and all triples end up in an explicitly named default graph, rather than using union semantics on the default graph. Change the neptune GSP implementation (publish, put, post) to provide a UUID-generated graph URI (prefereably in the uuid URI namespace) as the "default" graph to insert to, and then call to delete that default graph after the main call is complete. Make this a configurable option on the neptune database driver, but make the default to use this functionality.

Provide appropriate documentation and unit tests.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 4, 2026 20:26
Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>
Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>
Copilot AI changed the title [WIP] Update GSP implementation to use UUID-generated graph URI Neptune GSP: Use UUID graph URIs instead of explicit default graph Jan 4, 2026
Copilot AI requested a review from jpmccu January 4, 2026 20:33
@jpmccu jpmccu marked this pull request as ready for review January 4, 2026 20:38
@jpmccu jpmccu merged commit f3ce7e5 into feature/neptune Jan 4, 2026
@jpmccu jpmccu deleted the copilot/update-gsp-implementation-graph-uri branch January 4, 2026 20:38
jpmccu added a commit that referenced this pull request Jan 8, 2026
* Added initial support for neptune

* Initial neptune implementation

* Add Neptune plugin database driver with AWS IAM authentication and CloudFormation template (#344)

* Initial plan

* Add Neptune plugin IAM authentication support with database driver

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Address code review comments: add logging, imports, and documentation

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Add Neptune IAM authentication documentation to ReadTheDocs

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Expand Neptune how-to guide with detailed endpoint configuration

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Fix Neptune entity resolver to correctly use FTS service with proper escaping

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Add CloudFormation template for Neptune serverless setup with FTS

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Refactor Neptune driver to use custom session instead of subclassing

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Upgrade to rdflib 7.1.1 and simplify Neptune driver with custom session

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Use aws_requests_auth and custom_requests parameter for simpler Neptune driver

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Address code review: fix SPARQL injection, reuse session, improve efficiency

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Add test for Neptune driver registration in plugin init

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Remove redundant conditional check in driver registration test

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Neptune GSP: Use UUID graph URIs instead of explicit default graph (#345)

* Initial plan

* Add temporary UUID graph functionality for Neptune GSP operations

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Complete Neptune GSP temporary UUID graph implementation with tests

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* update UI and search

* Improved exception handling in the query filter.

* added more info to the exception message

* Add NeptuneBoto3Store with SPARQL blueprint authentication interface and improved error reporting (#347)

* Initial plan

* Add NeptuneBoto3Store with instance metadata support

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Add comprehensive documentation for NeptuneBoto3Store

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Add example script for NeptuneBoto3Store usage

* Override query() and update() methods to enable authenticated access

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Update neptune_driver to use NeptuneBoto3Store

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Add raw_sparql_request interface and improve Neptune error reporting

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* debugging and sorting out the driver initialization issues

* Fix query() and update() method signatures to properly override SPARQLStore interface

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Fix _request method error handling and add comprehensive tests for response_mime_types usage

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

* Fix HTTP error handling and add response_mime_types method to NeptuneBoto3Store

Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>
Co-authored-by: Jamie McCusker <mccusj2@rpi.edu>

* Update version from 2.4.0.dev0 to 2.4.0.beta14

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jpmccu <602385+jpmccu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants