gs1 / EPCIS

Draft files being shared for EPCIS 2.0 development
Other
20 stars 7 forks source link

SHACL: remove superfluous `pattern` for `nodeKind IRI` #412

Open VladimirAlexiev opened 2 years ago

VladimirAlexiev commented 2 years ago

@mgh128 https://github.com/gs1/EPCIS/blob/master/Ontology/EPCIS-SHACL.ttl now has a number of patterns like this:

    sh:nodeKind sh:IRI ;
    sh:pattern "^(.+?):(.+)$" ;

This pattern is superfluous since it's part of URI syntax: https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax. You cannot have a URI without a colon preceded and followed by something (I can't imagine a URI with "empty path" as mentioned at that link). In ntriples you can't use relative URIs:

$ echo "<foo> <bar> <baz>." | riot.bat --validate -syntax ntriples -
20:19:46 ERROR riot            :: [line: 1, col: 1 ] Relative IRI: foo
20:19:46 ERROR riot            :: [line: 1, col: 7 ] Relative IRI: bar
20:19:46 ERROR riot            :: [line: 1, col: 13] Relative IRI: baz

In Turtle you can use relative URIs, but they are always resolved to some base (even if random), which includes a scheme:

$ echo "<foo> <bar> <baz>." | riot.bat -syntax turtle -
<http://base/foo> <http://base/bar> <http://base/baz> .

You cannot set an empty base. @base can be relative, but it's again resolved to that default random base:

$ echo "@base <>. <foo> <bar> <baz>." | riot.bat -syntax turtle -
<http://base/foo> <http://base/bar> <http://base/baz> .

JSONLD fields declared of type @id or @vocab are expanded to full URIs by the time they get to SHACL.