shexSpec / shex

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

Round tripping node constraints between ShExJ and ShExC #106

Open labra opened 3 years ago

labra commented 3 years ago

The following ShExC fails in the grammar:

prefix : <http://example.org>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>

:S Literal xsd:string

while the equivalent ShExJ seems to be ok:

{
  "@context": "http://www.w3.org/ns/shex.jsonld",
  "type": "Schema",
  "shapes": [
    {
      "type": "NodeConstraint",
      "id": "http://example.org/S",
      "nodeKind": "literal",
      "datatype": "http://www.w3.org/2001/XMLSchema#string"
    }
  ]
}

ShEx-simple allows to convert from the latter to the former, but not in the other direction.

The ShExC grammar has this rule which allows only one component of a node constraint:

[22]    nodeConstraint        ::= "LITERAL" xsFacet*
                                | nonLiteralKind stringFacet*
                                | datatype xsFacet*
                                | valueSet xsFacet*
                                | xsFacet+

I think there are 3 possibilities:

ericprud commented 3 years ago

This points to a suspicious hole in the schema tests. I.e. we should have seen this before.