Skip to content

Relationship between sh:order and sh:layer #1183

Description

@afs

https://www.w3.org/TR/shacl12-sparql/#rule-variations

In particular, the algorithm is non-deterministic in the sense that unless the order of rules is specified explicitly, the results may differ across executions. This is, for example, the case when rules draw conclusions from the number of certain triples yet those triples may be produced by other rules. In this document, the responsibility of producing a predictable ordering and layering/grouping of rules is left to the rule author.

Editorial:
"the order of rules" is ambiguous - it should be about the general concept but it can read as if specific to sh:order. The example needs sh:layer in general, for counting. It might get away with sh:order for specific data although the new repeated execution per layer has a considerable impact on that.

More generally, when is it appropriate to use sh:order with SHACL 1.2 Inf Rules, given the repeated layer execution until fixed point? Some text about this to assist the user (and reveiwer) would be helpful.

In https://www.w3.org/TR/shacl12-sparql/#rule-order, the example comment says:
(Aside - sh:order is not necessary in the example)

     sh:order 1 ;   # Will be evaluated before 2

but that isn't the whole story because it will also be run after rule 2 --

	do
		Execute one iteration over all iterating rules in the layer
	while the iteration has produced newly inferred triples

means there is always a last "execute iteration" that produces no triples from any of the layer rules.
If any rule in a layer produces at least one triple, then all rules in the layer run at least twice.

Also:

and the stata (ignoring sh:layer).

s/stat/layer/

Metadata

Metadata

Assignees

No one assigned

    Labels

    SHACL RulesFor SHACL 1.2 Inference Rules spec

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions