Exception: Unknown namespace prefix : namespace

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Exception: Unknown namespace prefix : namespace

Pakbi

C:\Users\Pasquale Bonasia\Downloads\OntoPharma>python ./OntoPharma.py
* Owlready2 * Warning: optimized Cython parser module 'owlready2_optimized' is not available, defaulting to slower Python implementation
caught a TypeError, retrying call to <class 'owlready2.rdflib_store.TripleLiteRDFlibStore'>.bind without override, see https://github.com/RDFLib/rdflib/issues/1880 for more info
Traceback (most recent call last):
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\namespace\__init__.py", line 627, in _store_bind
    return self.store.bind(prefix, namespace, override=override)
TypeError: bind() got an unexpected keyword argument 'override'
caught a TypeError, retrying call to <class 'owlready2.rdflib_store.TripleLiteRDFlibStore'>.bind without override, see https://github.com/RDFLib/rdflib/issues/1880 for more info
Traceback (most recent call last):
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\namespace\__init__.py", line 627, in _store_bind
    return self.store.bind(prefix, namespace, override=override)
TypeError: bind() got an unexpected keyword argument 'override'
caught a TypeError, retrying call to <class 'owlready2.rdflib_store.TripleLiteRDFlibStore'>.bind without override, see https://github.com/RDFLib/rdflib/issues/1880 for more info
Traceback (most recent call last):
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\namespace\__init__.py", line 627, in _store_bind
    return self.store.bind(prefix, namespace, override=override)
TypeError: bind() got an unexpected keyword argument 'override'
caught a TypeError, retrying call to <class 'owlready2.rdflib_store.TripleLiteRDFlibStore'>.bind without override, see https://github.com/RDFLib/rdflib/issues/1880 for more info
Traceback (most recent call last):
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\namespace\__init__.py", line 627, in _store_bind
    return self.store.bind(prefix, namespace, override=override)
TypeError: bind() got an unexpected keyword argument 'override'
caught a TypeError, retrying call to <class 'owlready2.rdflib_store.TripleLiteRDFlibStore'>.bind without override, see https://github.com/RDFLib/rdflib/issues/1880 for more info
Traceback (most recent call last):
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\namespace\__init__.py", line 627, in _store_bind
    return self.store.bind(prefix, namespace, override=override)
TypeError: bind() got an unexpected keyword argument 'override'
caught a TypeError, retrying call to <class 'owlready2.rdflib_store.TripleLiteRDFlibStore'>.bind without override, see https://github.com/RDFLib/rdflib/issues/1880 for more info
Traceback (most recent call last):
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\namespace\__init__.py", line 627, in _store_bind
    return self.store.bind(prefix, namespace, override=override)
TypeError: bind() got an unexpected keyword argument 'override'
Traceback (most recent call last):
  File "C:\Users\Pasquale Bonasia\Downloads\OntoPharma\OntoPharma.py", line 222, in compatibilita
    for item in principio_attivo:
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\owlready2\rdflib_store.py", line 187, in query_owlready
    r = self.query(query, *args, **kargs)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\graph.py", line 1389, in query
    return result(processor.query(query_object, initBindings, initNs, **kwargs))
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\processor.py", line 78, in query
    query = translateQuery(parsetree, base, initNs)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 870, in translateQuery
    q[1] = traverse(
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 455, in traverse
    r = _traverse(tree, visitPre, visitPost)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 412, in _traverse
    e[k] = _traverse(val, visitPre, visitPost)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 412, in _traverse
    e[k] = _traverse(val, visitPre, visitPost)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 405, in _traverse
    return [_traverse(x, visitPre, visitPost) for x in e]
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 405, in <listcomp>
    return [_traverse(x, visitPre, visitPost) for x in e]
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 412, in _traverse
    e[k] = _traverse(val, visitPre, visitPost)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 405, in _traverse
    return [_traverse(x, visitPre, visitPost) for x in e]
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 405, in <listcomp>
    return [_traverse(x, visitPre, visitPost) for x in e]
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 405, in _traverse
    return [_traverse(x, visitPre, visitPost) for x in e]
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 405, in <listcomp>
    return [_traverse(x, visitPre, visitPost) for x in e]
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 415, in _traverse
    _e = visitPost(e)  # type: ignore[unreachable]
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\algebra.py", line 189, in translatePName
    return prologue.absolutize(p)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\sparql.py", line 412, in absolutize
    return self.resolvePName(iri.prefix, iri.localname)
  File "C:\Users\Pasquale Bonasia\AppData\Local\Programs\Python\Python39\lib\site-packages\rdflib\plugins\sparql\sparql.py", line 394, in resolvePName
    raise Exception("Unknown namespace prefix : %s" % prefix)
Exception: Unknown namespace prefix : namespace
Reply | Threaded
Open this post in threaded view
|

Re: Exception: Unknown namespace prefix : namespace

Pakbi
Ehi Jiba, can you help me. the row problem is g.bind("namespace", "C:/Users/pasquale.bonasia/Desktop/pharma.owl#"). How do I resolve? Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Exception: Unknown namespace prefix : namespace

Jiba
Administrator
Hi,

The problem is related to RDFlib. Which version of RDFlib and Python are you using ?

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Exception: Unknown namespace prefix : namespace

Pakbi
python 3.7.0 e rdflib

C:\Windows\system32>pip install rdflib
Requirement already satisfied: rdflib in c:\users\pasquale bonasia\appdata\local\programs\python\python37\lib\site-packages (6.2.0)
Requirement already satisfied: pyparsing in c:\users\pasquale bonasia\appdata\local\programs\python\python37\lib\site-packages (from rdflib) (3.0.9)
Requirement already satisfied: setuptools in c:\users\pasquale bonasia\appdata\local\programs\python\python37\lib\site-packages (from rdflib) (39.0.1)
Requirement already satisfied: isodate in c:\users\pasquale bonasia\appdata\local\programs\python\python37\lib\site-packages (from rdflib) (0.6.1)
Requirement already satisfied: importlib-metadata in c:\users\pasquale bonasia\appdata\local\programs\python\python37\lib\site-packages (from rdflib) (4.12.0)
Requirement already satisfied: zipp>=0.5 in c:\users\pasquale bonasia\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->rdflib) (3.8.1)
Requirement already satisfied: typing-extensions>=3.6.4 in c:\users\pasquale bonasia\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->rdflib) (4.3.0)
Requirement already satisfied: six in c:\users\pasquale bonasia\appdata\local\programs\python\python37\lib\site-packages (from isodate->rdflib) (1.16.0)
Reply | Threaded
Open this post in threaded view
|

Re: Exception: Unknown namespace prefix : namespace

Jiba
Administrator
Hello,

I studied more the error message, and there are actually 2 errors. The first one is related to the newer version of RDFlib, which introduces the "override" parameter to bind(). This error is not fatal ; nevertheless I fixed it in the development version of Owlready on bitbucket.

The second error is "Unknown namespace prefix : namespace" and is probably related to your SPARQL query. Did you define the "namespace" prefix ?

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Exception: Unknown namespace prefix : namespace

Pakbi
Hi Jiba, I'm Pasquale Bonasia and I send you the materials by tecnopaky@libero.it