-
Notifications
You must be signed in to change notification settings - Fork 560
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
Namespace and ClosedNamespace no longer inherit from unicode, closes #596, #542 #597
Namespace and ClosedNamespace no longer inherit from unicode, closes #596, #542 #597
Conversation
Does this also mean that I cannot use DCT = Namespace('http://purl.org/dc/terms/')
u = URIRef(something)
if u.startswith(DCT):
print "yes this URI is from DC Terms" This would break some of my code (e.g. Skosify uses this pattern quite a lot) so I'd like to know. |
d0e2e9b
to
1ce951b
Compare
I don't mind if this happens in 5.0.0 since there seems to be good reasons for a) making ClosedNamespace inherit from Namespace and b) not making ClosedNamespace inherit from unicode. But I'd propose implementing an alternative facility for 5.0.0 that can be used to check whether a URIRef belongs to a specific namespace or not. Maybe even using the |
I really like using Also, Joern, you say we can no longer use |
Bonus points for implementing the same method (e.g. the |
I agree, this sounds like a good way forward! Perhaps in 4.x, |
@gromgull that's exactly what i'm asking... to what degree should we re-implement various string methods for for @osma we use http://semver.org so 4.2.2 should definitely be backwards compatible... in 4.2.1 @niklasl hmm, as we already tried making it saner without breaking things and failed, i'd like to just not touch that code in 4.2.2 anymore ;) People could have relied on I really think the cleanup belongs in 5.0.0 as it's a new major release and ok to break backwards compatibility to some degree... only question is the base-class... What do we want to do in the new version without thinking about the past? Here's what i think:
|
1ce951b
to
2b5528e
Compare
I would not override any named methods, but perhaps some operators, like I agree with Joern, anything that changes the API, i.e. changes contains or the class-hierarchy should wait. |
@joernhees @gromgull Agreed, 4.2.2 should not touch these, not even for forward compatibility. I can see now that overriding Also agree with implementing Not sure about overriding In Skosify, I've tried to remain compatible with many different rdflib versions all the way to 2.4.x (because that used to be what was available in distribution packages), so if I want to keep that compatibility, I may have to use some kind of version-sensitive wrapper for this, but no big deal. |
2b5528e
to
1f2461e
Compare
@osma you can keep compatibility by using @gromgull @niklasl i noticed a mistake wrt. IRIs in the 85227db (i used |
@joernhees Indeed, that pattern should work both for old and new versions. Thanks for the tip! |
I made a half-assed attempt at rebasing this onto master: https://github.com/gromgull/rdflib/tree/replay_closednamespace_inheritance_fix |
as mentioned in #595 and #596 this moves #551 and ae1f639 to the 5.0.0-dev branch and if accepted closes #542.
additionally as discussed removes the inheritance from unicode, meaning that all implicit string-ops like
n.startswith(...)
andn + ...
are no longer supported