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

AttributeError: term 'uri' not in namespace 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' #20

Open
dtraparic opened this issue Oct 24, 2022 · 1 comment

Comments

@dtraparic
Copy link

dtraparic commented Oct 24, 2022

Hi, I know this is the same issue than #13 but it didn't open when I commented back the issue, so I'm reopening a new one, sorry if I'm doing this wrong.

On Windows 10, with the following pip list:

Package    Version
---------- -------
graphviz   0.20.1
isodate    0.6.1
pip        22.3
pyparsing  3.0.9
rdflib     6.2.0
setuptools 58.1.0
six        1.16.0

Running the example provided in readme.md:
python .\ontology_viz.py -o test.dot test.ttl -O ontology.ttl

Will trigger this error:

Traceback (most recent call last):
  File "C:\Users\David Traparic\Documents\prog\ontology\ontology-visualization\ontology_viz.py", line 23, in <module>
    common_ns = set(map(lambda ns: ns.uri, (RDF, RDFS, SKOS, SCHEMA, XSD, DOAP, FOAF)))
  File "C:\Users\David Traparic\Documents\prog\ontology\ontology-visualization\ontology_viz.py", line 23, in <lambda>
    common_ns = set(map(lambda ns: ns.uri, (RDF, RDFS, SKOS, SCHEMA, XSD, DOAP, FOAF)))
  File "C:\Users\David Traparic\Documents\prog\ontology\ontoenv\lib\site-packages\rdflib\namespace\__init__.py", line 238, in __getattr__
    return cls.__getitem__(name)
  File "C:\Users\David Traparic\Documents\prog\ontology\ontoenv\lib\site-packages\rdflib\namespace\__init__.py", line 229, in __getitem__
    raise AttributeError(f"term '{name}' not in namespace '{cls._NS}'")
AttributeError: term 'uri' not in namespace 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'

I tried different rdflib version, 6.1.1 will trigger the same error, whereas 6.0.1 and 5.0.0 will trigger another error:

Traceback (most recent call last):
  File "C:\Users\David Traparic\Documents\prog\ontology\ontology-visualization\ontology_viz.py", line 6, in <module>
    from rdflib.plugins.sparql import prepareQuery
  File "C:\Users\David Traparic\Documents\prog\ontology\ontoenv\lib\site-packages\rdflib\plugins\sparql\__init__.py", line 33, in <module>
    from . import parser
  File "C:\Users\David Traparic\Documents\prog\ontology\ontoenv\lib\site-packages\rdflib\plugins\sparql\parser.py", line 184, in <module>
    Param('prefix', PN_PREFIX)) + Suppress(':').leaveWhitespace()
  File "C:\Users\David Traparic\Documents\prog\ontology\ontoenv\lib\site-packages\rdflib\plugins\sparql\parserutils.py", line 114, in __init__
    self.name = name
AttributeError: can't set attribute 'name'

Do you have any ideas why this happens ?

@jfaldanam
Copy link

@dtraparic Just to let you know that #19 fixes this, just in case the mention in the PR doesn't send a notification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants