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

Consistency Namespace vs. ClosedNamespace #542

Closed
mthag opened this issue Nov 12, 2015 · 4 comments · Fixed by #551 or #1213
Closed

Consistency Namespace vs. ClosedNamespace #542

mthag opened this issue Nov 12, 2015 · 4 comments · Fixed by #551 or #1213
Assignees
Labels
enhancement New feature or request fix-in-progress
Milestone

Comments

@mthag
Copy link

mthag commented Nov 12, 2015

As I understand rdflib.Namespace and ClosedNamespace, they are both meant as auxiliaries to simplify the creation of URIRefs in Python code, e.g. RDF.type or OWL.Class. In addition, ClosedNamespace provides an additional vocabulary check, e.g., RDF.spam will raise an exception.

However, sometimes other uses of Namespace/ClosedNamespace can be useful, e.g., string comparison. At this stage, it is quite inconvenient that Namespace is derived from unicode, whereas ClosedNamespace is derived from the standard object, and the actual namespace string is an instance attribute (uri). In the interest of consistency, I propose that ClosedNamespace should also be derived from unicode (or even from Namespace).

Regards

@joernhees joernhees added the enhancement New feature or request label Nov 12, 2015
@joernhees
Copy link
Member

can you give us a use-case where you can't just compare str(Namespace(...)) with str(ClosedNamespace(...))?

@gromgull
Copy link
Member

I totally agree that it's weird that they derive from different things. It also looks trivial to fix. I've tried - let me see if Travis agrees :)

@niklasl
Copy link
Member

niklasl commented Nov 22, 2015

Also totally agree, thanks for addressing this! 👍

@joernhees joernhees reopened this Feb 15, 2016
@joernhees joernhees self-assigned this Feb 15, 2016
@joernhees joernhees modified the milestones: rdflib 5.0.0, rdflib 4.2.2 Feb 15, 2016
@joernhees
Copy link
Member

the change mentioned in #551 is backwards incompatible and will be moved to rdflib 5.0.0 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment