There are some Restriction that hold to keep such definitions decidable and computable.
A statement like "The friends of my friends are also my friends" can simple be expressed by defining
hasFriend as a Transitive Property. However if one wants to state the "The foes of my friends are also my foes.", then as there are two different Properties are connected, one need General Role Inclusion.
In First Order Logic is easily expressed where one states that for all x, y and z it holds that if x has the friend y and y has the foe z, then x also has the foe z.
General Property Inclusion works so that one has an R-Box expression that can connect several atomic Roles another more complex Role S. For example one can connect
hasFoe which is subclass or includes
hasFriendsFoe. So one has combined or declared a new complex Property that says the Foes of my friends which is composed of the two atomic Roles
In general one has R1 connected by R2, R2 connected by R3 and so on up to Rn, they constitute the Role S.
Then it holds that x0 (the very first one) and xn (the very last one) both belong to the Interpretation of the complex Role S. The Semantics of it expressed by x0 and x1 belong to the Interpretation of Role number 1 and x1 and x2 belong to the Interpretation of R2 and so on until for xn-1 and xn belong to the Interpretation of Rn, then it also holds that x0 and xn both belong to the Interpretation of the complex Role S.
"The friends of my friends are also my friends."
But: "The foes of my friends are also my foes."
In FOL expressed as a Rule (Axiom):
∀x,y,z:hasFried(x,y)^hasFoe(y,x) -> hasFriendsFoe(x,z)
SHROIQ(D) enables the construction of complex Roles
R-Box expressions of the form R1oR2oR3o...oRn⊑S e.g.: hasFriend o hasFoe ⊑ hasFriendFoe
E.g. (x0,x1)∈hasFriendIand (x1,x2)∈hasFoeI,then it also holds (x0,x2)∈hasFriendFoeI