8000 ShEx functions or macros · Issue #31 · shexSpec/shex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
ShEx functions or macros #31
Open
Open
@labra

Description

@labra

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0