|
Hi all,
I like to copy properties from one class to another.
My current approach is, that I append the property entries in is_a from the source class to the destination class.
For example onto.ClassA.is_a.append(onto.ClassB_is_a[0]).
I figured out some incomprehensible behaviour. Executing the code directly in a python file or the debug console, results in the fact, that the property onto.ClassB_is_a[0] is appended twice to onto.ClassA.
Wrapping the same code in a function, for example def copyProperties(to, from): to.is_a.append(from.is_a[0]) leads to:
OwlReadySharedBlankNodeError
A ClassConstruct cannot be shared by two ontologies, because it correspond to a RDF blank node. Please create a dupplicate.
I tried to use copy and deepcopy to make a copy of is_a[0] but this doesn't solve the problem.
Can someone explain the behaviour?
What is the preferred way to copy properties from one class to another?
Thank you
Markus
|