shexSpec / shex

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

Cardinalities on includes #35

Closed labra closed 7 years ago

labra commented 7 years ago

The following shape is ok:

<S> {
 a [:S] ;
 &<p> ;
 &<p>
}

<definitions> {
  $<p> :p xsd:integer
}

However, the following isn't:

<S> {
 a [:S] ;
 &<p>* 
}

The reason being that the grammar doesn't allow to add cardinalities to the include rule:

[40]    unaryTripleExpr       ::= productionLabel? (tripleConstraint | bracketedTripleExpr) | include
[41] bracketedTripleExpr ::= '(' innerTripleExpr ')' cardinality? annotation* semanticActions

...
[50] include ::= '&' shapeLabel

Should we allow cardinalities in includes?

One possible solution could be to move the include from rule 40 to rule 41:

[41] bracketedTripleExpr ::= '(' innerTripleExpr | include ')' cardinality? annotation* semanticActions

Or just adding an optional cardinality to rule 50.

Is this feasible or is there some reason to forbid cardinalities over includes?

This issue appeared when trying to solve issue #34.

gkellogg commented 7 years ago

Not in favor of cardinality on inclusions, as these are simply references in the RDF model, and references to things having cardinality. In fact, at the model level, an "inclusion" doesn't really exist, it's simply another TripleExpression which happens to be shared.

labra commented 7 years ago

I have no strong opinion on this so I would have no problem leaving it as is.

In fact, I found a possible workaraound to the previous example as:

<S> {
 a [:S] ;
 &<ps> ;
}

<definitions> {
  $<ps> :p xsd:integer*
} 
ericprud commented 7 years ago

I -1'd this for 2.0 as well because I don't know how to write it in ShExJ or ShExR.

labra commented 7 years ago

I agree that we can leave it as it, i.e. without cardinalities on includes.

Should I close the issue as I was the one who raised it or should I wait until next meeting to close it?

ericprud commented 7 years ago

PROPOSAL: close REASON: decision constrained by RDF/JSON-LD graph PARTICIPANTS: @labra, @ericprud, @gkellogg RELATED: ShapeRef and Inclusion redundant in RDF representation

jimkont commented 7 years ago

RESOLVED in 2017-02-17 meeting accepting https://github.com/shexSpec/shex/issues/35#issuecomment-280249065 with the following votes:

ericP: +1 Harold: +1 Dimitris: +1 Tom: +1 LarsG: +1 Andra: +1