Comments (8)
I support adding @first
. I'll need to work on it, but I think it would be fairly straightforward.
from json-ld-framing.
š
from json-ld-framing.
Was there a WG resolution that we should add this?
from json-ld-framing.
from json-ld-framing.
It may be too late to consider this but... I am a little bit bothered by this feature altogether. Looking at, e.g., example 12, and if I understand it right, we are looking at
{
"@id": "http://example.org/library",
"@type": "Library",
"books": "http://example.org/library/the-republic",
"contains": "http://example.org/library/the-republic"
}
and the value of @first
or @last
refers to the order of books
and contains
to choose among them. However, the order of keys within a JSON object does not matter. (There are plenty of references in, e.g., stackoverflow question to various specs stating that.) Nor does the order matter in RDF. So how come we introduce a feature that explicitly refers to the order of keys?
(I may misunderstand something, though...)
from json-ld-framing.
Both @first
and @last
depend on the algorithm sorting keys, whichi is optional. Thereās an inline editors not about using something like @sample
to use the first one found irrespective of order, which would lead to reproducibility issues.
We may simply need to stick with key ordering to make these work.
from json-ld-framing.
This issue was discussed in a meeting.
- No actions or resolutions
View the transcript
4.1. @embed @FIRST issueDave Longley: #43
Gregg Kellogg: implemented as well as accompanied by tests
ā¦ seems straightforward
Dave Longley: or @once (which is a historical name)
Gregg Kellogg: another alternative would be to remove first and last and go back to all or none
Dave Longley: there is an important use case for having at least one of @FIRST or @last
ā¦ frame docs where you donāt care where something appears but it must appear
ā¦ or certain properties must appear in certain places
ā¦ historically the name for this was @once
ā¦ the change was mostly for testing purposes
Ivan Herman: I feel uneasy that we are talking about order in an environment that doesnāt inherently have order
Gregg Kellogg: thatās why the algorithms do ordering
Ivan Herman: from the user POV they have to know about the algorithms
ā¦ which is not ideal. Iām not objecting, just sharing uneasiness
Ivan Herman: can we push this to next week? Itās more than five minutes of talk.
Gregg Kellogg: ivanās comment is not about this specific PR, but about the general point
ā¦ the existence of @last implies an @FIRST, but the real question is should we be implying ordering at all
Dave Longley: +1
from json-ld-framing.
This issue was discussed in a meeting.
RESOLVED: Change @last (back) to @once, donāt add @first and then figure out testing separately
View the transcript
1.2. @embed @FIRSTRob Sanderson: link: #43
Gregg Kellogg: We touched on this one. Originally, @embed was true or false, if it was true then one of the uses within a node would contain the embedded value vs. just a reference. That was expanded because it was useful to be able to say āwe want all of themā because it would make it much simpler so clients donāt have to follow pointers. Also embed @link was added for navigating an internal representation.
ā¦ We updated it to be the keyword value. And @last was a little arbitrary and the last one expressed in the frame would have the embedded value and @FIRST would be a little more efficient as you donāt have to remove other embeds.
ā¦ First and last implies ordering and all of the ordering is optional and if you donāt have order then first and last are non-sensical, so Dave said to use @once but then testing is hard.
ā¦ This proposal, given that ordering is an option, it makes sense that we also makes sense to be able to say @FIRST vs. @last and itās a separate issue for how these behave or if we need something different if we are not ordering.
Pierre-Antoine Champin: Just an idea on the terminology, @FIRST and @last are misleading ā¦ perhaps @earliest to @latest or something like that. To make the terms less confusing.
David Newbury: Going through the issue, Iām trying to understand the optionalness of the sorting. It feels like what weāre trying to make sure we can do is compare two JS objects as strings.
Gregg Kellogg: That sort of gets into canonicalization ā I believe the tests say we should do a comparison of objects so that ordering isnāt important for comparing but also compare the resulting RDF graphs for isomorphism.
ā¦ But it does make it important to know which of the properties get included in the node or a given subject, in that case, it doesnāt change the RDF signature. They all will be references to another object. Itās really in the JSON thing.
ā¦ Whether you compare unordered or ordered, it still matters where the embedding takes place.
ā¦ The only way to satisfy these cases is so that you run the algorithm so it does process the properties in order. Otherwise you canāt do a structural comparison of the result.
David Newbury: I can say that I have sometimes reordered the properties ā¦ to match documentation. It shouldnāt do that if you use a different keyword. If you do anything to change the order of the JS it doesnāt change the meaning of the graph.
Gregg Kellogg: It is sort of a corner case where you have the same thing referred to multiple times.
David Newbury: And it comes up all the time in our data structures. Every time we want to talk about a first name we have an included object that defines first namedness.
ā¦ We do use repeated signatures throughout the graph.
Rob Sanderson: I can dig up an example. The ordering of the name is arbitrary, the order of the ā¦ firstnamedness and middlenamedness you donāt want to mix that up.
Rob Sanderson: So we do post processing to make sure itās in the right order to look sane.
Ivan Herman: In general, I am really bothered by this. As an author of JSON-LD ā¦ if I really want to control how the framing worksā¦ I have to be aware of somewhat arbitrary ordering in the system that is against my way of ordering my properties in my object.
ā¦ For me, the whole thing is flawed.
Rob Sanderson: My understanding is very similar to David Newberryās ā¦ if the ordering is important and that will determine where things will be embeddedā¦
Rob Sanderson: Then the structure will potentially be very very different depending on the names of the keys. It would be very weird to have to put numbers at the beginning of every key to make sure they end up in the right place.
Ivan Herman: I have to do this elsewhere (iTunes) and I hate it.
Rob Sanderson: If the intent is that the structure should be comparable ā then we donāt need @FIRST ā¦ itās just a flag that says āit goes hereā such that it will be comparable.
Rob Sanderson: Then I donāt think that alphanumeric sorting will help, you donāt want @type appearing at the end or in the middle.
Pierre-Antoine Champin: Iām not sure Iām following ivanās arguments
ā¦ about the expectations of the authors
ā¦ to me JSON objects are unordered
ā¦ as annoying as that is, I donāt expect the order Iāve written to be preserved
ā¦ the thing I queued up originally was to ask about @min and @max
ā¦ to be the smallest or highest key that one can find
ā¦ that would be reproducible
ā¦ and avoid key ordering
Dave Longley: so just looking at all this, I would remove all of the ordering
ā¦ and anything out of any algorithm that would attempt any ordering at all
ā¦ and highlights that the ordering of constituents back then was incorrect
ā¦ we mostly did this ordering for the test suites
Ivan Herman: +1 to dlongley
Dave Longley: original name was @once
ā¦ but what we bumped up again was how do we test this?
ā¦ because you can get really complicated output
ā¦ you canāt test from the RDF, because that isnāt the point of framing
ā¦ what I recommend we do, is in the test suite
ā¦ we order the keys in a certain way
ā¦ letās somehow get the ordering into the test suite
ā¦ and out of the algorithms
Rob Sanderson: +1 to dlongley - ordering in the test suite, not in the spec
Dave Longley: so that we can still test correct ordering in the test suite
Jeff Mixter: +1 to dlongley
Dave Longley: and removing it out of the algorithm will also speed things up
ā¦ leaving it where it is will just confuse users anyhow
ā¦ so removing it is a win for them also
Gregg Kellogg: ordering in the test suite helps
ā¦ itās been updated to not do order based testing of objects
ā¦ so I think the issue is about where to do the embedding
Dave Longley: -1 !
Gregg Kellogg: so we should either do no embedding or embed everywhere
ā¦ anytime you get into having to compare length of strings, youāre doing ordering
ā¦ ordering kills performance
ā¦ the issue of having @FIRST is predicated on having @last
ā¦ so what I think weāre debating now is should there be any reason to have these at all
ā¦ so maybe we only normatively require @none and @Always
Gregg Kellogg: https://w3c.github.io/json-ld-api/tests/#json-ld-object-comparison
Gregg Kellogg: there is a section in the test suite README about how we do object comparison
Ivan Herman: I wanted to answer pchampin, but I think weāve moved past that
ā¦ but +1 to dlongley about removing this
Dave Longley: thereās no way we can just limit this to @none and @Always because there are lots of reasons to just embed one
ā¦ there are lots of use case where data comes in from somewhere, and you need to pluck out the proof or whatever single thing
ā¦ and then you need to do some processing on those
ā¦ and if you inject new triples, that will ruin the data for that processing
ā¦ so you donāt care where the data occurs, just that it does occur
David Newbury: I want to second that
ā¦ Iād like to create shallow set of look-up types
ā¦ I donāt care where it is
ā¦ but it would be really obnoxious to have to dedupe it, etc
ā¦ but where it shows up in the structure is not something Iād ever trust
Gregg Kellogg: then what makes since would be to change @last to @once and then figure out how to test it
ā¦ so when weāre testing we canāt do object comparison
ā¦ and again this sort of goes against the whole purpose of framingā¦but we would need to flatten the structure to do the comparison
Rob Sanderson: I think weāre ready for a proposal
Proposed resolution: Change @last (back) to @once, donāt add @FIRST and then figure out testing separately (Rob Sanderson)
Dave Longley: +1
Rob Sanderson: +1
Gregg Kellogg: +1
Ivan Herman: +1
David Newbury: +1
Benjamin Young: +1
David I. Lehn: +1
Tim Cole: +1
Pierre-Antoine Champin: +1
Simon Steyskal: +1
Jeff Mixter: +1
Resolution #2: Change @last (back) to @once, donāt add @FIRST and then figure out testing separately
Simon Steyskal: The default for the object embed flag is @FIRST (in addition to the explicit inclusion flag being false), and now?
Dave Longley: default should be @once now because it doesnāt add any triples to the graph
from json-ld-framing.
Related Issues (20)
- Should tests for `@embed`: `@last` be restricted to JSON-LD 1.0? HOT 4
- Framing and Arrays HOT 4
- Ex. 41 Playground doesn't contain `@omitGraph: false` + playground does not apply `@omitGraph` HOT 3
- Pattern Matching HOT 4
- Can frames produce id maps? HOT 2
- Possible typos HOT 2
- Use a property several time when framing HOT 1
- validation errors/warnings HOT 1
- Language map with global context HOT 1
- IANA profile should be `frame` not `framed` HOT 5
- how to use the `frame` and `framed` profiles? HOT 12
- Fix invalid WebIDL HOT 1
- Change "Lexicographical Order" (and related) to "Unicode code point order". HOT 1
- Possible bug with `@json` being treated as invalid `type` in frame HOT 24
- How to use specific value inside a frame to filter out credentials those do not contain that value
- Framing on nested graphs
- Add test for `@graph` keyword aliasing
- more JSON-LD framed examples for performance testing
- Type Coercion / Node Conversion HOT 3
- Need tests for: Framing matches on specified value
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-ld-framing.