How to save the triple which made up of dynamic created class
Dear Mr Jean-Baptiste Lamy,
I try to save a dynamic created triple, but python says my onto.save() have something error.
I realize it is my fault about calling the add_triple(), but I don't know how to handle it.
can you give me some help?
The "with onto:" syntax indicates that the classes are created in ontology onto.
Adding triple directly to the quadstore is OK (although not yet documented). However, please notice that, here, it is not necessary to add the triple (myClass.storid, rdf_type, owl_class), because the new class creation already asserts this triple.
I'm considering adding an error for classes created with no associated ontology (this would lead to more clear error message in your situation).
MCF, LIMICS, Université Paris 13
> Dear Mr Jean-Baptiste Lamy,
> I try to save a dynamic created triple, but python says my onto.save() have
> something error.
> I realize it is my fault about calling the add_triple(), but I don't know
> how to handle it.
> can you give me some help?
> Code as follow:
> from owlready2 import *
> onto =
> class Drug(Thing):
> def take(self): print('I took a drug')
> myClass = types.new_class("myClass",Drug.__bases__)
> Thanks in advance for your attention!
> Best Regards,
> If you reply to this email, your message will be added to the discussion below:
> http://owlready.8326.n8.nabble.com/How-to-save-the-triple-which-made-up-of-dynamic-created-class-tp100.html > To start a new topic under Owlready, email [hidden email] > To unsubscribe from Owlready, visit
Re: How to save the triple which made up of dynamic created class
Thanks for your feedback !
I have another question :).
In my code, I replace owl.Thing with Drug.__bases__ when dynamic creating class. The reason why I use a subclass' superclass rather than itself is that I failed to use any correct parameter in the function.Could you give me same typical example?
Thanks in advance for your attention! Again!