|
I'm adding some classes dynamically, but for some reason I can't add an instance of my ObjectProperty to my classes. e.g. I have the following classes:
- Drug(Thing)
- Ingredient(Thing)
- has_ingredients(ObjectProperty)
I would expect to be able to add an Property instance on my Drug like this:
on onto:
onto['Drug']['has_ingredients'] = onto['Ingredient']
But this will give an error that 'has_ingredients' in undefined. My solution for now is to create a python name like following:
for onto:
has_ingredients = onto['has_ingredients']
has_ingredients.python_name = 'py_has_ingredients'
onto['Drug'].py_has_ingredients.append(onto['Ingredient'])
|