Skip to content

[UI] Scoring system#804

Open
danielbeeke wants to merge 5 commits intow3c:gh-pagesfrom
danielbeeke:feature/scoring-system
Open

[UI] Scoring system#804
danielbeeke wants to merge 5 commits intow3c:gh-pagesfrom
danielbeeke:feature/scoring-system

Conversation

@danielbeeke
Copy link
Contributor

@danielbeeke danielbeeke commented Mar 5, 2026

Closes #562, #609

This merge request adds the initial paragraphs of the scoring system.

Notes:

  • I linked to the score validation shape from a different branch
  • This merge request comes from a document that the UI task force created. We are working to tidy up this merge request.

Things to discuss:

  • Is it enough to just link to the score validation shape or do we want to write something about it?
  • Should we merge the validation function with the matcher function?
  • Should we remove the argument Shape node and just use the whole shapes graph always?
  • Was the JavaScript pseudo code intended to be in the spec?
  • How do we distinguish between editor and viewer? Two types? Traversing the widget property and then check the type? Two properties editor/viewer instances of the widget on the score instance?

@danielbeeke danielbeeke added the UI For SHACL 1.2 UI spec label Mar 5, 2026
@smessie smessie self-requested a review March 6, 2026 14:26
Copy link
Member

@smessie smessie left a comment

Choose a reason for hiding this comment

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

This PR is already a great start, thanks! Yet, I think it still needs some refinement.

I see you created this PR branch in your own fork. However that one is outdated, so we'll have to see that we don't have merge conflicts.

Is it enough to just link to the score validation shape or do we want to write something about it?

I don’t have a strong opinion yet, but I think we could definitely start with this. However, the document would surely benefit from some additional clarifications.

Should we merge the validation function with the matcher function?

No, I think it is nice to have them separate as the matcher function calls the validation function twice.

Should we remove the argument Shape node and just use the whole shapes graph always?

I believe it is good to have the shape node explicit. But I would need some arguments to reason further over it.

Was the JavaScript pseudo code intended to be in the spec?

Not sure, but I like how it is now with the algorithm defined as text. I don't necessarily see the need for the JavaScript pseudocode to be included as well.

How do we distinguish between editor and viewer? Two types? Traversing the widget property and then check the type? Two properties editor/viewer instances of the widget on the score instance?

This is probably a good discussion point for one of our next meetings.

</ol>
</section>

<section id="scoring-algorithm-algorithm-steps">
Copy link
Member

Choose a reason for hiding this comment

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

I believe this section is actually the first draft of @edmondchuc which was now replaced by the above algorithm. If I'm correct, then this section should not be included in the document.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@edmondchuc could you verify this?

<section id="scoring-system">
<h2>Scoring System</h2>

<section id="scoring-system-intro">
Copy link
Member

Choose a reason for hiding this comment

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

I would add a subsection in this section, and before starting the Validation Function and other functions, containing the steps in pseudocode (similar to the function sections) how to use the different functions defined below to come to the general scoring algorithm. A bit similar to the JavaScript pseudocode select I believe.

<li><strong>Shapes graph</strong> - the <a href="https://www.w3.org/TR/shacl/#shapes-graph">shapes graph</a> containing the SHACL shapes that define constraints on the data graph and provide the structural and semantic model used to generate and render the user interface. </li>
<li><strong>Scoring graph</strong> An RDF graph containing `shui:WidgetScore` instances that define how widgets are scored.</li>
<li><strong>Constraint shape</strong> A SHACL shape subject in the shapes graph that defines the constraints and structure of the UI rendered for an editing or viewing context.</li>
<li><strong>Shapes graph</strong> the <a href="https://www.w3.org/TR/shacl/#shapes-graph">shapes graph</a> containing the SHACL shapes that define constraints on the data graph and provide the structural and semantic model used to generate and render the user interface.</li> </ul>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<li><strong>Shapes graph</strong> — the <a href="https://www.w3.org/TR/shacl/#shapes-graph">shapes graph</a> containing the SHACL shapes that define constraints on the data graph and provide the structural and semantic model used to generate and render the user interface.</li> </ul>
<li><strong>Shapes graph</strong> — the <a href="https://www.w3.org/TR/shacl/#shapes-graph">shapes graph</a>
containing the SHACL shapes that define constraints on the data graph and provide the
structural and semantic model used to generate and render the user interface.</li>

<li><strong>Focus node</strong> - the node in the data graph for view, create, or update operations.</li>
<li><strong>Data graph</strong> - the <a href="https://www.w3.org/TR/shacl/#data-graph">data graph</a> containing the domain data being edited or viewed. This must be present if a focus node is provided.</li>
<li><strong>Focus node</strong> the node in the data graph for view, create, or update operations.</li>
<li><strong>Data graph</strong> the <a href="https://www.w3.org/TR/shacl/#data-graph">data graph</a> containing the domain data being edited or viewed. This must be present if a focus node is provided.</li>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<li><strong>Data graph</strong> — the <a href="https://www.w3.org/TR/shacl/#data-graph">data graph</a> containing the domain data being edited or viewed. This must be present if a focus node is provided.</li>
<li><strong>Data graph</strong> — the <a href="https://www.w3.org/TR/shacl/#data-graph">data graph</a>
containing the domain data being edited or viewed. This must be present if a focus node is provided.</li>

<p>
At a high level, the scoring system is a function that takes a set of inputs and returns a set of score results,
sorted by their score value in descending order.
sorted by their score value in descending order, with ties broken and thenceforth ordered lexicographically by the Unicode codepoint values of `shui:widget` to ensure deterministic ordering.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
sorted by their score value in descending order, with ties broken and thenceforth ordered lexicographically by the Unicode codepoint values of `shui:widget` to ensure deterministic ordering.
sorted by their score value in descending order, with ties broken and thenceforth ordered lexicographically
by the Unicode codepoint values of `shui:widget` to ensure deterministic ordering.

<p>
The validation function used by the matcher function.<br/>
Inputs:
The validation function used by the <a href="#scoring-algorithm-matcher-function">matcher function</a> to validate the focus node against a list of shape nodes.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The validation function used by the <a href="#scoring-algorithm-matcher-function">matcher function</a> to validate the focus node against a list of shape nodes.
The validation function used by the <a href="#scoring-algorithm-matcher-function">matcher function</a>
to validate the focus node against a list of shape nodes.

<section id="scoring-algorithm-matcher-function">
<h4>Matcher Function</h4>
<p>
The matcher function used by the <a href="#scoring-algorithm-score-function">score function</a> and the <a href="#scoring-algorithm-accept-function">accept function</a> to validate whether a widget score applies to a given focus node and shape node.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The matcher function used by the <a href="#scoring-algorithm-score-function">score function</a> and the <a href="#scoring-algorithm-accept-function">accept function</a> to validate whether a widget score applies to a given focus node and shape node.
The matcher function used by the <a href="#scoring-algorithm-score-function">score function</a> and
the <a href="#scoring-algorithm-accept-function">accept function</a> to validate whether a widget score
applies to a given focus node and shape node.

<li>Return <code>results</code></li>
</ol>
</section>
<li>If no <strong>focus node</strong> is given, a value for the `shui:dataGraphShape` property is present, and no value for the `shui:shapesGraphShape` is present, return `false`</li>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<li>If no <strong>focus node</strong> is given, a value for the `shui:dataGraphShape` property is present, and no value for the `shui:shapesGraphShape` is present, return `false`</li>
<li>If no <strong>focus node</strong> is given, a value for the `shui:dataGraphShape` property
is present, and no value for the `shui:shapesGraphShape` is present, return `false`</li>

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

Labels

UI For SHACL 1.2 UI spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UI] DASH Widget selection algorithm

4 participants