Repository navigation
Conversation
jdsika
force-pushed
the
fix/shaclgen-any-of-pattern
branch
3 times, most recently
from
May 7, 2026 12:13
6630206 to
f9c16d5
Compare
jdsika
force-pushed
the
fix/shaclgen-any-of-pattern
branch
6 times, most recently
from
May 12, 2026 10:53
d1652e5 to
bfa9ea6
Compare
jdsika
force-pushed
the
fix/shaclgen-any-of-pattern
branch
from
June 9, 2026 15:20
bfa9ea6 to
2c6b519
Compare
jdsika
force-pushed
the
fix/shaclgen-any-of-pattern
branch
from
July 3, 2026 11:51
2c6b519 to
09a4fbd
Compare
rmessaou
force-pushed
the
fix/shaclgen-any-of-pattern
branch
2 times, most recently
from
July 8, 2026 08:49
a578620 to
d736a35
Compare
3 tasks done
jdsika
force-pushed
the
fix/shaclgen-any-of-pattern
branch
2 times, most recently
from
September 11, 2026 14:02
0c334af to
7394735
Compare
jdsika
force-pushed
the
fix/shaclgen-any-of-pattern
branch
2 times, most recently
from
October 2, 2026 11:22
7007bcd to
fdee56f
Compare
Added full titles for the two October 2026 presenters.
The SHACL generator translated any_of branches by dispatching
solely on `any.range` (class, type, enum, or simple datatype).
If a branch specified `pattern:` — either alone or combined
with a range — the constraint was silently dropped, producing
an empty blank node `[ ]` (trivially satisfied) instead of the
intended `[ sh:pattern "..." ]`.
This is a problem for schemas that use pattern alternatives in
`any_of`, such as the SPDX license field where valid values are
either members of a fixed enum (SPDX identifiers), IRIs, or
custom identifiers matching the LicenseRef- pattern defined in
SPDX Specification v2.3 Annex D (ABNF: license-ref =
["DocumentRef-"(idstring)":"]"LicenseRef-"(idstring)).
The fix adds a single check after the range dispatch:
if any.pattern:
g.add((range_list[-1], SH.pattern, Literal(any.pattern)))
This correctly handles:
- Pattern-only branches (no range): node gets only sh:pattern
- Range + pattern branches: node gets both sh:datatype and sh:pattern
- Range-only branches (no pattern): unchanged behaviour
The test suite now includes a dedicated schema exercising all
three cases, with assertions on both the generated RDF triples
and pyshacl validation of conforming/non-conforming data.
Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
A slot that declares both `pattern` and `any_of` lost its pattern in SHACL, because sh:pattern was only emitted when the slot had no any_of. The pattern constrains every value of the slot independently of the branch the value matches, so it now sits on the property shape next to sh:or, as JSON Schema already enforces it. Signed-off-by: jdsika <carlo.van-driesten@vdl.digital>
jdsika
force-pushed
the
fix/shaclgen-any-of-pattern
branch
from
October 13, 2026 16:00
fdee56f to
c684754
Compare
…ting row Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Update Community-Meetings.md
Author
|
merged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirror of linkml#3485, same head. Review there; this PR tracks the fork stack.
Summary
gen-shacldroppedpatternwhenever a slot usedany_of:patterninside anany_ofbranch produced an empty member shape[ ]. Every value satisfies an empty shape, sosh:oraccepted anything.patternnext toany_ofwas not emitted at all.Both are now emitted. JSON Schema already enforces both.
Generated SHACL (excerpt):
Semantics
patternmeans "the string value of the slot must conform to this regular expression", andany_of"holds if at least one of the expressions hold". A slot-level pattern therefore applies to every value, whichever branch the value matches.sh:patternapplies to each value node (SPARQLstrandREGEX), andsh:orrequires each value to conform to at least one member shape. A branch pattern therefore belongs on its member shape, and a slot pattern belongs on the property shape next tosh:or.Commits
sh:ormember shapes. This commit is unchanged from the approved version, apart from the rebase ontomain.sh:patternnext tosh:or. It is a separate commit so the change since approval is easy to review. Squash on merge.Testing
tests/linkml/test_generators/input/shaclgen/any_of_pattern.yamlcovers:any_ofThe tests assert the generated triples, and check conforming and non-conforming data with pyshacl. The new case fails without commit 2.
Other generators
JSON Schema enforces both cases, and OWL emits branch patterns. Pre-existing and unchanged:
any_ofbranches.patternconstraints.structured_patterninside anany_ofbranch.