This questions is related to the one at this link. Let's say it is an "extended question".
The ontology at that link contains the following individuals:
:a rdf:type :Approve ;
:has-theme :r1,:r2 .
:r1 rdf:type :Result ;
:come-from :m1 .
:r2 rdf:type :Result ;
:come-from :m2 .
:m1 rdf:type :Man .
:m2 rdf:type :Machine .
Now I have added the following triples to the ontology:
:a :has-agent :x .
:m1 :friend-of :x .
That is: ":x is the agent of the Approve action :a" and ":m1 is friend of :x".
In the question at the link above, I wanted to write a SHACL rule stating that "Every Approve action having among its themes at least a Result that comes from a Man is Legal".
And Holger suggested me to use the following condition (antecedent) of the SHACL rule. The condition works (thanks Holger!):
:conditionTest
rdf:type sh:NodeShape ;
sh:property [
sh:path (ontology:has-theme ontology:come-from) ;
sh:qualifiedMinCount 1 ;
sh:qualifiedValueShape [
sh:class ontology:Man ;
]
] .
Now I want to extend the conditions above fit to obtain the following extended SHACL rule: "Every Approve action having among its themes at least a Result that comes from a Man who is friend of the Approve action's agent is Legal".
Basically: I want to start from the Approve action ":a", take its agent from one path, take the friends of the men producing results as theme of ":a" from another path... and compare the pairs of individuals through these paths, i.e., asking them when they match.
I tried to extend the :conditionTest above in several ways, e.g., with sh:equals:
:conditionTest
rdf:type sh:NodeShape ;
sh:property [
sh:path (ontology:has-theme ontology:come-from) ;
sh:qualifiedMinCount 1 ;
sh:qualifiedValueShape [
sh:class ontology:Man ;
sh:property [
sh:path ontology:friend-of;
sh:equals [sh:property [sh:path (sh:this ontology:has-agent)]]
]
]
] .
But no solution I tried works. On the other hand, if I use sh:hasValue and I explicitly mention the individual :x, i.e.:
:conditionTest
rdf:type sh:NodeShape ;
sh:property [
sh:path (ontology:has-theme ontology:come-from) ;
sh:qualifiedMinCount 1 ;
sh:qualifiedValueShape [
sh:class ontology:Man ;
sh:property [
sh:path ontology:friend-of;
sh:hasValue ontology:x
]
]
] .
It works. But this is not actually what I want: a want a SHACL rule that works for any individual as has-agent of :a. In other words: I want to get&compare this individual through the path "(sh:this has-agent)".
Hope any of you knows a way to do it. Thanks in advance. Livio