-
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
Should output type of expand()
be dict
or str
?
#143
Comments
Step 9 of the JSON-LD
It is the internal Expansion Algorithm which returns a map or array, the API is responsible for coordinating internal calls and serializing (or deserializing) the internal representation. |
I see, I should have looked into the API spec once again befote asking. But, say, Does this mean it is not, in this particular aspect, conformant? |
Something for @davidlehn to comment on. Serialization may be handled just outside the API call. Ruby is probably similar. But, the API definitions between JSON-LD and YAML-LD should be symmetric. |
I may get lost in the nuances here. Is this asking if I see the YAML-LD spec says to serialize to YAML instead: https://json-ld.github.io/yaml-ld/spec/#jsonldprocessor, https://json-ld.github.io/yaml-ld/spec/#conversion-to-yaml. In that case, it seems implementations would interpret that as needing to serialize into an actual YAML string. I'm a bit behind on understanding how YAML-LD works. Is the internal structure the same as in the JSON-LD case, or is it annotated somehow with more advanced YAML features? If you wanted to process the data structures, what would you do? Call a YAML-LD API call then reparse the plain YAML output into a JSON-like data structure? That seems a bit awkward. So there may be a difference in the how the JSON-LD spec is worded and what is done in practice. And I can see how that is a bit more difficult to handle in the YAML-LD case. I'm not quite sure how to make these symmetric. |
I agree with the practicality of this approach.
The Extended YAML Profile, which would call for use of advanced YAML features, is only described in an addendum to current spec: it is not, at this version, normative. So what an implementation can do (say, what my python-yaml-ld.iolanta.tech does) is plainly to convert YAML into a data structure, pass that to JSON-LD library (like, I am basing upon For me, motivation is exactly that:
Can we find a middle ground here between the practicality and our ability to normatively describe the specification? |
Context
The spec (in its non-normative part) says:
Question
Should
expand()
output adict
, a native type, or a serialized YAML string?The text was updated successfully, but these errors were encountered: