Skip to content
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

revert colons in qnames? #867

Open
joernhees opened this issue Oct 28, 2018 · 1 comment
Open

revert colons in qnames? #867

joernhees opened this issue Oct 28, 2018 · 1 comment
Labels
bug Something isn't working discussion serialization Related to serialization. SPARQL

Comments

@joernhees
Copy link
Member

joernhees commented Oct 28, 2018

The change of #663 caused the following changed behavior:

import rdflib
print(rdflib.Graph().namespace_manager.compute_qname('http://dbpedia.org/page/Category:Software_bugs'))

before:

('ns1', rdflib.term.URIRef('http://dbpedia.org/page/Category:'), 'Software_bugs')

after:

('ns1', rdflib.term.URIRef('http://dbpedia.org/page/'), 'Category:Software_bugs')

The generated normalized URI causes trouble on for example the DBpedia endpoint:

prefix ns1: <http://dbpedia.org/page/>
select * { ?s ?p ns1:Category:Software_bugs }

On closer inspection ns1:Category:Software_bugs is however both: a valid CURIE and a valid SPARQL PrefixedName, so this is likely a Virtuoso bug.

ns1:Category:Software_bugs is however not a valid QName, which given the name of the compute_qname function is at least problematic.

Maybe as #649 is already dealing with this by introducing a compute_qname_strict, it could be solved in there, maybe by just renaming the new compute_qname to compute_curie and give it a dialect arg???

@tgbugs
Copy link
Contributor

tgbugs commented Oct 28, 2018

The compute_curie option seems reasonable. I tried a number of variants when implementing compute_qname_strict and it seemed that it was more performant to not have to check whether it was strict or not every time. The same might be true of a dialect arg. There are a number of other use cases for dialect args, e.g. whether a / should be allowed in the suffix.

When I was working on this I recall finding many bugs in other rdf parsing/serializing libs because they had not dealt with the fact that curies are not strictly qnames, so the virtuoso issue wouldn't surprise me at all.

@white-gecko white-gecko modified the milestones: rdflib 5.0.0, rdflib 5.1.0 Apr 6, 2020
@white-gecko white-gecko modified the milestones: rdflib 5.1.0, rdflib 6.0.0 May 1, 2020
joernhees added a commit to RDFLib/graph-pattern-learner that referenced this issue Mar 24, 2021
rdflib master currently handles prefixes in a weird way:
RDFLib/rdflib#867
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discussion serialization Related to serialization. SPARQL
Projects
None yet
Development

No branches or pull requests

3 participants