ontology-visualization icon indicating copy to clipboard operation
ontology-visualization copied to clipboard

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

Open dtraparic opened this issue 2 years ago • 1 comments

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 ?

dtraparic avatar Oct 24 '22 07:10 dtraparic