Hi Carl,

since this topic has come up many times recently, and the existing documentation of SHACL Node Expressions (and thus sh:values and sh:TripleRules) in the spec was rather wanting, I have finally allocated some time to produce examples for most of the node expression types:

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

While we at TQ may produce all kinds of tutorials and product documentation, the W3C specs (here, Community Report draft) are the ultimate sources that most people will look up.

HTH
Holger


On 2021-02-26 2:39 am, Carl Burnett wrote:

Holger, that did the trick. Thanks! I felt like I had tried every possible combination, but apparently not that one.

Are there plans to develop a more detailed spec with examples, or maybe further tutorials for SHACL? With other specs/languages, it’s possible to google around and find a similar example to see someone else did something. But with SHACL, I often feel alone in a giant, empty sea…

Carl

*From:* [email protected] <[email protected]> *On Behalf Of *Holger Knublauch
*Sent:* Wednesday, February 24, 2021 3:58 PM
*To:* [email protected]
*Subject:* Re: [topbraid-users] How to use sh:minus

*** External email: use caution ***

On 2021-02-25 9:44 am, [email protected] <mailto:[email protected]> wrote:

    The SHACL-AF spec
    
<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fw3c.github.io%2Fshacl%2Fshacl-af%2F%23minus&data=04%7C01%7Ccburnett%40healthwise.org%7Ce9337db795af4bc22eed08d8d9201201%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637498079069195732%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=1t7FN%2F4xE3N9dEXJgXbRtw%2BLlauByr3b06UGKtGoYfM%3D&reserved=0>
 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://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.topquadrant.com%2Fgraphql%2Fvalues.html%23examples-family&data=04%7C01%7Ccburnett%40healthwise.org%7Ce9337db795af4bc22eed08d8d9201201%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637498079069205727%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=lwiDfH4cBc05m%2FA3guXTzMTxDcqD1TO6LE5pf4Jy9sQ%3D&reserved=0>,
    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 <https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fw3c.github.io%2Fshacl%2Fshacl-af%2F%23node-expressions-constant&data=04%7C01%7Ccburnett%40healthwise.org%7Ce9337db795af4bc22eed08d8d9201201%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637498079069205727%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Bs8%2FXa9oGl%2FoST8v%2BIydwJIJwOZUwtdC0QCc9stN%2FTI%3D&reserved=0>

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://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Ftopbraid-users%2Fba2904a6-242d-4c9c-8ad3-ad334edfd5e1n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Ccburnett%40healthwise.org%7Ce9337db795af4bc22eed08d8d9201201%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637498079069215724%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=w8TG5iNDkdB7t7V1AvoyMMaCAM3%2F%2FAR9HxJ%2BOisPza4%3D&reserved=0>.

--
You received this message because you are subscribed to a topic in the Google Groups "TopBraid Suite Users" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/topbraid-users/I9rSZumVNVQ/unsubscribe <https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Ftopbraid-users%2FI9rSZumVNVQ%2Funsubscribe&data=04%7C01%7Ccburnett%40healthwise.org%7Ce9337db795af4bc22eed08d8d9201201%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637498079069225720%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Wlft0FsG8b0mcKyerJ04ArFCci9MnK2RPTZBFYX9DcQ%3D&reserved=0>. To unsubscribe from this group and all its topics, 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/551b2dea-a35d-c1a9-d84b-a7059371c777%40topquadrant.com <https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Ftopbraid-users%2F551b2dea-a35d-c1a9-d84b-a7059371c777%2540topquadrant.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=04%7C01%7Ccburnett%40healthwise.org%7Ce9337db795af4bc22eed08d8d9201201%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C1%7C637498079069225720%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=q7Su4fweVJeveKLaC1%2BpHPAUUUw%2BuKc%2FI1z5PGp40p4%3D&reserved=0>.

--
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/MWHPR19MB1598D1ED88DD623EE3F51502B79E9%40MWHPR19MB1598.namprd19.prod.outlook.com <https://groups.google.com/d/msgid/topbraid-users/MWHPR19MB1598D1ED88DD623EE3F51502B79E9%40MWHPR19MB1598.namprd19.prod.outlook.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/f554d21b-e0f9-7b31-334c-37438ec074a2%40topquadrant.com.

Reply via email to