[data-shapes] Attaching rules to shapes (#765)

afs has just created a new issue for https://github.com/w3c/data-shapes:

== Attaching rules to shapes ==
Should we include attaching SHACL (1.2) Rules to shapes?
If so, what does it mean given the difference in execution semantics?

Subsidiary question:
In practice, how often are constriants and AF-rules written on the same shape? 
If they are, how are the rules being used, in practice, to influence the validation?

Sketch:

```turtle
[] rdf:type sh:NodeShape ;
    sh:rule 
      [ a srl:SHACLRule ;
        srl:ruleSet "...";    ## SRL syntax
        sh:prefixes ... ;
      ];
```
```turtle
[] rdf:type sh:NodeShape ;
    sh:rule
      [ a srl:SHACLRule ;
        srl:ruleSet [ ... RDF syntax ... ] ;
      ];
```
Ruleset execution has `$this` bound to the current node shape. This is available to rule body evaluation:

https://www.w3.org/TR/shacl12-rules/#eval-rule
```
let SEQ0: Solution sequence = { ("this", RDF Term of current NodeShape) }
```
Well-formedness changes to compensate for this.

(given the more restricted matching, substitution of `$this` by it's RDF term should also work)

A problem:
`sh:rule` (AF) has it's own execution model. We would have to either modify that (turn it off) or make attached rules "run once". The latter option seems pointless because it is then no more than a way to write a `CONSTRUCT` rule in another syntax.


Please view or discuss this issue at https://github.com/w3c/data-shapes/issues/765 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 6 February 2026 09:57:30 UTC