Skip to content

extension/restrictions accept shape references (EXTENDS @<label>) - #17

Merged
ericprud merged 1 commit into
masterfrom
extends-shaperef
Jul 28, 2026
Merged

ericprud merged 1 commit into
masterfrom
extends-shaperef

Conversation

@ericprud

Copy link
Copy Markdown
Contributor

shexTest, shex.js, Apache Jena and rudof all write EXTENDS @<label> / RESTRICTS @<label> (e.g. schemas/vitals-RESTRICTS.shex), but ShExDoc.g4's extension/restrictions rules only accepted a bare shapeExprLabel. Both now accept (shapeRef | shapeExprLabel), keeping the bare-label form for backwards compatibility. The first-token sets are disjoint, so the alternatives don't conflict.

Regenerating the Python parser from this grammar (with ANTLR 4.9.3) plus small visitor updates is PRed at linkml/grammar-python-antlr-linkml#4; with those, PyShEx passes the shexTest validation manifest from ShExC: 1184 tests = 1091 passed / 0 failed / 93 trait-skips.

🤖 Generated with Claude Code

shexTest, shex.js, Apache Jena and rudof all write EXTENDS @<label> /
RESTRICTS @<label> (e.g. schemas/vitals-RESTRICTS.shex), but ShExDoc.g4's
extension/restrictions rules accepted only a bare shapeExprLabel.  The
bare-label form was never correct and never deployed, so both rules now
take shapeRef instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ericprud
ericprud merged commit 0698cf6 into master Jul 28, 2026
ericprud pushed a commit to ericprud/grammar-python-antlr-linkml that referenced this pull request Jul 28, 2026
- ShExDoc grammar: extension and restrictions take shapeRef ('EXTENDS @<label>'),
  matching usage everywhere (shexTest, shex.js, Apache Jena, rudof).  The bare
  shapeExprLabel form was never correct and never deployed, so it is not accepted.
  Parser regenerated with ANTLR 4.9.3 to match the antlr4-python3-runtime~=4.9.3 pin.
  (Companion grammar change PRed at shexSpec/grammar#17.)
- visitQualifier / shapeExprDecl restrictions route shapeRef through shapeRef_to_iriref.
- ShExC serializer emits the @-form for EXTENDS/RESTRICTS so output re-parses.
- generate_shexj.load_shex_file: chardet.detect can return {'encoding': None}; never
  pass None to bytes.decode (crashed on the shexTest ShExC manifest).

Verified against shexSpec/shexTest validation manifest via linkml/PyShEx:
1184 tests = 1180 passed, 0 failed, 4 skips (schemas pyshexc cannot parse).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ericprud pushed a commit to ericprud/PyShEx that referenced this pull request Jul 28, 2026
shexSpec/grammar#17 and linkml/grammar-python-antlr-linkml#4 dropped the
never-deployed bare shapeExprLabel form; EXTENDS/RESTRICTS now require a
shape reference (EXTENDS @<label>).  All shexTest EXTENDS schemas already
use the @-form, so results are unchanged: 129 passed, 21 skipped, 1 xfailed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant