-
Notifications
You must be signed in to change notification settings - Fork 154
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
Maps with no keys #569
Maps with no keys #569
Conversation
… containers. Changes behavior for id maps to use `@none` instead of a blank node identifier. Fixes #480
…action to use concatenated/sorted values from `@container`.
spec/latest/json-ld-api/index.html
Outdated
<li>Append the values <code>@index</code> and <code>@index@set</code> | ||
to <em>containers</em>.</li> | ||
</ol> | ||
</li> | ||
append <code>@graph</code>, <code>@id</code>, <code>@index</code> and <code>@set</code> to <em>containers</em>.</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this line supposed to be removed due to additions above?
spec/latest/json-ld-api/index.html
Outdated
is <code>json-ld-1.1</code>, append <code>@id</code>, <code>@type</code>, | ||
and <code>@index</code> to <em>containers</em>.</li> | ||
<span class="changed">and append <code>@id</code>, <code>@id@set</code>, | ||
<code>@type</code>, and <code>@type@set</code></span>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be ordered as @set@type
? (Also, does that appear anywhere else in doc?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, lexicographically.
Note that that IRI Compaction introduces a number of new things to add to |
spec/latest/json-ld/index.html
Outdated
|
||
<p class="changed">The special index <code>@none</code> is used for indexing | ||
data which does not have an associated index, which is useful to maintain | ||
a normalized represeiontation.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling.
spec/latest/json-ld/index.html
Outdated
|
||
<p class="changed">The special index <code>@none</code> is used for indexing | ||
data which does not have a language, which is useful to maintain | ||
a normalized represeiontation.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling.
spec/latest/json-ld/index.html
Outdated
|
||
<p class="changed">The special index <code>@none</code> is used for indexing | ||
<a>node objects</a> which do not have an <code>@id</code>, which is useful to maintain | ||
a normalized represeiontation. The <code>@none</code> index may also be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling.
spec/latest/json-ld/index.html
Outdated
|
||
<p>As with <a>id maps</a>, the special index <code>@none</code> is used for indexing | ||
<a>named graphs</a> which do not have an <code>@id</code>, which is useful to maintain | ||
a normalized represeiontation. The <code>@none</code> index may also be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling.
spec/latest/json-ld/index.html
Outdated
@@ -3517,6 +3674,48 @@ <h2>Node Type Indexing</h2> | |||
--> | |||
</pre> | |||
|
|||
<p class="changed">The special index <code>@none</code> is used for indexing | |||
<a>node objects</a> which do not have an <code>@type</code>, which is useful to maintain | |||
a normalized represeiontation. The <code>@none</code> index may also be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling.
spec/latest/json-ld/index.html
Outdated
<p>As with <a>id maps</a>, the special index <code>@none</code> is used for indexing | ||
<a>named graphs</a> which do not have an <code>@id</code>, which is useful to maintain | ||
a normalized represeiontation. The <code>@none</code> index may also be | ||
a term which expands to <code>@none</code>, such as the term <em>none</em> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy & paste issue: the "none" term isn't used in this example.
You almost touched every file with this commit. |
In general, this is just fine. Two node objects without an There may be an interesting case with unamed/indexed graphs, which we should probably explore. Two anonymous graphs would seem to merge into a single graph, and would not round-trip, where you would normally consider that each anonymous graph was, in fact, named with a missing BNode. Of course, this can be controlled in the source by giving the graph an explicit blank node identifier. I think we should explore with some test cases, and address with a note, but I don't think we need different behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, just a couple of questions.
spec/latest/json-ld/index.html
Outdated
@@ -4250,7 +4448,7 @@ <h2>Language Maps</h2> | |||
or an array containing both <code>@language</code> and <code>@set</code> | |||
</span>. The keys of a | |||
<a>language map</a> MUST be <a>strings</a> representing | |||
[[BCP47]] language codes and the values MUST be any of the following types:</p> | |||
[[BCP47]] language codes, or the <a>keyword</a> <code>@none</code>, and the values MUST be any of the following types:</p> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
..., the keyword @none or an alias that expands to it, and ... ?
<span class="ednote">From <a href="#issue-480">Issue 480</a> | ||
the <a>language tag</a> <code>@none</code> represents no language.</span></li> | ||
<span class="changed">If <em>language</em> is <code>@none</code>, | ||
or expands to <code>@none</code>, do not set the <code>@language</code> member.</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need explicit mention that the underlying RDF datatype is different? (xsd:string versus rdf:langString)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, @none
only appears in the map, it is removed on expansion, so there is no underlying RDF datatype. This is why the id maps were changed to not use blank node identifiers, as it aids round-tripping, and they never make it into either expansion or RDF generation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I agree that @none is json-ld flavored sugar... but the RDF Concepts spec asserts different datatypes based on the presence or lack of a language tag. At least that's my understanding of https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal
If there's a language tag, then the data type is necessarily rdf:langString. And if there isn't, then it's not. If there isn't another data type, it's an xsd:string.
Which we can be completely silent about, but I'd like us to have thought about that silence :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Language maps have a proscribed form, where the key is a string, and the value is either a string or an array of strings, so the expansion of a map value of @none
, would be like {"@value": "non-languaged-tagged value"}
, thus no datatype or language. The Object to RDF Conversion algorithm renders this as a literal without datatype or language, which, as you note, is semantically equivalent to having the datatype xsd:string
.
Do you think this needs some exposition in either document?
I agree that having an array of objects indexed to |
…, as well as the bare keyword `@none`. Fix some minor issues in the API defining values of `@nest`.
…es on merging multiple unindexed or unnamed graphs.
@azaroth42 and @davidlehn your concerns have been addressed. |
Is this feature compatible with an approach possible in 1.0, where you'd use two distinct terms to separate language-keyed values and non-language-tagged ones? Like: {
"@context": {
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"labelByLang": {"@id": "rdfs:label", "@container": "@language"},
"labelString": {"@id": "rdfs:label", "@language": null}
},
"labelByLang": {"en": "thing", "sv": "sak"},
"labelString": "stuff"
}``` |
We may need more tests for this, and the IRI Compaction language may need to be updated. In most cases, preference in term selection is given to the most specific match; there are tests for this, but we may not have sufficient overlap. The language in 2.9.3 may need to be moved until after I'll look through to make sure we have adequate test coverage for these various cases. On a personal note, I have long thought the term selection logic to be over complicated in trying to maintain such variation in matching, which is not the typical case. In 99% of cases (I would guess) there is a single term matching an IRI, and that would be the one to use. Allowing for matching from among a set of possible IRIs complicates the algorithm, and is one aspect of performance issues for large datasets. |
…@language` and `@language@set` when value has neither `@language` nor `@type`. Also move `@index` and `@index@set` for values without `@index` to below `@none`.
CG resolved to merge: https://json-ld.org/minutes/2018-01-22/index.html#resolution-4 |
If further work on this is to be done (apart from ensuring the explicit none-term case works), could we consider this to be an opt-in feature for map containers; e.g. by declaring The "none-term" case is important, we've used it for the National Library data in Sweden (since, in library data in general, lacking language tags is the norm, alas.) |
@niklasl Can you provide an example which illustrates your concern. I'd hate to have to add You can inhibit the behavior by defining another term which would be used for terms which you don't want to be in a language map, as the test case added does. As I mentioned on the call, we could also vary based on |
@gkellogg Indeed, if the behaviour is inhibited to handle the example I provided above, the critical part of the issue is solved, since anyone using language-maps in 1.1 can declare a "companion" term for the none-case. Apart from the reasonably undesired full IRI fallback, there is still one case which works in 1.0 that isn't compatible with this IIUC. If we use {
"@context": {
"@vocab": "http://www.w3.org/2000/01/rdf-schema#",
"labelByLang": {"@id": "label", "@container": "@language"}
},
"labelByLang": {"en": "thing", "sv": "sak"},
"label": "stuff"
} Whereas with none-maps in 1.1, we now get only The new behaviour is reasonably a better default (and I am very grateful for your work on implementing it!). It is technically is a breaking change though (as shown in this and the above example). I think we need to document it in tests, and probably add the processingMode >= 1.1 check as you suggest. And also add clear instructions for how to upgrade to 1.1, by stating that you now have to use a companion term for language-maps in order to single out the non-language-tagged values using distinct terms. I'm not keen on my opt-in either, I just wanted to mention it in case we end up not being able to justify the break. (And if so, while |
See #571. |
@none
, which does not result in adding the index to the indexed object when expanding.@language
,@index
,@id
, and@type
even if there is no corresponding member.