Subject: [Asdf] Namespacing

From: David Kemp <[email-masked]>
Date: Tue, 11 Aug 2020 11:21:40 -0400

The SDF description of namespacing seems a bit convoluted:

The following example declares a set of namespaces and defines cap as the
> default namespace.
> <https://www.ietf.org/id/draft-onedm-t2trg-sdf-00.html#section-3.2-5>
>
> "namespace": {
>   "cap": "https://example.com/capability/cap",
>   "zcl": "https://zcl.example.com/sdf"
> },
> "defaultNamespace": "cap",
>
> <https://www.ietf.org/id/draft-onedm-t2trg-sdf-00.html#section-3.2-6>
>
> If no defaultNamespace setting is given, the SDF definition file does not
> contribute to a global namespace. As the defaultNamespace is set by giving
> a namespace short name, its presence requires a namespace map that contains
> a mapping for that namespace short name.
> <https://www.ietf.org/id/draft-onedm-t2trg-sdf-00.html#section-3.2-7>
>
> If no namespace map is given, no short names for namespace URIs are set
> up, and no defaultNamespace can be given.
>

The namespacing goals of an SDF file are to:
1) contribute to a global namespace
2) reference definitions from the global namespace

The last statement sounds like a self-licking ice cream cone: namespace
maps have to be set up in order to give a default namespace. That's a
true statement, but the reason for setting up a namespace map is to
contribute to and reference the global namespace, not to enable someone to
give a default namespace.

JSON Schema uses the $id keyword to contribute, and the $ref keyword to
reference.  OpenC2 extends JSON Schema by adding the short name map (called
"imports") to allow short references.

Is it reasonable to align SDF with JSON Schema by presenting the same
information in a clearer way?

<https://www.ietf.org/id/draft-onedm-t2trg-sdf-00.html#section-3.2-5>

"id": "https://example.com/capability/cap",
"namespace": {
  "zcl": "https://zcl.example.com/sdf"
}

<https://www.ietf.org/id/draft-onedm-t2trg-sdf-00.html#section-3.2-6>

---

From: Carsten Bormann <[email-masked]>
Date: Tue, 11 Aug 2020 17:34:22 +0200

On 2020-08-11, at 17:21, David Kemp <[email-masked]> wrote:
> 
> Is it reasonable to align SDF with JSON Schema by presenting the same information in a clearer way?

Well, the json-schema.org proposals and SDF go into different spaces, so I don’t think there is a strong reason to align.

More recent versions of the json-schema.org proposals use $id for modifying a “base URI” (which is otherwise inherited from document context as defined in Section 5.1.4 of RFC 3986.  We certainly wouldn’t want a feature that makes the meaning of an SDF spec depend on from where you are downloading it.

I like the fact that the current structure gives the defaultNamespace a short name as well (“cap” in the example).

Grüße, Carsten

---

From: David Kemp <[email-masked]>
Date: Tue, 11 Aug 2020 12:19:42 -0400

An XML "prefix" (short name) is local to the file containing its
assignment, and because it is short, it is not globally-unique.

Attempting to bind a short name to a global name beyond the local scope
will inevitably lead to collisions, or to registration of reserved short
names, or to conventions that attempt to minimize collisions of short
names.  That's a can of worms that could be easily avoided by not defining
non-local short names in the first place.

The defaultNamespace *could *be given a short name, but it is never used in
the local scope.  So why bother, except to invite trouble?

Regards,
Dave