Problem creating datatype for xsd:anyURI

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

Problem creating datatype for xsd:anyURI

Steve Wartik
I'm trying to use declare_datatype() to declare a datatype for xsd:anyURI and encountering an error. I've attached a file containing the class I'm using: AnyURI.py. When I save my ontology using the ntriples format, I get an exception stack ending with:
 File "C:\Users\swartik\AppData\Local\Programs\Python\Python39\lib\site-packages\owlready2\namespace.py", line 1003, in save
    self.graph.save(file, format, **kargs)
  File "C:\Users\swartik\AppData\Local\Programs\Python\Python39\lib\site-packages\owlready2\driver.py", line 225, in save
    _save(f, format, self, **kargs)
  File "C:\Users\swartik\AppData\Local\Programs\Python\Python39\lib\site-packages\owlready2\driver.py", line 264, in _save
    else:                                          o = '"%s"^^<%s>' % (o, _unabbreviate(d)) # Unabbreviate datatype's iri
  File "C:\Users\swartik\AppData\Local\Programs\Python\Python39\lib\site-packages\owlready2\triplelite.py", line 491, in _unabbreviate
    return self.execute("SELECT iri FROM resources WHERE storid=? LIMIT 1", (storid,)).fetchone()[0]
TypeError: 'NoneType' object is not subscriptable
But if I simply change #anyURI to #hexBinary, the code works. The code also worked when I mistyped the URI, using "w3c" instead of "w3". This specific URI appears to be a problem!
Reply | Threaded
Open this post in threaded view
|

Re: Problem creating datatype for xsd:anyURI

Jiba
Administrator
Hi,

The bug was caused by the fact that AnyURI is actually mapped by Owlready to normstr.

I fixed it in the development version ; you can now re-declare it, orverriding the previous declaration.

Jiba