Re: [data-shapes] Allowing SHACL rules to create new RDF resources => handling the risk of infinite loops (#749)

I think this is reasonable. This does allow for the potential of recursion,
which I think is useful in this particular case, but it also puts the onus
of terminating that recursion on the developer, rather than on the engine.
This does imply the need to a Stack Overflow error if the recursion gets
too deep.

Again, my sense is that, unlike SPARQL, most people will not have explicit
control over the SHACL graph or the inference graph, beyond the running of
rules in the first place.

*Kurt Cagle*
Editor in Chief
The Cagle Report
kurt.cagle@gmail.com
443-837-8725 <http://voice.google.com/calls?a=nc,%2B14438378725>


On Wed, Jan 28, 2026 at 6:48 AM liviorobaldo via GitHub <noreply@w3.org>
wrote:

> liviorobaldo has just created a new issue for
> https://github.com/w3c/data-shapes:
>
> == Allowing SHACL rules to create new RDF resources => handling the risk
> of infinite loops ==
> Hello everyone,
>
> Following today's discussion with Dörthe about N3, I think it would be
> good to reach a final decision and then move forward on how to handle the
> creation of new RDF resources and the infinite loops this may trigger. My
> perspective is the following:
>
> 1. Rules should be allowed to create new RDF resources (Skolem terms) and
> literals in rule heads.
> 2. This can indeed lead to infinite loops. While some cases could be
> mitigated by introducing functions with parameters (which create an
> individual the first time they are evaluated and then always return the
> same individual thereafter), the problem of infinite loops cannot be
> eliminated entirely.
>
> Given this, I believe we should allow rules to create RDF resources and
> literals without imposing specific restrictions in the syntax or the
> algorithm. The responsibility for avoiding infinite loops should lie with
> the knowledge engineer. Anyone defining a set of SHACL rules should also be
> able to demonstrate that repeated rule execution terminates (for example,
> by showing that cycles of RDF resources do not repeatedly trigger the same
> rules). This is analogous to programming in Java or Python, where
> developers must ensure that loops in their code terminate.
>
> What do you think?
> Cheers
> Livio
>
> Please view or discuss this issue at
> https://github.com/w3c/data-shapes/issues/749 using your GitHub account
>
>
> --
> Sent via github-notify-ml as configured in
> https://github.com/w3c/github-notify-ml-config
>
>

Received on Friday, 30 January 2026 00:37:47 UTC