Error while savig world object (Graph object has no attribute c)

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

Error while savig world object (Graph object has no attribute c)

gp
This post was updated on .
Hello,

While (still) trying to perform some controlled/enhanced mireoting operations I came with some code where I did something similar to this:
import owlready2 as owl

world = owl.World()
onto = world.get_ontology('my:onto:example#')

with onto:
    class someClass(owl.Thing):
        pass
    someClass.iri = 'my:onto:example#changedIRI'
    someClass.name = 'changedName'
    someClass.label = 'oneLabel'


    class someClass(owl.Thing):
        pass
    someClass.iri = 'my:onto:example#someOtherIri'
    someClass.name = 'someOtherName'
    someClass.label = 'otherLabel'

world.save(file=r'c:\temp\attemptWorld.owl', format = 'rdfxml')
onto.save(file=r'c:\temp\attemptOnto.owl', format = 'rdfxml')

This results on my system to the following error when trying to serialize the ontology:
C:\winpython370amd64_running\python-3.7.0.amd64\python.exe C:/Users/gpotdevin/.PyCharm2018.1/config/scratches/scratch_13.py
Traceback (most recent call last):
  File "C:/Users/gpotdevin/.PyCharm2018.1/config/scratches/scratch_13.py", line 20, in <module>
    world.save(file=r'c:\temp\attemptWorld.owl', format = 'rdfxml')
  File "C:\winpython370amd64_running\python-3.7.0.amd64\lib\site-packages\owlready2\namespace.py", line 297, in save
    self.graph.save(file, format, **kargs)
  File "C:\winpython370amd64_running\python-3.7.0.amd64\lib\site-packages\owlready2\driver.py", line 148, in save
    def save(self, f, format = "rdfxml", **kargs): _save(f, format, self, **kargs)
  File "C:\winpython370amd64_running\python-3.7.0.amd64\lib\site-packages\owlready2\driver.py", line 290, in _save
    base_iri = graph._iter_ontology_iri(graph.c)
AttributeError: 'Graph' object has no attribute 'c'

Process finished with exit code 1


Is it simply that world.save() should not be used (only an ontology object should be saved)?

Cheers!
Guillaume
Reply | Threaded
Open this post in threaded view
|

Re: Error while savig world object (Graph object has no attribute c)

Jiba
Administrator
Hello,

I fixed the problem in the development version. It was related to the use of the RDF/XML format for saving the world -- normally, RDF/XML is used for saving a single ontology, not several.

Thank you for reporting this problem,

Best regards,
Jiba