sparqlwrapper icon indicating copy to clipboard operation
sparqlwrapper copied to clipboard

Raise `ValueError` when user selects incopatable formats

Open nicholascar opened this issue 3 years ago • 3 comments

This code fails because RDF is not a valid response format for a SELECT query:

from SPARQLWrapper import SPARQLWrapper, RDF, JSON, XML
sparql = SPARQLWrapper('http://ja.dbpedia.org/sparql')
sparql.setQuery('select * where { ?x ?y ?z. } limit 1')
sparql.setReturnFormat(RDF)
results = sparql.query().convert()

The code should not fail but should raise a ValueError Exception and explain why.

nicholascar avatar Jan 12 '22 22:01 nicholascar

@eggplants this is just re-issuing your Issue with better scope for resolution.

nicholascar avatar Jan 12 '22 22:01 nicholascar

@nicholascar Hi, here as a first time contributor! I tried my hands on this issue and am submitting a PR that solves it. Request you to please review it and share your thoughts on the same! Thanks!

dgupta04 avatar May 10 '22 18:05 dgupta04

Pull request added #218 with the required changes as discussed.

ananya2711 avatar May 13 '22 14:05 ananya2711