Re: How to create Object and Data Properties dynamically ?

Posted by Jiba on
URL: http://owlready.306.s1.nabble.com/How-to-create-Object-and-Data-Properties-dynamically-tp244p372.html

Hello,

You need a "," after DataProperty. (DataProperty,) is the tuple of base classes, and, in Python, you need a comma after the first element to create a on-element tuple.

for i in range(len(s)):
    with onto:
        onto_data_property = types.new_class(s[i],  (DataProperty,))

Best regards,