shexSpec / shex

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

Document production labels #25

Closed labra closed 7 years ago

labra commented 7 years ago

ShEx compact syntax contains production labels which allow to associate a label to a triple constraint or grouped triple expression.

However, the current spec doesn't say much about them.

They appear in the ShExC grammar rule [27]:

[27] unaryTripleExpr ::= productionLabel? (tripleConstraint | bracketedTripleExpr)
                     | include

The spec should at least mention them and there should probably be some representation of production labels in the abstract syntax.

ericprud commented 7 years ago

Does the labels branch address this? Note that this implies changes to shexTest/doc/.

PROPOSE: merge spec/labels and shexTest/labels and close REASON: labels branch apparently sufficient PARTICIPANTS: @ericprud, @gkellogg, @labra

gkellogg commented 7 years ago

Need to do the merge.

ericprud commented 7 years ago

implemented in:

Changes to ShEx2 yacker inline here for clarity:

@@ -86,7 +86,7 @@

 [8]     statement             ::= directive | notStartAction

-[9]     shapeExprDecl         ::= shapeLabel (shapeExpression|"EXTERNAL")
+[9]     shapeExprDecl         ::= shapeExprLabel (shapeExpression|"EXTERNAL")
 [10]    shapeExpression       ::= shapeOr
 [11]    inlineShapeExpression ::= inlineShapeOr
 [12]    shapeOr               ::= shapeAnd ("OR" shapeAnd)*
@@ -105,9 +105,9 @@
                                 | '.'  # no constraint

 [20]    shapeOrRef            ::= shapeDefinition
-                                | ATPNAME_LN | ATPNAME_NS | '@' shapeLabel
+                                | ATPNAME_LN | ATPNAME_NS | '@' shapeExprLabel
 [21]    inlineShapeOrRef      ::= inlineShapeDefinition
-                                | ATPNAME_LN | ATPNAME_NS | '@' shapeLabel
+                                | ATPNAME_LN | ATPNAME_NS | '@' shapeExprLabel

 [22]    nodeConstraint        ::= "LITERAL" xsFacet*
                                 | nonLiteralKind stringFacet*
@@ -136,9 +136,8 @@
 [37]    groupTripleExpr       ::= singleElementGroup | multiElementGroup
 [38]    singleElementGroup    ::= unaryTripleExpr ';'?
 [39]    multiElementGroup     ::= unaryTripleExpr (';' unaryTripleExpr)+ ';'?
-[40]    unaryTripleExpr       ::= productionLabel? (tripleConstraint | bracketedTripleExpr) | include
+[40]    unaryTripleExpr       ::= tripleExprLabel? (tripleConstraint | bracketedTripleExpr) | include
 [41]    bracketedTripleExpr   ::= '(' innerTripleExpr ')' cardinality? annotation* semanticActions
-[42]    productionLabel       ::= '$' (iri | blankNode)

 [43]    tripleConstraint      ::= senseFlags? predicate inlineShapeExpression cardinality? annotation* semanticActions
 [44]    cardinality           ::= '*' | '+' | '?' | REPEAT_RANGE
@@ -149,7 +148,7 @@
 [48]    iriRange              ::= iri ('~' exclusion*)? | '.' exclusion+
 [49]    exclusion             ::= '-' iri '~'?

-[50]    include               ::= '&' shapeLabel
+[50]    include               ::= '&' tripleExprLabel

 [51]    annotation            ::= '//' predicate (iri | literal)
 [52]    semanticActions       ::= codeDecl*
@@ -158,7 +157,8 @@
 [13t]   literal               ::= rdfLiteral | numericLiteral | booleanLiteral
 [54]    predicate             ::= iri | RDF_TYPE
 [55]    datatype              ::= iri
-[56]    shapeLabel            ::= iri | blankNode
+[56]    shapeExprLabel        ::= iri | blankNode
+[42]    tripleExprLabel       ::= '$' (iri | blankNode)
 [16t]   numericLiteral        ::= INTEGER | DECIMAL | DOUBLE
 [129s]  rdfLiteral            ::= string (LANGTAG | '^^' datatype)?
 [134s]  booleanLiteral        ::= 'true' | 'false'
@@ -169,7 +169,7 @@
 [138s]  blankNode             ::= BLANK_NODE_LABEL

 # Reserved for future use
-[57]    includeSet            ::= '&' shapeLabel+
+[57]    includeSet            ::= '&' shapeExprLabel+

 @terminals