On 2021-02-25 9:44 am, [email protected] wrote:
The SHACL-AF spec <https://w3c.github.io/shacl/shacl-af/#minus> contains a definition for a property called sh:minus, but I don't think my brain is able to parse it properly. Some examples might help, but the only one I've been able to find anywhere is in Example 3 of this tutorial <https://www.topquadrant.com/graphql/values.html#examples-family>, where sh:this is used as the object of sh:minus.

What I want to do is define a property shape that infers a list of values that is calculated by taking all the values of another property shape -- call it ex:includes -- and removing all the values of a third property shape -- call it ex:excludes. But I can't seem to write a valid sh:values statement that does this.

Is sh:minus even the right property to use for this? If so, what is the proper syntax? For what it's worth, this was one of my attempts:

  sh:values [
      sh:nodes [
          sh:path ex:includes;
        ] ;
      sh:minus ex:excludes;
    ] ;

sh:minus takes any node expression and will simply compute the nodes resulting from sh:nodes and then remove the nodes resulting from sh:minus.

Did you try

  sh:values [
      sh:nodes [ sh:path ex:includes ] ;
      sh:minus [ sh:path ex:excludes ];
    ] ;

The way you have written it would just exclude the property ex:excludes itself, because that's a constant term node expression

https://w3c.github.io/shacl/shacl-af/#node-expressions-constant

For the geeks here is the implementation of sh:minus

    public ExtendedIterator<RDFNode> eval(RDFNode focusNode, NodeExpressionContext context) {
        Set<RDFNode> sans = minus.eval(focusNode, context).toSet();
        return getInput().eval(focusNode, context).filterDrop(n -> sans.contains(n));
    }

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 [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/ba2904a6-242d-4c9c-8ad3-ad334edfd5e1n%40googlegroups.com <https://groups.google.com/d/msgid/topbraid-users/ba2904a6-242d-4c9c-8ad3-ad334edfd5e1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/551b2dea-a35d-c1a9-d84b-a7059371c777%40topquadrant.com.

Reply via email to