Replies: 8 comments 4 replies
-
I would prefer making this a guideline for a separate format within KDL (like XiK). Different use cases of KDL, e.g. CSS selectors or Rust module path, might want to use |
Beta Was this translation helpful? Give feedback.
-
Also of note, using URLs (or any of their equivalents with similar initialisms) as a unique token is incredibly bad. They encode a lot more information/syntax into the token than is required for uniqueness; they imply resolvability (which can be very bad for highly-used namespaces; see the lengths the W3C has to go thru to deal with the bandwidth of badly-written XML tools trying to resolve their namespaces URLs); people naturally assume they're manipulable in the same ways that URLs are ( The sole benefit of using URLs is that there's already a reasonable mechanism for "claiming" them (the URL registrars), tho even that's just a meta-benefit; it doesn't mean anything at the actual namespace level (and there are namespace domains that host a bunch of namespaces, so people don't have to bother with maintaining a domain registration themselves). Java practice, which is still somewhat tied to URLs for historical reasons, strips all those issues away by just using reverse-domain ( XiK allows for XML namespace usage using the exact same syntax as XML itself, but I'd be strongly against trying to saddle KDL itself with a similar generic mechanism. |
Beta Was this translation helpful? Give feedback.
-
This has been on my mind all day. For some context/history: Furthermore, discussion around giving special meaning to What would it mean for identifiers with namespaces? Is I started a discussion over at https://twitter.com/zkat__/status/1567194570278187010 and there were some great points made in favor of XML namespaces, particularly for stuff like XSLT or the metadata use-case you mentioned. At the same time, there exist such things as JSON-LD for data linking stuff, and that makes me wonder if the right place for a "metadata" abstraction is an additional layer on top of KDL, not a namespace system that all implementers are required to get right, but few users will ever use. |
Beta Was this translation helpful? Give feedback.
-
Note that, as XiK says, if you're embedding XML in KDL the existing syntax is just fine; you can't use For languages designed to be widely applicable in a generic fashion, like metadata, uniquifying the names themselves is, in practice, more than enough. If everyone in the world writes There are still use-cases for having a generic, separate namespacing mechanism that is clearly distinct from the plain names, and which is managed by some type of central registry to prevent collisions. But they are, in practice, miniscule in comparison to the set of use-cases that work fine with just manually-uniqued names. And they can be handled in a fashion similar to json-ld, where a recognized meta-layer can communicate it. |
Beta Was this translation helpful? Give feedback.
-
Namespacing is probably the worst part of XML. If it became a core part of KDL I’d probably just go back to JSON5. No thank you. |
Beta Was this translation helpful? Give feedback.
-
RE @tabatkins to clear up some misconceptions regarding IRIs/URLs :—
If it is so incredibly bad, why does every major metadata institution do it? (Examples: the Library of Congress, Wikidata, the British National Bibliography, Google, the fediverse, etc…) The thing you are criticizing is an internet best practice which has existed for decades and which has only become more important in recent years.
Actually the sole benefit of using URLs is that it is a universally‐recognizable syntax with defined semantics, which is a very good benefit.
This requires having additional documentation about what each (locally) unique name means in a global sense (for example, “in this document the prefix Assuming that all humans/computers reading the file already knows what the Responding to other points :—
|
Beta Was this translation helpful? Give feedback.
-
Because, for historical reasons, the big "metadata" crowd invested heavily in XML at one point in time, and that historical association has stuck for both inertia and personal (that is, literally the same people involved in many efforts) reasons. (Note that I've been involved in web standards for roughly 15 years now, so while I postdate the initial XML stuff, I've been around for a lot of discussions that are basically "ah, you want to express metadata? then you have to inherit all these xml-isms or it's terrible".) A lot of it is that if you use tooling that hides the gory details of namespaces from you (so you can just work with prefixes), then it's no problem, because then it has roughly the same usability as all the non-URL-based namespacing mechanisms I mentioned. When you have a diversity of tooling and authors, tho, such that those details aren't hidden, it gets substantially worse.
Sure, but those are (a) stripped down to precisely the amount needed for uniqueness and nothing else, making them unreadable for humans, and (b) in practice not used by any grammar intended for hand-authoring (due to (a)).
Yup, meaningful names are important. It's the rest of the URL that's not meaningful, and comes with significant practical downsides.
I also strongly dispute the "defined semantics", since people use path segments , queries, and fragments in their NS urls, as far as I can tell, utterly at random. A URL on the web has reasonably well-defined semantics for its chunks, due to a combination of user expectations, common server configs, and browser behavior (for example, using a query segment triggers a request, but using a fragment doesn't), but a URL-ish string used in non-browser contexts can mean
And yet that is, in fact, precisely what FOAF processors consuming information from the web at large need to do. When hand-authoring, people regularly omit the namespace declaration, or provide the wrong one (either an entirely wrong URL for some reason, or a subtly wrong one due to errors in the URL that register as insignificant to our human eyes, like All that said, you don't have to try and convince me; I've been working in web standards, as I said, for 15 years now, and I've formed my opinions thru long exposure. I find that XML Namespaces and their spiritual successors extremely appeal to certain people, for reasons I've never quite understood, and it's very difficult to convince them otherwise, but it's similarly difficult for them to make inroads back. There's a mindset disconnect that just can't be bridged very often. |
Beta Was this translation helpful? Give feedback.
-
I really like linked data and I think KDL would be well suited to encode it, but I don't see a major downside with implementing namespace handling on top of the KDL standard, like JiK and XiK. |
Beta Was this translation helpful? Give feedback.
-
Why?
Namespacing is extremely important in the world of metadata, and an important prerequisite for using KDL as a metadata language.
As one trivial example,
created
in DCMI is used to provide the date that a resource was created.However, another person might choose to use
created
as an inverse of thecreator
property, which is to say, to point from the creator to the resource they made.Being able to distinguish these two senses of “created” is necessary for any metadata author.
It is already possible to represent the above examples in KDL as follows:
…but this is very cumbersome.
Details
There are actually two different kinds of “namespacing” which you can have, depending on what you consider your “expanded name”s.
In XML, “expanded names” consist of a pair of a local name (an identifier) and a namespace (an IRI). For example,
<html xmlns="http://www.w3.org/1999/xhtml">
has a local name ofhtml
and a namespace ofhttp://www.w3.org/1999/xhtml
. It is not possible to represent both components in a single string.However, most contemporary solutions instead have “expanded names” which are IRIs, which are “compacted” into a namespace prefix and a suffix. For example,
http://www.w3.org/2001/XMLSchema#date
might be compacted intoxsd:date
by assigning the prefixxsd:
tohttp://www.w3.org/2001/XMLSchema#
.In order to implement the second kind, KDL would need two things:
A way of declaring prefixes for a given scope (e.g. a node), and
A syntax for compacted names which is canonically equivalent to catenating the expansion for the prefix to whatever follows it.
The first kind can be left to KiX, as it is really XML‐specific.
Possible Solution
Reserve properties which end with a
:
as a prefix declaration.:
in such properties (only one colon is allowed).:
is allowed (empty prefix is OK).:
in properties where it isn’t the final character.When a node name,
property key, or type annotation contains a:
and there is a matching prefix declaration in that node or any ancestor, the computed node name is the value of the prefix declaration plus the bit which follows the first:
.:
, but only the first can end a prefix.property keysand type annotations, the prefix declaration must precede them on the current node, or belong to an ancestor node. Prefix declarations which follow aproperty keyor type annotation on the same node won’t be used for thatproperty keyor type annotation (although they may be used for others).blah:
is a prefix declaration or a prefix with no suffix, and because namespaced property keys are (I think) unnecessary. I’m fine limiting prefixing to just node names and type annotations, where there is no ambiguity.Here is what that would look like:
Note that attributes ending in
:
are invalid in (namespace‐aware) XML, so prefix definitions are not possible and identifiers with:
will continue to be treated literally in XiK. This allows the existing XML namespacing solutions to continue working with no changes.Beta Was this translation helpful? Give feedback.
All reactions