Open
Description
Any language will sooner or later need an abstraction mechanism where one can declare some common parts with some parameters that can be reused.
As an example, this ShEx file contains:
<OneOf> CLOSED {
a [sx:OneOf] ;
sx:min xsd:integer? ;
sx:max xsd:integer OR ["*"]? ;
sx:expressions @<tripleExpressionList2Plus> ;
sx:semActs @<SemActList1Plus>? ;
sx:annotation @<Annotation>*
}
<EachOf> CLOSED {
a [sx:EachOf] ;
sx:min xsd:integer? ;
sx:max xsd:integer OR ["*"]? ;
sx:expressions @<tripleExpressionList2Plus> ;
sx:semActs @<SemActList1Plus>? ;
sx:annotation @<Annotation>*
}
which looks very repetitive.
One possible syntax could be:
Let TripleExprComponent(?x) = CLOSED {
a [?x] ;
sx:min xsd:integer? ;
sx:max xsd:integer OR ["*"]? ;
sx:expressions @<tripleExpressionList2Plus> ;
sx:semActs @<SemActList1Plus>? ;
sx:annotation @<Annotation>*
}
<OneOf> TripleExprComponent(sx:OneOf)
<EachOf> TripleExprComponent(sx:EachOf)