i'm not 100% sure about this but i am starting to think that the way #jsonld context declarations propagate by default is generally an anti-pattern
-
@jens i guess i don't really think "generic json processing" or "generic xml processing" really makes any sense. it's like trying to do "generic plaintext processing" or "generic octet stream processing". there should be *some* precondition of shared understanding; otherwise, communication breaks down. this understanding is baked into the application logic, media type, etc... and it always exists at least implicitly, although it can be explicitly described
@jens so the goal of the thread was to take something like "i before e except after c" and extend it to account for edge cases: "or unless it's followed by an r or a g"
the takeaway is basically "jsonld context authors should consider disabling propagation when using protected terms across semantic boundaries (like when merging two documents)"
the alternative is to never do a JSON find-and-replace, and instead strictly process the two documents separately.
-
@jens so the goal of the thread was to take something like "i before e except after c" and extend it to account for edge cases: "or unless it's followed by an r or a g"
the takeaway is basically "jsonld context authors should consider disabling propagation when using protected terms across semantic boundaries (like when merging two documents)"
the alternative is to never do a JSON find-and-replace, and instead strictly process the two documents separately.
basically this is fine:
{"id": "foo", "actor": "i", "type": "Like", "object": "ghostbusters"}
{"@\context": "schema.org", "id": "ghostbusters", "type": "Movie", "actor": "bill-murray"}
and this would be problematic if activity+json used a protected context:
{"id": "foo", "actor": "i", "type": "Like", "object": {"@\context": "schema.org", "id": "ghostbusters", "actor": "bill-murray"}}
note that activity+json doesn't currently use a protected context... but arguably it does in spirit.
-
basically this is fine:
{"id": "foo", "actor": "i", "type": "Like", "object": "ghostbusters"}
{"@\context": "schema.org", "id": "ghostbusters", "type": "Movie", "actor": "bill-murray"}
and this would be problematic if activity+json used a protected context:
{"id": "foo", "actor": "i", "type": "Like", "object": {"@\context": "schema.org", "id": "ghostbusters", "actor": "bill-murray"}}
note that activity+json doesn't currently use a protected context... but arguably it does in spirit.
@jens of course combining the two documents is easy. it's splitting them apart that's challenging. like trying to separate two balls of differently colored play-doh.
the act of injecting movie.json (json, ld+json, hypothetically schemadotorg+json) into like.json (json, ld+json, activity+json) is impure wrt the resource <ghostbusters>. the semantics of activity+json are leaking in and through the semantic boundary of the original two resources.
so either plug the leak, or don't combine. right?
-
@jens of course combining the two documents is easy. it's splitting them apart that's challenging. like trying to separate two balls of differently colored play-doh.
the act of injecting movie.json (json, ld+json, hypothetically schemadotorg+json) into like.json (json, ld+json, activity+json) is impure wrt the resource <ghostbusters>. the semantics of activity+json are leaking in and through the semantic boundary of the original two resources.
so either plug the leak, or don't combine. right?
@jens well, people are combining anyway and not plugging the leak, because they don't know the leak is there.
it's like trying to fit two sections of a water pipe together, except instead of properly screwing them into a fitting, you just glue them together without the fitting.
ideally people would stop gluing together their pipes and use proper fittings instead, but at least i can scrape off the glue and use my own fitting, i guess?
-
@jens well, people are combining anyway and not plugging the leak, because they don't know the leak is there.
it's like trying to fit two sections of a water pipe together, except instead of properly screwing them into a fitting, you just glue them together without the fitting.
ideally people would stop gluing together their pipes and use proper fittings instead, but at least i can scrape off the glue and use my own fitting, i guess?
@jens this is all from the angle of taking arbitrary JSON and "upgrading" it to JSONLD, sure, but even without JSONLD you are still doing the arithmetic in your head.
the same kinds of complexity issues exist for other media formats too. no one said building a web browser was easy!
/fin
-
@jens this is all from the angle of taking arbitrary JSON and "upgrading" it to JSONLD, sure, but even without JSONLD you are still doing the arithmetic in your head.
the same kinds of complexity issues exist for other media formats too. no one said building a web browser was easy!
/fin
@trwnh Again, though, ".actor" and ".object.actor" have different semantics, because of the semantics of ".object", so there really isn't a problem IMHO.
‍
️
-
@trwnh Again, though, ".actor" and ".object.actor" have different semantics, because of the semantics of ".object", so there really isn't a problem IMHO.
‍
️
@jens they can be the same semantics actually
id: foo
actor: i
type: Like
object:
id: bar
actor: you
type: Like
object: that".object" doesn't imply any semantics for <bar>, nor does it imply anything for ".object.actor" or any other properties. that's because <foo> and <bar> are in essence separate resources
it's semantically equivalent to saying
- id: foo
actor: i
type: Like
object: bar
- id: bar
actor: you
type: Like
object: thatonly the serialization is different.
-
@jens they can be the same semantics actually
id: foo
actor: i
type: Like
object:
id: bar
actor: you
type: Like
object: that".object" doesn't imply any semantics for <bar>, nor does it imply anything for ".object.actor" or any other properties. that's because <foo> and <bar> are in essence separate resources
it's semantically equivalent to saying
- id: foo
actor: i
type: Like
object: bar
- id: bar
actor: you
type: Like
object: thatonly the serialization is different.
@jens (in jsonld this is the difference between compacted form and flattened form)
-
@jens (in jsonld this is the difference between compacted form and flattened form)
@jens i am guessing the disconnect is that when you say "semantics" you are including what i would split out as "serialization" and/or "syntax"?
-
@jens they can be the same semantics actually
id: foo
actor: i
type: Like
object:
id: bar
actor: you
type: Like
object: that".object" doesn't imply any semantics for <bar>, nor does it imply anything for ".object.actor" or any other properties. that's because <foo> and <bar> are in essence separate resources
it's semantically equivalent to saying
- id: foo
actor: i
type: Like
object: bar
- id: bar
actor: you
type: Like
object: thatonly the serialization is different.
@trwnh Again: this is *only* the case if your mental model is LD. That is what I keep trying to get across.
If your mental model is "structured data", then you *cannot* assume two different structures have the same semantics.
You want to make LD "safe" for structured data processors. That is only going to happen, IMHO, if you accept how structured data processors deal with semantics.
Instead, you seem to complain that structured data processors aren't linked data processors.
I don't want...
-
@trwnh Again: this is *only* the case if your mental model is LD. That is what I keep trying to get across.
If your mental model is "structured data", then you *cannot* assume two different structures have the same semantics.
You want to make LD "safe" for structured data processors. That is only going to happen, IMHO, if you accept how structured data processors deal with semantics.
Instead, you seem to complain that structured data processors aren't linked data processors.
I don't want...
@trwnh ... to offend you, quite the contrary! But this really isn't going to work, and I am trying my best to get you to understand that.
JSON is just a serialization format from an LD perspective. But from a JSON perspective, LD is just payload; semantics derive from position within the structured data (and specs relating to those positions).
To make JSON-LD compatible with JSON processors is to embrace the structured data model.
-
@trwnh ... to offend you, quite the contrary! But this really isn't going to work, and I am trying my best to get you to understand that.
JSON is just a serialization format from an LD perspective. But from a JSON perspective, LD is just payload; semantics derive from position within the structured data (and specs relating to those positions).
To make JSON-LD compatible with JSON processors is to embrace the structured data model.
@trwnh Or to go back to a previous phrasing: you think in terms of knowledge graphs. In JSON, the graph *is* the structure of the serialization.
You cannot make JSON understand a knowledge graph *unless* you map it into the graph structure that JSON understands. Anything else is futile.
-
@trwnh Or to go back to a previous phrasing: you think in terms of knowledge graphs. In JSON, the graph *is* the structure of the serialization.
You cannot make JSON understand a knowledge graph *unless* you map it into the graph structure that JSON understands. Anything else is futile.
@jens i’m not “complaining”, and it’s not even about LD per se; it’s about the boundary between resources. what you call “two different structures” can be combined without regard for semantics. i just want to preserve semantics.
if the JSON vs JSONLD thing is tripping you up, then consider an example where someone dumps the json to a plaintext string and tries to do an even more naive string find-and-replace. or consider an example where someone manipulates the raw bytes
-
@jens i’m not “complaining”, and it’s not even about LD per se; it’s about the boundary between resources. what you call “two different structures” can be combined without regard for semantics. i just want to preserve semantics.
if the JSON vs JSONLD thing is tripping you up, then consider an example where someone dumps the json to a plaintext string and tries to do an even more naive string find-and-replace. or consider an example where someone manipulates the raw bytes
@jens no offense taken, btw!
-
@jens no offense taken, btw!
@jens if the argument is “they can’t be combined while preserving JSONLD semantics”, i would argue that they can. if anything, they can’t be combined while preserving *JSON* semantics, because nesting a JSON object under a certain key in the document fundamentally alters the semantics of that nested object (if i understand you correctly)
-
@jens if the argument is “they can’t be combined while preserving JSONLD semantics”, i would argue that they can. if anything, they can’t be combined while preserving *JSON* semantics, because nesting a JSON object under a certain key in the document fundamentally alters the semantics of that nested object (if i understand you correctly)
@jens the mere act of nesting erases the boundary between parent and child; the parent’s semantics always override whatever semantics the child had.
is that correct?
-
@jens the mere act of nesting erases the boundary between parent and child; the parent’s semantics always override whatever semantics the child had.
is that correct?
@trwnh It's a weirdly LD way of putting it.
In what I call structured data now, the semantics are derived from the position in the data graph, i.e. the structure, and whichever definitions are associated with this structure.
If we take e.g. https://schema.org/Person 's example 4, ".children.name" has semantics derived from the fact that ".children" has the definition "must also be a Person", not because ".children.@type" has a value of "Person". That field is, from a structured data point of...
-
@trwnh It's a weirdly LD way of putting it.
In what I call structured data now, the semantics are derived from the position in the data graph, i.e. the structure, and whichever definitions are associated with this structure.
If we take e.g. https://schema.org/Person 's example 4, ".children.name" has semantics derived from the fact that ".children" has the definition "must also be a Person", not because ".children.@type" has a value of "Person". That field is, from a structured data point of...
@trwnh ... view, pretty much superfluous.
It's not *entirely* superfluous if you consider that Any or Variant definitions may exist, in which case you need sole type specifier. But it's superfluous in this case, because the textual definition of the meaning of ".children" is unambiguous: https://schema.org/children
The contained object must be Person.
So rather than saying that the parent *overrides*, it's better to state that the parent determines what is permissable.
But that also means...
-
@trwnh ... view, pretty much superfluous.
It's not *entirely* superfluous if you consider that Any or Variant definitions may exist, in which case you need sole type specifier. But it's superfluous in this case, because the textual definition of the meaning of ".children" is unambiguous: https://schema.org/children
The contained object must be Person.
So rather than saying that the parent *overrides*, it's better to state that the parent determines what is permissable.
But that also means...
@trwnh ... that ".children" and ".follows" do not have the same semantics. Yes, the specs both state they're Person, but those aren't the semantics really. The semantics are that one Person is a child of the enclosing Person, and the other is a "uni-directional social relation" (https://schema.org/follows).
So moving those objects elsewhere in the graph modifies the semantics.
This is what LD doesn't really "get", because the knowledge graph is built (can be built) out of a flat list of triplets.
-
@trwnh ... that ".children" and ".follows" do not have the same semantics. Yes, the specs both state they're Person, but those aren't the semantics really. The semantics are that one Person is a child of the enclosing Person, and the other is a "uni-directional social relation" (https://schema.org/follows).
So moving those objects elsewhere in the graph modifies the semantics.
This is what LD doesn't really "get", because the knowledge graph is built (can be built) out of a flat list of triplets.
@trwnh Structured data is never this "flat", the structure is the semantics and vice versa.
So, by assuming the JSON representation is arbitrarily malleable, you're breaking the structured data model.
You can argue that sucks, FWIW, but it's nonetheless the case for all structured data: JSON, YAML, TOML, XML, SGML, CBOR, all of those (more or less) follow the structured data model (attributes in XML/SGML and to a lesser degree YAML have additional structural properties, sure).