Property shape for the inverse of inferred values

30 views
Skip to first unread message

cbur...@healthwise.org

unread,
Apr 19, 2022, 5:22:59 PM4/19/22
to TopBraid Suite Users
When a resource is an (inferred) *object* of a SHACL values rule, is there any way to have EDG display that information when viewing the resource?

For example, suppose I defined schema:son using the property shape given in TQ's "Inferring Data with SHACL Property Value Rules" tutorial:

schema:Person
    sh:property [
        sh:path schema:son ;
        sh:class schema:Person ;
        sh:description "The son(s) of a person. These values are inferred as the children that have male gender." ;
        sh:name "son" ;
        sh:values [
            sh:nodes [
                sh:path schema:children ;
            ] ;
            sh:filterShape [
                sh:property [
                    sh:path schema:gender ;
                    sh:hasValue "male" ;
                ] ;
            ] ;
        ] ;
    ] .

Is there a way to add a property shape that displays all the parents of a son by reusing schema:son in the inverse direction? (I know in this case you could do this more simply a different way, but I wanted to use an established example.)

Clearly it won't work to simply define the property shape as the sh:inversePath of schema:son, as we might do with an explicitly stated property. Can we do it instead with another sh:values rule?

Holger Knublauch

unread,
Apr 19, 2022, 10:29:00 PM4/19/22
to topbrai...@googlegroups.com

I cannot think of a good way to do this right now. The only place where true backward chaining of sh:values rules is supported right now is in sh:path node expressions where the path is a IRI predicate. That isn't the case here, as you'd need sh:path [ sh:inversePath schema:son ] .

FWIW the source code of the relevant logic is

https://github.com/TopQuadrant/shacl/blob/master/src/main/java/org/topbraid/shacl/expr/PathEvaluator.java#L230

and the improvement here would be to add special handling for the case where a predicate is given and isInverse is true.

The only work-around I could think of is to rewrite a sh:values rule that has the inverse logic of the schema:son property.

Holger

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/b054824d-de22-4f0f-9f8b-aab996a9f1e8n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages