-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File signature #7
Comments
Assuming a specific content-type gets registered, would this answer your issue? |
@nichtich some comments:
This means that we cannot rely on magic numbers / file signatures.
|
There are several more ways to push down the start of actual content in a YAML file. YAML syntax is a beast.
Text based file formats rarely have traditional fixed positon magic file numbers but applications should be able to scan the first lines of a YAML file to detect whether it's meant to be YAML-LD. By the way another solution to this requirement is to state that YAML-LD document must include $schema as its first key. |
This is not going to change :)
YAML + JSON-LD + JSON-Schema will not be simpler that YAML + JSON-LD ;) |
JSON-LD does not have a way to verify that the file is, in fact, JSON-LD if retrieved as |
Probably, the only way to include a magic number in yaml is by starting a document with a comment, Eg #?i-am-yaml-ld. Imho it's not interoperable as comments are not preserved by all parser. I agree with @gkellogg when he says that JSON -LD does rely on other information to determine whether a JSON documents is an LD. I think that, once parsed, we should take a similar approach. |
I would like to voice the following counter arguments to the introduction of special tags and headers. Historical example: HTMLHTML had a required doctype header before HTML 5; everyone was copy-pasting that header (or generating with there IDE) — but ultimately, I do not believe it was very informative. With modern HTML, the header had been reduced to just Duck typingI am a proponent of conciseness. If the machine can interpret this file as YAML-LD, then it is YAML-LD. If it cannot do that it will yield an error message. If a YAML file is loadable into an RDF graph (possibly with an external context) — it is YAML-LD. Distinction between YAML and YAML-LD does not existThe versatility of JSON-LD and, consequently, YAML-LD is rooted in the fact that a JSON or a YAML document managed by not-LD-aware software can be interpreted as a Linked Data document, even if you do not have control over its content. You just need to supply the right context. For instance, I am interpreting GitHub API output as JSON-LD, and consuming it into a RDF graph, without any meaningful changes to the document itself. The same might apply to YAML data and configuration files. Just supply the proper context, and the file starts making real sense. Thus, — how do you distinguish a YAML file vs a YAML-LD file? — You don't. All YAML is potentially YAML-LD if you have the proper context ready. SummaryI'd voice against mandatory tags. They will limit the interoperability of the standard and the tooling around it, add syntactic noise and magic that non-technical domain experts will have to deal with when writing YAML-LD. I would think we should not burden them with that. |
If this was the case, there would be no need to define YAML-LD: just use an existing YAML2JSON conversion and use the result as JSON-LD. If, however, interpreting YAML-LD requires to process YAML-LD documents in any special way not covered by the default YAML2JSON mapping, I would better want to know whether a document requires this additional processing step. |
@nichtich with the idea of the However, my opinion expressed above is about a slightly different thing. I meant that almost any valid YAML file can be interpreted as YAML-LD, and thus there is no need to specially mark some YAML files as YAML-LD with a special header, comment, or tag. |
I side with @pchampin and @anatoly-scherbakov : if we come up with a signature, it should be recommended but not mandatory. |
Having browsed through the issues in this repository, it seems that the following design principle has been established: Any valid JSON-LD document can be converted to a valid YAML-LD document with a generic YAML2JSON converter. I am also in the understanding that JSON-LD does not have a file signature, so I think it cannot be mandatory for YAML-LD either. (I'm new here and have not formed an opinion if it should be recommended or supported.) |
Yes, that seems to be the emerging consensus, but a profile allowing more use of YAML features may also be supported eventually, but the base YAML-LD profile is likely limited to simple conversion of the parsed JSON, as described in #12. |
@nichtich I claim in #17 "The Then #17 (comment) gives a detailed example. So if we adopt a "signaling" tag, do you agree instead of
to use something like
|
@gkellogg I propose to close as "wontfix" the "File signature" issue: like JSON-LD, we really need to inspect the content to understand whether it's YAML-LD. A forced solution could just create clashes with future YAML versions (we're building upon YAML). I don't know how to make it work for example with files that contain multiple yaml documents, e.g.
|
@ioggstream I propose to define a short useful but optional piece of advice to put in the Internet Media Type section Eg https://www.w3.org/TR/turtle/#sec-mediaReg:
|
@VladimirAlexiev imho magic numbers need to be reliable. They are used and implemented by generic tools like the I briefly scraped the media type registrations, and on ~ 896 application/* media types, the word "near" is used 1 times ( for sparql-query). YAML does not provide magic number, and if I were to provide one in YAML-LD, I'd just say "See YAML". My2¢, R. |
As a data consumer
I want an indicator to tell me that a file is probably YAML-LD
So that I know when to expect YAML-LD
Strict checking whether a YAML document is valid YAML-LD requires to follow the full specification. Nevertheless
some kind of magic file number would be useful. As suggested here a YAML global tag could be used for this purpose (see RFC 4151):
YAML processors will raise a "unknown tag" error when trying to process the document without knowledge of YAML-LD. It can still be parsed as valid YAML but there is no default mapping to JSON. This is not a bug, but a feature.
The text was updated successfully, but these errors were encountered: