[data-shapes] Pull Request: feat: Implement sequence processing improvements for SHACL Node Expressions (Issue #484)

simonstey has just submitted a new pull request for https://github.com/w3c/data-shapes:

== feat: Implement sequence processing improvements for SHACL Node Expressions (Issue #484) ==
This pull request implements comprehensive changes to address [Issue #484](https://github.com/w3c/data-shapes/issues/484) regarding sequence processing naming inconsistencies in SHACL Node Expressions. The changes align the vocabulary and documentation with the sequence-based nature of node expression processing while maintaining backward compatibility through deprecation notices.

## Problem Statement

SHACL Node Expressions are fundamentally sequence-based but were using set-style operation names, creating confusion:
- Operations like `union` and `minus` suggested set semantics despite working on ordered sequences
- The generic `path` property conflicted conceptually with constraint `sh:path` 
- Missing advanced sequence operations limited processing capabilities

## Solution

### 1. Vocabulary Renaming for Sequence Semantics

**Renamed Operations:**
- `shnex:union` → `shnex:join` - Emphasizes sequence concatenation with order preservation
- `shnex:minus` → `shnex:remove` - Clearer operation name for sequence subtraction
- `shnex:path` → `shnex:pathValues` - Distinguishes from constraint `sh:path` (needs to align with #514 )

**Deprecation Strategy:**
- Updated `shacl.ttl` with deprecation notices for `sh:union` and `sh:minus`
- Maintained backward compatibility while guiding migration to new terms

### 2. Advanced Sequence Operations

**New Operations Added:**
- `shnex:flatMap` - Applies expression to each input node and flattens results
- `shnex:findFirst` - Returns first node conforming to a given shape
- `shnex:matchAll` - Returns true if all nodes conform to a given shape

## Files Modified

### Vocabulary Files
- **`shacl12-vocabularies/shnex.ttl`**
  - Added complete RDF definitions for FlatMap, FindFirst, and MatchAll expressions
  - Updated existing definitions with sequence-appropriate naming
  - Enhanced property comments for clarity

- **`shacl12-vocabularies/shacl.ttl`**
  - Added deprecation notices for `sh:union` and `sh:minus`
  - Clear migration guidance to new sequence-based terms

### Documentation
- **`shacl12-node-expr/index.html`**
  - Renamed sections: UnionExpression → JoinExpression, MinusExpression → RemoveExpression


### New Advanced Operations:
```turtle
# Find first senior employee
sh:values [
    shnex:findFirst [
        shnex:nodes [ shnex:pathValues ex:employee ] ;
        shnex:findFirst ex:SeniorEmployeeShape ;
    ] ;
] .

# Check if all employees are active
sh:values [
    shnex:matchAll [
        shnex:nodes [ shnex:pathValues ex:employee ] ;
        shnex:matchAll ex:ActiveEmployeeShape ;
    ] ;
] .
```

Fixes #484 - Sequence processing naming inconsistencies

---

**Reviewers:** Please pay special attention to:
- Vocabulary definition completeness in `shnex.ttl`
- Evaluation semantics for new advanced operations
- Example accuracy and practical utility
- Documentation clarity and consistency


Closes #484 

* [See this document rendered online here](https://raw.githack.com/w3c/data-shapes/issue-484-sequence-processing/shacl12-node-expr/index.html)


See https://github.com/w3c/data-shapes/pull/526


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

Received on Monday, 25 August 2025 09:41:51 UTC