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!