gs1 / EPCIS

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

use SLASH as namespace separator not DASH #302

Closed VladimirAlexiev closed 3 years ago

VladimirAlexiev commented 3 years ago

(Posting after consultation with @mgh128 and @philarcher)

Old-style CBV namespaces used COLON as separator between namespace and local name e.g. the last colon in urn:epcglobal:cbv:bizstep:shipping. New-style CBV namespaces use DASH, eg cbv:BizStep-shipping, gs1:MT-Temperature, etc.

DASH is a poor choice of such separator because it is used on par with alphanumerics in forming local names (URI components), and using it as separator goes against the grain of some important specs:

gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"

DASH is explicitly listed as a char to be used in local names (URI components):

unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

The use of DASH is the reason for the part BizStep- being dropped in my proposed example in https://github.com/gs1/EPCIS/pull/275#issuecomment-865043230.

The rules for expanding BASE in XML and Turtle are the same: the part after the last gen-delim is thrown away. Eg try this at https://rdf-translator.appspot.com/#tabs_box (input N3, output NTriples):

@base <http://example.org/wrongPrefix->.
<foo> <bar> <baz>.
# prefix is lost, expanded to:
# <http://example.org/foo> <http://example.org/bar> <http://example.org/baz> .

@base <http://example.org/rightPrefix/>.
<foo> <bar> <baz>.
# prefix is kept, expanded to:
# <http://example.org/rightPrefix/foo> <http://example.org/rightPrefix/bar> <http://example.org/rightPrefix/baz> .

COLON is also used sometimes. It has the benefit that it can be used in prefixed names in Turtle, eg:

@prefix epcis: <https://ns.gs1.org/epcis/>.
@prefix cbv:   <https://ns.gs1.org/cbv/>.

# COLON delimiter
_:event1 epcis:bizStep cbv:BizStep:shipping. # use COLON in local name
@prefix cbv-BizStep: <https://ns.gs1.org/cbv/BizStep:>.
_:event2 epcis:bizStep cbv-BizStep:shipping. # use longer prefix: same result

# SLASH delimiter
#_:event3 epcis:bizStep cbv:BizStep/shipping. # SLASH is INVALID in local name
@prefix cbv-BizStep: <https://ns.gs1.org/cbv/BizStep/>.
_:event4 epcis:bizStep cbv-BizStep:shipping. # use longer prefix... but we don't want so many prefixes

However, there seems to be a bug in the JSONLD Playground https://github.com/digitalbazaar/jsonld.js/issues/455 so only SLASH is handled correctly but not HASH or COLON.

VladimirAlexiev commented 3 years ago

After discussion and a vote 5 to 7, it was decided not to change DASH to SLASH because gs1 Voc has a number of codelists that use dash, and two of our codelists (gs1:MT-, gs1:AT-) living there.