Skip to content

Rework well-formedness (rules)#941

Merged
afs merged 1 commit into
gh-pagesfrom
rules-wellformed
Jun 18, 2026
Merged

Rework well-formedness (rules)#941
afs merged 1 commit into
gh-pagesfrom
rules-wellformed

Conversation

@afs

@afs afs commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

The V1 way wasn't very good at expressing the conditions on negation.

The idea is that well-formedness is defined on a sequence of rule elements and an initial set of active variables a rule is a body is sequence of rule elements where the initial set of active variables is empty.

A negation is a sequence of rule elements, with restrictions on the rule elements allowed, where the initial set of active variables is the accumulated of the body-level rule elements preceding the negation element.

Some definition changes - there is is no "rule body element" anymore, "condition" goes away and "condition element" becomes "filter element".

@afs afs marked this pull request as draft June 14, 2026 15:49
@afs afs force-pushed the rules-wellformed branch from 07fbe08 to b6221a8 Compare June 14, 2026 15:51
@afs

afs commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Only the new version is now in the PR document.

@liviorobaldo

liviorobaldo commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

In V2, these three items:

are repeated twice?

Also, I am quite confused about the difference/relation between a condition element and an expression.

V2 states:

If elti is a condition element,

  • every variable mentioned in the expression of the condition element is an element of Vi-1.

However, I do not understand what “expression of the condition element” means.

The definitions say:

So a condition element is itself an expression. In that case, what does “expression of the condition element” refer to?

I think these definitions should be clearer. For instance:

Expressions are described as being compatible with SHACL list parameter functions and with SPARQL expressions.

What does “compatible with” mean in this context? Does this mean that expressions are either SHACL list parameter functions (e.g., sparql:plus(38 4)) or SPARQL expressions (e.g., FILTER expressions)? If so, it might be clearer to state directly that expressions form the union of these two categories.

Finally, is it necessary to distinguish between condition, condition element, and SPARQL expressions (essentially FILTER expressions)? At the moment, these distinctions feel unclear and potentially confusing.

Overall, the terminology appears difficult to follow in its current form... do we truly need all these definitions, can't some of them be collapses into one?

@afs

afs commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Also, I am quite confused about the difference/relation between a condition element and an expression.

V2 states:

If elti is a condition element,

  • every variable mentioned in the expression of the condition element is an element of Vi-1.

However, I do not understand what “expression of the condition element” means.

A condition is a special kind of expression - a condition evaluates to true or false. The expression is wrapped in EBV() (Effective Boolean Value - from Functions and Operators via SPARQL ). This could be removed, and "condition element" rename "filter element" - the word condition is used in the document as general language as well.

A filter element (FILTER() or srl:filter expr) is the rule element where the expression is playing a particular role.

It can be confusing because here there is a 1-1 correspondence but it is trying to call out the role being played. Filters have an expression and nothing else - unlike assignments which have expressions and a variable.

What does “compatible with” mean in this context? Does this mean that expressions are either SHACL list parameter functions (e.g., sparql:plus(38 4)) or SPARQL expressions (e.g., FILTER expressions)? If so, it might be clearer to state directly that expressions form the union of these two categories.

"compatible with" is meant to mean either can be used in the places expressions occur - but also other libraries could be used e.g. domain specific functions. It's not only shnex: and SPARQL.

Some SPARQL expressions are more than shnex evaluation. COALESEC(expr, ....) is not a function because it does not evaluate all its arguments, and only then call the "coalesce" code; errors matter. These matter for implementers.

@afs afs force-pushed the rules-wellformed branch from b6221a8 to b1f4d1d Compare June 17, 2026 12:42
@afs afs added the Rules For SHACL 1.2 Rules spec. label Jun 17, 2026
@afs afs force-pushed the rules-wellformed branch from d4e5ba4 to 2dac8f3 Compare June 17, 2026 14:39
@afs afs marked this pull request as ready for review June 17, 2026 14:39
@afs afs force-pushed the rules-wellformed branch 5 times, most recently from 24526b8 to a6eca7d Compare June 17, 2026 14:56
@liviorobaldo

Copy link
Copy Markdown
Contributor

Hello!

The new version is better, thanks @afs.

However, I still see some elements of confusion. In particular, I still see:

every variable mentioned in the expression of the filter element is an element of Vi-1.

I do not understand "the expression of the filter element", since "A filter element is an expression", according to the definition.

In the definitions, I am also not sure about:

A filter element is an expression that appears as a rule element

and

A triple pattern element is a triple pattern that appears as a rule element.

I am not a native English speaker, so I am not sure whether the expression "that appears as" is appropriate in this case.

I would simply say:

A filter element is an expression and a rule element

A triple pattern element is a triple pattern and a rule element.

This would be consistent with the definitions of negation element and assignment element.

All the rest looks good to me 👍

@afs

afs commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

The role in which expression is being used matters. "that appears as" is talking about the role.

A filter element is an expression.

But an expression is not a filter element.
An expression can also be in the role of (the calculation of) an assignment value.

"A is a B" can be read as an equivalence, also meaning "B is an A".

I do not understand "the expression of the filter element"

That can be just the filter element. Change made.

(Please say where quoted text is coming from, position within the document and/or an earlier comment or use the "files changed" view. I can't search for text in the HTML because it looks different. Also - documents change so text may be different but the point still valid. /thanks)

@afs afs force-pushed the rules-wellformed branch from a6eca7d to 82d5756 Compare June 18, 2026 10:49
@afs

afs commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Could I get an approval on this PR, please?

I'm more than happy to further refine definitions.

In order to progress on other sections of the document, I need the definitions to in the editing copy.

And the vacation season approaches - the review cycle gets longer.

I'll use a "working copy" approach to completing the document, not a multiple-PR approach. Then, changes can seen for review and progress made, while not needing approvals on small increments in separate PRs.

@simonstey simonstey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good for now, thx!

@afs afs merged commit bd1b27d into gh-pages Jun 18, 2026
2 checks passed
@afs afs deleted the rules-wellformed branch June 18, 2026 12:51
@afs

afs commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

@liviorobaldo , @simonstey
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rules For SHACL 1.2 Rules spec.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants