-
Notifications
You must be signed in to change notification settings - Fork 563
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
rdflib 6.2.0 SPARQL parsing regression: multiple prefixes for same IRI not supported? #2077
Comments
I agree with you that I think it is problematic, I don't really see anything wrong with multiple prefixes either, maybe one concern is that we could end up with ambiguity in what the output of serializers that support namespaces will be, but I don't really think that is reason enough to not support multiple prefixes mapping to the same URI. |
Sorry for the accidental closure. |
I've looked into this further, motivated by the issues I described in #2348. The root of the problem is at least reflected in the fact that the All of the implementations of rdflib/rdflib/plugins/stores/memory.py Lines 531 to 537 in cbd6151
which might change to something like:
There are tests now that enforce the current behavior - |
If the above seems reasonable, I'd be willing to open a PR to make the changes. It seems like a potentially-significant change though, so some discussion of the change seems indicated. |
* Changed the tests to use an in-module fixture instead of the `test_ontology.owl` graph and removed the `test_ontology.owl` file. The problem with arbitrary test data is that it is hard to evolve. If possible test data should be kept as terse as possible. In this case I just created a namespace manager with three namespaces added, of which only two will be effective because of <RDFLib#2077>. * Added a warning to `NamespaceManager.curie` to warn users that it is not a pure function and explain the specific side effects.
Added a `curie` method to `NamespaceManager`, which can be used to generate a CURIE from a URI. Other changes: - Fixed `NamespaceManager.expand_curie` to work with CURIES that have blank prefixes (e.g. `:something`), which are valid according to [CURIE Syntax 1.0](https://www.w3.org/TR/2010/NOTE-curie-20101216/). - Added a test to confirm <#2077>. Fixes <#2348>. --------- Co-authored-by: Iwan Aucamp <[email protected]>
This error came in with one of these PRs: |
I believe this is also the source of an issue with default prefixes: This works:
This causes:
|
Following for this issue. Has this been resolved yet? I too am not able to keep multiple IRI for different prefixes and need this feature. |
The pr #2800 introduces the tests for this issue. My use case as:
So this touches both, the issue of duplicate prefixes and of parsing/serialization side effects. |
I have a standard block of SPARQL prefixes that I use in some of my code, and I started getting test failures when I tried to update from rdflib 6.1.1 to rdflib 6.2.0. I noticed that the problem seems to be that somehow, support for multiple prefixes that resolve to the same URI seems to have been dropped.
Example block at the beginning of a SPARQL query:
The above should, as far as I know, be supported - but in rdflib 6.2.0, the
foo:
prefix will not be recognized when used in the query - and in fact, during parsing of the query, thefoo:
prefix is deleted.The issue seems to be somewhere in
rdfllib.namespace.__init__.py
, inNamespaceManager.bind()
- but I can't quite pin down what change is causing this new issue.I do see this comment in the code, which was present in 6.1.1 but maybe it wasn't working as described?
however, if I correctly understand the intent behind that comment, it seems problematic - there is nothing wrong (as far as I know?) with multiple prefixes for the same URI in SPARQL.
The text was updated successfully, but these errors were encountered: