shexSpec / shex

ShEx language issues, including new features for e.g. ShEx2.1
25 stars 8 forks source link

Node constraints always before Shape expressions? #23

Open labra opened 7 years ago

labra commented 7 years ago

The following schema is ok:

prefix : <http://example.org/>
:S IRI PATTERN "^http://example.org/id[0-9]+" @:R 
:R { :p . }

but the following is wrong:

prefix : <http://example.org/>
:S IRI @:R PATTERN "^http://example.org/id[0-9]+"
:R { :p . }

The reason is that production 20 of the ShExC grammar prescribes that node constraints must appear before shape or references.

shapeAtom ::= nodeConstraint shapeOrRef?
          | shapeOrRef
          | "(" shapeExpression ")"
          | "."

Although it may be OK for version 2.0, I think it is too restrictive and some users may want to mix node constraints and shapes in any order.

ericprud commented 5 years ago

Note that you can add AND to make this work: