Re: owl_inverse_property problem
Posted by ZhaoPengya2 on
URL: http://owlready.306.s1.nabble.com/owl-inverse-property-problem-tp229p233.html
Compare to your code, I found I didn't write the statment of "with onto: " before classes. I got the same output by adding this line. Many thanks.
and I have a new question, if i don't write the "with onto:" before classes,run the blow code:
class has_subsidiary(ObjectProperty):
domain = [Company]
range = [Company]
class is_subsidiary_of(ObjectProperty):
domain = [Company]
range = [Company]
inverse_property = has_subsidiary
will get a error:TypeError: 'NoneType' object is not callable
if i change the "inverse_property" to "owl_inverse_property", the error is gone, but the inverse_property feature is not effective.
c1 = Company('海航集团有限公司')
c2 = Company('海南航空控股股份有限公司')
c1.has_subsidiary.append(c2)
print(list(c1.has_subsidiary))
print(list(c2.is_subsidiary_of))
console:
[owl.海南航空控股股份有限公司]
[]
thanks o lot !!!!!