How do you define a chain of properties

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How do you define a chain of properties

William
This post was updated on .
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):
    pass

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?

PS: The source codes(.py files) indent with only two whitespaces, :o! Is that OK?
PSS: I have ask the question in https://stackoverflow.com/questions/49268910/how-do-you-define-propertychain-in-owlready where some recommend me to submit it here.
Reply | Threaded
Open this post in threaded view
|

Re: How do you define a chain of properties

Jiba
Administrator
Hello,

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.

Kind regards,
Jean-Baptiste Lamy
MCF, LIMICS, Université Paris 13
Reply | Threaded
Open this post in threaded view
|

Re: How do you define a chain of properties

William
Thank you very much, I am expecting the new version.