Can a SHACL rule check on a validation test?

47 views
Skip to first unread message

Steve Ray

unread,
Apr 13, 2021, 6:48:31 PM4/13/21
to TopBraid Suite Users
Let's suppose I'd like to execute a sh:SPARQLRule to infer something, but only if various shape validations have been satisfied. Is there a way I can confirm that inside the rule with a statement in my WHERE clause that that is the case?

I typically use anonymous nodes when declaring the shapes, but I can see how that might present a problem when I'm trying to ask if a particular shape conforms. Would I be able to say something like:

...
WHERE {
<some validation report?> sh:conforms true .
...

Bottom line, I'd like my rule to fire only when the validations have passed.

Thanks for any pointers,

Steve


Irene Polikoff

unread,
Apr 13, 2021, 7:24:21 PM4/13/21
to topbrai...@googlegroups.com
See sh:condition


The same for a SPARQL rules


If there is a constraint you need satisfied for the inference to happen, you will need to repeat it in sh:condition.

--
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/CAGUep86OU7YRFXV_1DReU8eGOo%2B%2BeYXA7sWGoL_EaQfdE1514Q%40mail.gmail.com.

Holger Knublauch

unread,
Apr 13, 2021, 8:06:04 PM4/13/21
to topbrai...@googlegroups.com

Yes, sh:condition is documented here:

https://w3c.github.io/shacl/shacl-af/#condition

This can validate the focus node and is the preferred declarative approach. A non-standard alternative would be the function tosh:hasShape(?node, ?shape) that returns true if ?node conforms to ?shape. That function would be used in the WHERE clause and has a bit more flexibility because you can validate any node.

Holger

Steve Ray

unread,
Apr 13, 2021, 8:13:05 PM4/13/21
to TopBraid Suite Users
Thanks to both of you. In reading that section, I presume "must conform to" means that even if the severity is a warning or an information, the shape must validate before the rule executes?



Steve




Holger Knublauch

unread,
Apr 13, 2021, 8:29:24 PM4/13/21
to topbrai...@googlegroups.com


On 14/04/2021 10:12 am, Steve Ray wrote:
Thanks to both of you. In reading that section, I presume "must conform to" means that even if the severity is a warning or an information, the shape must validate before the rule executes?

Right, the engine does not really distinguish those (which I found in general a weird decision of the WG back in the days).

Holger


Reply all
Reply to author
Forward
0 new messages