← Back to Pull requests

feat(shacl): support SHACL 1.2 node-expression forms #7348

Closed
unknown closed this pull request without merging on Nov 13, 2026 13:51 UTC
View on GitHub
unknown unknown commented on Nov 13, 2026 03:35 UTC
Author

<!-- claude-projects-attribution: {"github_login":"jeswr"} -->
_Requested by Jesse · project thread_

Summary

Prepared by an automated contributor.

Addresses #7326.

Change and design

The pinned node-expression evaluation suite now passes 272 entries in both
feature states, with four decimal lexical comparisons retained as failures.
Every evaluation entry is attempted. The pass floor is 272 and failure ceiling
is 4; no conformance floor is lowered.

Node expressions moved out of the optional SHACL-AF rule engine into one shared,
always-compiled evaluator. The existing rule-module reexports stay compatible.
Standalone evaluation and SPARQL custom-function callbacks now share SPARQL
function forms, SELECT/SPARQL expressions, named/list-parameter bodies, argument
access, conformance checks and constant triple terms. The fallible API preserves
the distinction between an empty result and an evaluation failure.

Named arguments remain lazy expressions evaluated in an empty variable scope;
list arguments evaluate in the caller's scope and enforce scalar cardinality.
Failures take precedence over empty list arguments. Optional conditional
branches evaluate only the selected branch. Ordering and extrema reuse the
shared SPARQL total-order algorithm with exact numeric and temporal observations.
Validation retains its scoped registry/dataset caches and no per-query graph
forks. Custom callback models and parsed bodies are cached, with the lazy model
held out of line behind Arc.

The main merge preserves the SHACL 1.2 rules12 executor, declared entailments,
Core/SPARQL changes and generalized algebra visitor. Both the bound-CONSTRUCT
helper and the named ?result function-output helper are retained. The strict
rules12 operand subset, including absent focus for global rules, stays intact;
custom functions reached through rule queries use the shared evaluator. An
integration test covers that route through a named-result SPARQL function.
README, usage skills and the conformance record describe these distinctions.

Pinned suite results

Suite revision: 04ecbb4a5b930f4fa9df6c399ac5c98ccec672c9.

| SHACL 1.2 section | Passed | Failed |
| --- | ---: | ---: |
| Core | 162 | 0 |
| SPARQL | 98 | 0 |
| Node expression constraints (shacl-af) | 8 | 0 |
| Node expression custom functions | 22 | 0 |
| Node expression shnex | 142 | 0 |
| Node expression shnex-sparql | 108 | 4 |
| Inference rules (shacl-af) | 47 | 0 |
| EARL total | 587 | 4 |

SHACL 1.0 EARL has 120 passes and zero failures. Evaluation alone is 272 / 4 / 8
in both feature states; its eight non-evaluation entries belong to the separate
constraint runner and are omitted from evaluation EARL assertions. Inference
rules retain the 47-pass floor and zero failures/skips with shacl-af; without
it all 47 entries skip. SPARQL-RL remains unsupported: its standalone census is
0 passed / 342 failed / 0 skipped in both states, and is excluded from the SHACL
1.2 EARL report. Unsupported negative tests receive no conformance credit.

Retained test/spec differences

The main decimal changes do not change these four xsd:decimal comparisons:

| Entry | Suite spelling | Engine spelling |
| --- | --- | --- |
| ceil-example | 4.0 | 4 |
| floor-example | 3.0 | 3 |
| round-example | 4.0 | 4 |
| seconds-example | 00 | 0 |

The pinned SPARQL function evaluation text
requires “following the SPARQL semantics of the corresponding SPARQL function”.
These results have the required datatype and value; the functions do not require
these particular lexical spellings. The runner retains term-sensitive comparison
and leaves all four failing. No expected or actual literal is normalized and no
suite file is changed.

Validation

  • Crate tests with NODE_PATH unset: 436 passed by default and 541 with

  • shacl-af, with two ignored reference tests in each state.
  • Every tests/w3c*.rs runner meets its floor in both feature states.

  • Crate clippy in both states and full-workspace clippy excluding sparq-py,

  • all targets, -D warnings.
  • sparq-shacl-wasm checks for wasm32-unknown-unknown, both feature states.

  • Workspace rustdoc, all features, no dependencies, RUSTDOCFLAGS=-D warnings.

  • Offline pinned EARL generation, including inference-rule census checks.

  • Twenty independent node-expression behavior tests and twenty-four rules12

  • behavior tests, including the new cross-evaluator integration case. Existing
    validation-scoped registry/dataset counter tests remain green.
  • Two merge-specific mutations caught by their intended tests: selecting the

  • first function result column and removing CONSTRUCT focus pre-binding. The
    unchanged expression implementation also retains the earlier twenty killed
    guard mutations; those mutation runs preceded the merge.
  • Diff preflight, whitespace check, scoped Markdown lint, and feature execution

  • and feature tier guards. Adversarial review verified that resolved sparql.rs
    equals main plus the branch's function-output helper, preserving both sides.

    Reference-engine fuzzing, line coverage, dependency audits and SBOM generation
    require tools absent from this sandbox. The maintainer report includes exact
    external commands and makes no claim that those checks ran.

    The validation-path benchmark completed with identical reports. Its method and
    results are in the separate maintainer report.

    ---
    _Generated by Claude Code_

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: jeswr Review duration: 616m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.57) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.57 · 650 lines diff across 8 files
    0.57
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #7348"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 57% (MEDIUM) · Higher = larger blast radius
    57%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 24.7% · Safe to merge
    24.7%