Skip to content
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

Define JSON literal and the rdf:JSON datatype. #150

Merged
merged 7 commits into from
Mar 26, 2019
Merged

Conversation

gkellogg
Copy link
Member

@gkellogg gkellogg commented Mar 25, 2019

For #4.


Preview | Diff

Copy link
Member

@rubensworks rubensworks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor typos.

index.html Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
Copy link
Member

@iherman iherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One major and one minor comment, both on the RDF Datatype definition section:

  • lexical-to-value mapping: I am not sure about referring to the RFC for the parser. That does not define how the ECMAScript representation is really mapped. On the other hand, the following reference: https://tc39.github.io/ecma262/#sec-json-object looks like a good match: it defines (normatively) not only the JSON grammar but, more importantly, the JSON object of ECMAScript that includes the parse() method that does the parsing. I would propose to use that as a reference.
  • value space: I am a bit bothered by the fact that the specification does not define when two objects in the value space are considered to be equal (although this is not required by the RDF spec). Alas!, however, at the moment there is no standard ways of doing that in the ECMAScript land (afaik). There are some libraries that have such functions (e.g., underscore or lodash, both widely used) but, of course, we cannot refer to these normatively. (Maybe @dlongley or @davidlehn have more information.)
    We could add a note about equality and refer to, e.g., the isEqual function of these two libraries (they share the same function name), but I am not sure whether that is useful or necessary. Other languages may have similar methods, and JSON-LD is not bound to ECMAScript...

B.t.w., as soon as this is merged, we should notify the swig mailing list about this, emphasizing the intention to add this to the rdf namespace (I presume we would formally do that when the Rec is published).

Copy link
Contributor

@pchampin pchampin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good, apart from a few minor problems.

Shouldn't we also add a note about not abusing the JSON datatype, as suggested by @BigBlueHat during the last telco? By pointing out that such JSON literals might be considered as opaque by other Linked Data consumers, and hence hinder interoperability?

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
@gkellogg
Copy link
Member Author

the following reference: https://tc39.github.io/ecma262/#sec-json-object looks like a good match

@iherman that's a good match, although the value space includes arrays, numbers, boolean, and null, as well as object.

I am a bit bothered by the fact that the specification does not define when two objects in the value space are considered to be equal.

Yes, indeed. We have some text in the test README that could suffice:

  • JSON objects are compared member by member without regard to the ordering of members within the object. Each member must have a corresponding member in the object being compared to. Values are compared recursively.
  • JSON arrays are generally compared in order; each item within the array must be equivalent to the corresponding item in the array being compared to by using the comparison algorithm recursively.
  • JSON values are compared using strict equality.

@iherman
Copy link
Member

iherman commented Mar 26, 2019

@gkellogg the test Readme text if fine, but do you intend to make this normative?

@gkellogg
Copy link
Member Author

That is what I was suggesting for a normative description of value equality. I’m certainly open to alternatives.

@iherman
Copy link
Member

iherman commented Mar 26, 2019

@gkellogg I am fine putting that into the doc normatively. We will see what the review will give.

@gkellogg gkellogg merged commit 63a9614 into master Mar 26, 2019
@gkellogg gkellogg deleted the json-literals branch March 26, 2019 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants