Recently, I started to study owlready, and faced with much problem. I defined a PropertyChain as follows (I know I misunderstand it).
class friend(Person >> Person, SymmetricProperty):
class potentialFriend(Person >> Person):
# potentialFriend := friend o friend
equivalent_to = PropertyChain([friend, friend])
I tried to get person.potentialFriend.indirect(), but failed. I read the source codes, since the doc on web is too simple, and found that PropertyChain works like a list, I thought it returned a Property. How do I compliment what I want?
How do you use PropertyChain? Is there some concrete examples.
potentialFriend can be complimented by another way, but I just want to define a property T that is the chain of properties R and S, ie T = R o S. How do I define it?
The property chain support is very limited in Owlready. Actually, it can only be used to define property chain or to query defined property chains, but it performs no reasoning at all.
If you * really * want to get all "potentialFriend", you need to create a defined class (e.g. PotentialFriendOfMisterX) for each Person, to define this class as equivalent to Person AND potentialFriend of X, and to run the reasoner.
Future version of Owlready might include support for property chain in .indirect(), but limited to asserted relations (i.e. only if it is asserted that X is friend of Y and Y is friend of Z, but not if one of the two relation must be deduced from some reasoning).
> PS: The source codes(.py files) indent with only two whitespaces, :o! Is that OK?
Yes! I'm used to very small indentation.
MCF, LIMICS, Université Paris 13