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
-
@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).
@jens even without LD you'd still have issues if you applied plaintext merging rules on json objects dumped to strings, which is the equivalent operation at a lower level.
the thing is, in the example you give, you're staying within the schema.org vocabulary, and you're also looking at it purely from the lens of the root object (the Person that is the parent). i'm looking at it from the lens of the nested object.
if a Person's child is also a Person, then can't that child also have children?
-
@jens even without LD you'd still have issues if you applied plaintext merging rules on json objects dumped to strings, which is the equivalent operation at a lower level.
the thing is, in the example you give, you're staying within the schema.org vocabulary, and you're also looking at it purely from the lens of the root object (the Person that is the parent). i'm looking at it from the lens of the nested object.
if a Person's child is also a Person, then can't that child also have children?
@jens say we have a JSON object, id: foo.
".children" has an id: bar.
".children.children" has an id: baz.
it seems entirely reasonable to me to consider foo, bar, and baz to be individual JSON objects, just nested within each other. is there anything wrong with this interpretation?
in an XML tree, you can consider a subtree to also be an XML tree. maybe that subtree originated from a different XML document, like how we can include SVG in HTML.
-
@jens say we have a JSON object, id: foo.
".children" has an id: bar.
".children.children" has an id: baz.
it seems entirely reasonable to me to consider foo, bar, and baz to be individual JSON objects, just nested within each other. is there anything wrong with this interpretation?
in an XML tree, you can consider a subtree to also be an XML tree. maybe that subtree originated from a different XML document, like how we can include SVG in HTML.
@jens the crossover from "HTML semantics" to "SVG semantics" is invisible to most people who aren't aware of the distinction, but that doesn't mean it doesn't exist.
-
@jens the crossover from "HTML semantics" to "SVG semantics" is invisible to most people who aren't aware of the distinction, but that doesn't mean it doesn't exist.
@trwnh Yes, you would have the same issues, but there's a semantic (haha) difference:
Lower level processors cannot make assumptions about higher level processors, without being told to make them. So a string processor cannot really perform any modifications to the string, unless they're told it's fine to do them.
Similarly, a JSON processor cannot make modifications to the document structure, unless they're told that's fine.
Here's the rub: in the example you were giving a while back, of a..
-
@trwnh Yes, you would have the same issues, but there's a semantic (haha) difference:
Lower level processors cannot make assumptions about higher level processors, without being told to make them. So a string processor cannot really perform any modifications to the string, unless they're told it's fine to do them.
Similarly, a JSON processor cannot make modifications to the document structure, unless they're told that's fine.
Here's the rub: in the example you were giving a while back, of a..
@trwnh ... JSON processor resolving JSON references and replacing them with their referred to objects, this sits somewhere on an intermediate layer between JSON and JSON-LD.
If the processor "speaks" references, then according to any and all rules about processing them, this is fine.
It isn't doing anything wrong, because the data structure derived from parsing the doc-with-refs-preserved and the one derived from parsing doc-with-refs-resolved is the same.
In that sense, it isn't changing...
-
@trwnh ... JSON processor resolving JSON references and replacing them with their referred to objects, this sits somewhere on an intermediate layer between JSON and JSON-LD.
If the processor "speaks" references, then according to any and all rules about processing them, this is fine.
It isn't doing anything wrong, because the data structure derived from parsing the doc-with-refs-preserved and the one derived from parsing doc-with-refs-resolved is the same.
In that sense, it isn't changing...
@trwnh ...anything at all about the represented data.
If this changes anything about the semantics of the LD, then JSON-LD shouldn't be using JSON references (brutally put, I know), because it knowingly breaks the underlying JSON semantics.
-
@trwnh ...anything at all about the represented data.
If this changes anything about the semantics of the LD, then JSON-LD shouldn't be using JSON references (brutally put, I know), because it knowingly breaks the underlying JSON semantics.
@trwnh Since we're working with plain text analogies here, this is like putting non-ASCII bytes into a string without specifying anything about what they mean (i.e. an encoding).
-
@trwnh Since we're working with plain text analogies here, this is like putting non-ASCII bytes into a string without specifying anything about what they mean (i.e. an encoding).
@jens we might finally be on the same page
> Lower level processors cannot make assumptions about higher level processors, without being told to make them.
this is what i was trying to do, yeah. how can a lower level processor preserve higher level semantics? what do you need to "tell" them to retain alignment?
the references are kind of unavoidable, since this is the web we're talking about. you have multiple documents, but naive processors try to be "clever" and save you HTTP requests.
-
@jens we might finally be on the same page
> Lower level processors cannot make assumptions about higher level processors, without being told to make them.
this is what i was trying to do, yeah. how can a lower level processor preserve higher level semantics? what do you need to "tell" them to retain alignment?
the references are kind of unavoidable, since this is the web we're talking about. you have multiple documents, but naive processors try to be "clever" and save you HTTP requests.
@jens the "rub" is that AS2 claims to be "JSON-LD but you can totally ignore the LD part we promise lol"
you can *mostly* ignore a lot of the complexity, but only if you stay within the boundaries of activity+json semantics, i.e. "don't use external vocabs, and if you do, don't redefine activitystreams terms"
the extensibility mechanism is ld+json. you can include ld+json inside activity+json but you need to not violate the constraints of activity+json.
-
@jens the "rub" is that AS2 claims to be "JSON-LD but you can totally ignore the LD part we promise lol"
you can *mostly* ignore a lot of the complexity, but only if you stay within the boundaries of activity+json semantics, i.e. "don't use external vocabs, and if you do, don't redefine activitystreams terms"
the extensibility mechanism is ld+json. you can include ld+json inside activity+json but you need to not violate the constraints of activity+json.
@jens but also, any json can become ld+json with a sufficiently complex context definition. the ld+json processor cannot understand the implicit semantics of json; it needs to be made explicit in the form of a jsonld context.
we want the jsonld context's described semantics to not diverge from the *actual* semantics. we can't be aware of every vocab or media type in the world. so the semantic boundaries between individual resources are important.
but we do want to reduce those pesky roundtrips
-
@jens but also, any json can become ld+json with a sufficiently complex context definition. the ld+json processor cannot understand the implicit semantics of json; it needs to be made explicit in the form of a jsonld context.
we want the jsonld context's described semantics to not diverge from the *actual* semantics. we can't be aware of every vocab or media type in the world. so the semantic boundaries between individual resources are important.
but we do want to reduce those pesky roundtrips
@jens this is why i put "clever" in quotation marks. like, yes, that's just how references work, no problems there.
the problem is that you are taking something that isn't activity+json and sticking it in an activity+json document.
more precisely, the media type no longer applies to the *entire* document; there is a fragment of the document that has a different media type (like the hypothetical schemadotorg+json i was talking about earlier)