-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parseQuery
decode the query string which cause invalid URI
#1957
Comments
@kfrawee will look when I have time |
Looks like an issue with the SPARQL parser so it might be some time before it's fixed. In the interim, you can work around the problem by replacing |
fwiw:
|
Ah, I was close but not close enough. I'm still exploring the ramifications but if you're prepared to make a small edit to rdflib/rdflib/plugins/sparql/parser.py Line 230 in 6ed2ef4
def _hexExpand(match):
- return chr(int(match.group(0)[1:], 16))
+ if match.group(0) == "%20":
+ return match.group(0)
+ else:
+ return chr(int(match.group(0)[1:], 16)) |
It is not specific for "%20". I am using urllib.parse.quote to URL encode the ttl and quires. So, the same behavior happens to the rest of the characters. |
Yes, indeed so. I addressed the entire set of percent encoded reserved characters in the PR #1959 I submitted. |
I have the following ttl file:
And I have the following query:
While trying to query the graph I got from the ttl file I got the following error:
https://www.example.co/reserved/language#transcript data does not look like a valid URI, trying to serialize this will break.
As you see,
parseQuery
has decoded the "%20" to a space " " which cases invalid URI. And this will returnFalse
while passed to_is_valid_uri
function.I've tested the query on different SPARQL engines and it is valid and works as expected.
So, what do you advise? to make the query valid and get the required results?
I am using rdflib Version: 6.1.1 on macOS Monterey 12.4
The text was updated successfully, but these errors were encountered: