Skip to content

fix(download): use setMethod('POST') for SPARQL wrapper#73

Open
Prakhar54-byte wants to merge 1 commit into
dbpedia:mainfrom
Prakhar54-byte:bug/sparql-set-method
Open

fix(download): use setMethod('POST') for SPARQL wrapper#73
Prakhar54-byte wants to merge 1 commit into
dbpedia:mainfrom
Prakhar54-byte:bug/sparql-set-method

Conversation

@Prakhar54-byte

@Prakhar54-byte Prakhar54-byte commented Jul 5, 2026

Copy link
Copy Markdown

Resolves #69

Using direct attribute assignment on SPARQLWrapper (sparql.method = 'POST') is silently ignored by the wrapper, which defaults to GET. Large SPARQL queries (e.g. from collection endpoints) then exceed GET URL-length limits.

This PR uses the correct setMethod('POST') API, and updates the DummySPARQL test stub to mock the method appropriately.

Summary by CodeRabbit

  • Bug Fixes
    • Improved how POST-based SPARQL queries are configured, helping download requests work more reliably.
    • Updated test support for the SPARQL client so local test runs remain compatible when the external library is unavailable.

Using direct attribute assignment on SPARQLWrapper is silently ignored;
the wrapper defaults to GET for all queries. Large SPARQL queries (e.g.
those returned by collection endpoints) exceed GET URL-length limits and
fail. The correct API is setMethod().

Also add setMethod() to the DummySPARQL test stub in conftest.py so the
unit test suite does not break when the real API call is made.

Closes #<BUG-02>
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The _query_sparql_endpoint function now configures the SPARQL request method via sparql.setMethod("POST") instead of directly setting the method attribute. The test double DummySPARQL in conftest.py adds a matching setMethod method to support this change.

Changes

SPARQL POST Method Fix

Layer / File(s) Summary
Switch to setMethod call and update test stub
databusclient/api/download.py, tests/conftest.py
Replaces direct method attribute assignment with sparql.setMethod("POST") and adds a corresponding setMethod method to the fake SPARQLWrapper used in tests.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description summarizes the fix and issue, but it omits the required type-of-change and checklist sections from the template. Add the template sections for Type of change and Checklist, including test/ruff confirmation and any documentation or self-review details.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states the SPARQL wrapper POST method fix and matches the main code change.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

bug:sparql.method = "POST" silently ignored — SPARQL queries always use GET

1 participant