Skip to content

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

Description

@Prakhar54-byte

Bug Report

**Describe the bug**                                                                                                      
`_query_sparql_endpoint()` in `download.py` attempts to force HTTP POST for SPARQL                                        
queries by directly assigning to the attribute:                                                                           
                                                                                                                          
```python                                                                                                                 
sparql.method = "POST"                                                                                                    

However, SPARQLWrapper does not expose .method as a settable public attribute.
This assignment is silently ignored and the wrapper defaults to GET for all queries.

As a result, large SPARQL queries (e.g. those returned by collection endpoints) are
sent as GET requests, causing failures due to URL length limits on the server side.

To Reproduce

  1. Install the client: pip install databusclient

  2. Download a large collection:
    databusclient download https://databus.dbpedia.org/dbpedia/collections/dbpedia-snapshot-2022-12

  3. Observe that the underlying SPARQL query is sent via GET, which may fail for large
    collection queries that exceed server-side URL length limits.

Expected behavior
The SPARQL query should be sent via HTTP POST. SPARQLWrapper provides the correct
API for this:

sparql.setMethod("POST")   # correct ✅                                                                                   
# NOT: sparql.method = "POST"  (silently ignored ❌)                                                                      

Root Cause
File: databusclient/api/download.py , function _query_sparql_endpoint() , line 593.

# current (broken)                                                                                                        
sparql = SPARQLWrapper(endpoint_url)                                                                                      
sparql.method = "POST"      # ← has no effect                                                                             
                                                                                                                          
# fix                                                                                                                     
sparql = SPARQLWrapper(endpoint_url)                                                                                      
sparql.setMethod("POST")    # ← correct SPARQLWrapper API                                                                 

Additional context

• SPARQLWrapper version in use: ^2.0.0 (see pyproject.toml )
• The setMethod API has been available since SPARQLWrapper 1.x
• This affects any download that goes through a SPARQL query path: collections,
custom --databus queries, and group/artifact resolution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions