-
Notifications
You must be signed in to change notification settings - Fork 543
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
Issue with namespaces when concepts begin with a numeral. #2631
Comments
@Nasreddine class Namespace accepts only string as name, see def __getattr__(self, name: str) -> URIRef:
if name.startswith("__"): # ignore any special Python names!
raise AttributeError
return self.term(name) you can write: from rdflib import Namespace
eurovoc = Namespace("http://eurovoc.europa.eu/")
concept = getattr(eurovoc, '1005')
print(concept) |
The attribute access is a dynamic convenience (and within the bonds of python syntax). Item access (like with dictionaries) always works. So (preferably) you do: print(eurovoc['1005']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I have defined Eurovoc namespace where some concepts begin with a digit. Python flags this as a syntax error.
Is there a solution to this problem?
The text was updated successfully, but these errors were encountered: