Skip to content
  • Categories
  • Recent
  • Popular
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

NodeBB-ActivityPub Bridge Test Instance

  1. Home
  2. Categories
  3. Uncategorized
  4. 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

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

Scheduled Pinned Locked Moved Uncategorized
jsonld
106 Posts 3 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • trwnh@mastodon.socialT trwnh@mastodon.social

    @jens

    > The "baz" namespace determines what "quux" means, and the definition of "quux" determines the semantics of finding a "foo:bar" underneath it

    ok, but how do you deal with a naive processor that doesn't know what any of this means?

    i am describing the case where you see this:

    <some activity> <has an actor> <me>.
    <some activity> <is a> <Like>.
    <some activity> <has an object> <ghostbusters>.

    then you dereference <ghostbusters> and get:

    <ghostbusters> <has an actor> <bill murray>.

    trwnh@mastodon.socialT This user is from outside of this forum
    trwnh@mastodon.socialT This user is from outside of this forum
    trwnh@mastodon.social
    wrote last edited by
    #43

    @jens an aware agent can merge these two graphs while preserving context. <has an actor> in the first graph gets qualified with a prefix or namespace.

    an unaware agent doesn't know what they're doing. they just blindly copy <has an actor> without qualifying it at all. this is what introduces the issue.

    jens@social.finkhaeuser.deJ 1 Reply Last reply
    0
    • trwnh@mastodon.socialT trwnh@mastodon.social

      @jens an aware agent can merge these two graphs while preserving context. <has an actor> in the first graph gets qualified with a prefix or namespace.

      an unaware agent doesn't know what they're doing. they just blindly copy <has an actor> without qualifying it at all. this is what introduces the issue.

      jens@social.finkhaeuser.deJ This user is from outside of this forum
      jens@social.finkhaeuser.deJ This user is from outside of this forum
      jens@social.finkhaeuser.de
      wrote last edited by
      #44

      @trwnh What issue?

      The issue only exist if you insist on interpreting the merged document (! not knowledge graph!) as linked data.

      "has an object" isn't something JSON knows. JSON knows keys that point at values. Your value may be a reference, if you go that way, or it may be any other JSON.

      Perhaps the key is "hasObject". Perhaps it's "attachment". Either way, the path ".outer-key.actor" is different from ".actor", so whatever sits there as values doesn't have the same semantics.

      trwnh@mastodon.socialT 1 Reply Last reply
      0
      • nik@toot.teckids.orgN nik@toot.teckids.org

        @trwnh As I said: no. JSON-LD is not plain JSON, period. The terms used in one JSON-LD document are only ever valid in this one document. The document is the boundary, you cannot make any assumptions from one document for another one. It's true for all RDF sources, and even laid out explicitly in RDF Syntax and Abstract Concepts. That goes even further: Semantics of one document may change every time you read it (not applicable here, but please just never ignore that JSON-LD is RDF).

        trwnh@mastodon.socialT This user is from outside of this forum
        trwnh@mastodon.socialT This user is from outside of this forum
        trwnh@mastodon.social
        wrote last edited by
        #45

        @nik JSON-LD is not plain JSON, but it can be parsed as plain JSON. this is a core part of ActivityStreams 2.0 -- and most of fedi takes this approach. fedi largely doesn't care about RDF at all, and will happily ignore that...

        nik@toot.teckids.orgN 1 Reply Last reply
        0
        • trwnh@mastodon.socialT trwnh@mastodon.social

          @nik JSON-LD is not plain JSON, but it can be parsed as plain JSON. this is a core part of ActivityStreams 2.0 -- and most of fedi takes this approach. fedi largely doesn't care about RDF at all, and will happily ignore that...

          nik@toot.teckids.orgN This user is from outside of this forum
          nik@toot.teckids.orgN This user is from outside of this forum
          nik@toot.teckids.org
          wrote last edited by
          #46

          @trwnh I *know*. I know that most fedi devs don't understand the Social Web, and I know ActivityStreams explicitly promotes flawed implementations. And I know that everyone and their dog follow Eugen's example of making ActivityPub a zoo of proprietary JSON.

          trwnh@mastodon.socialT 1 Reply Last reply
          0
          • nik@toot.teckids.orgN nik@toot.teckids.org

            @trwnh I *know*. I know that most fedi devs don't understand the Social Web, and I know ActivityStreams explicitly promotes flawed implementations. And I know that everyone and their dog follow Eugen's example of making ActivityPub a zoo of proprietary JSON.

            trwnh@mastodon.socialT This user is from outside of this forum
            trwnh@mastodon.socialT This user is from outside of this forum
            trwnh@mastodon.social
            wrote last edited by
            #47

            @nik right, i also dislike the fragility of fedi implementations. i'm trying to bridge the gap for the LD haters to at least produce valid documents.

            nik@toot.teckids.orgN 1 Reply Last reply
            0
            • trwnh@mastodon.socialT trwnh@mastodon.social

              @nik right, i also dislike the fragility of fedi implementations. i'm trying to bridge the gap for the LD haters to at least produce valid documents.

              nik@toot.teckids.orgN This user is from outside of this forum
              nik@toot.teckids.orgN This user is from outside of this forum
              nik@toot.teckids.org
              wrote last edited by
              #48

              @trwnh Thanks for making band-aids.

              But maybe get @Gargron to publish his proprietary extensions as RDF-parsable context first instead of letting everyone outside Mastodon guess what his JSON-LD is supposed to mean.

              We're making band-aid for things not some small individual Fedi hacker did, but to support corporate decisions of Fedi leaders that get in the way of individual Fedi hackers.

              trwnh@mastodon.socialT 1 Reply Last reply
              0
              • jens@social.finkhaeuser.deJ jens@social.finkhaeuser.de

                @trwnh What issue?

                The issue only exist if you insist on interpreting the merged document (! not knowledge graph!) as linked data.

                "has an object" isn't something JSON knows. JSON knows keys that point at values. Your value may be a reference, if you go that way, or it may be any other JSON.

                Perhaps the key is "hasObject". Perhaps it's "attachment". Either way, the path ".outer-key.actor" is different from ".actor", so whatever sits there as values doesn't have the same semantics.

                trwnh@mastodon.socialT This user is from outside of this forum
                trwnh@mastodon.socialT This user is from outside of this forum
                trwnh@mastodon.social
                wrote last edited by
                #49

                @jens it is possible to merge in a way that results in a valid graph with no semantic confusion. the goal of the thread was to describe such an approach.

                > the path ".outer-key.actor" is different from ".actor", so whatever sits there as values doesn't have the same semantics

                the ".outer-key" here has no inherent semantics for the value; it only has semantics for the subject. for example, the `object` of an Activity can be anything. you can't assume anything about `object.actor` vs `actor`.

                jens@social.finkhaeuser.deJ 1 Reply Last reply
                0
                • nik@toot.teckids.orgN nik@toot.teckids.org

                  @trwnh Thanks for making band-aids.

                  But maybe get @Gargron to publish his proprietary extensions as RDF-parsable context first instead of letting everyone outside Mastodon guess what his JSON-LD is supposed to mean.

                  We're making band-aid for things not some small individual Fedi hacker did, but to support corporate decisions of Fedi leaders that get in the way of individual Fedi hackers.

                  trwnh@mastodon.socialT This user is from outside of this forum
                  trwnh@mastodon.socialT This user is from outside of this forum
                  trwnh@mastodon.social
                  wrote last edited by
                  #50

                  @nik i'm not sure we can expect people who don't understand RDF at all (and indeed don't even *want* to understand it) to suddenly become RDF-friendly good citizens.

                  nik@toot.teckids.orgN 1 Reply Last reply
                  0
                  • trwnh@mastodon.socialT trwnh@mastodon.social

                    @nik i'm not sure we can expect people who don't understand RDF at all (and indeed don't even *want* to understand it) to suddenly become RDF-friendly good citizens.

                    nik@toot.teckids.orgN This user is from outside of this forum
                    nik@toot.teckids.orgN This user is from outside of this forum
                    nik@toot.teckids.org
                    wrote last edited by
                    #51

                    @trwnh

                    This very thread proves that ignoring RDF makes handling JSON-LD so incredibly difficult that it cannot be expected from fedi hackers either.

                    If you are competent enough to handle that complexity yourself, go and learn RDF instead, it's simpler.

                    If you aren't, use a library, in which case it should handle RDF *and* help you ignore the complexity.

                    trwnh@mastodon.socialT 1 Reply Last reply
                    0
                    • nik@toot.teckids.orgN nik@toot.teckids.org

                      @trwnh

                      This very thread proves that ignoring RDF makes handling JSON-LD so incredibly difficult that it cannot be expected from fedi hackers either.

                      If you are competent enough to handle that complexity yourself, go and learn RDF instead, it's simpler.

                      If you aren't, use a library, in which case it should handle RDF *and* help you ignore the complexity.

                      trwnh@mastodon.socialT This user is from outside of this forum
                      trwnh@mastodon.socialT This user is from outside of this forum
                      trwnh@mastodon.social
                      wrote last edited by
                      #52

                      @nik we can say this as many times and as loudly as we want, but it won't change anyone's minds nor their software.

                      rather than declaring it all to be junk, it can be preprocessed (or fixed) into something properly semantic. that's because meaning is descriptive, not prescriptive. any arbitrary JSON payload has implicit semantics that can be made explicit with enough description -- that's what the JSON-LD context is.

                      yes, we can also write more/better libraries at the same time. let's do both.

                      nik@toot.teckids.orgN 1 Reply Last reply
                      0
                      • trwnh@mastodon.socialT trwnh@mastodon.social

                        @nik we can say this as many times and as loudly as we want, but it won't change anyone's minds nor their software.

                        rather than declaring it all to be junk, it can be preprocessed (or fixed) into something properly semantic. that's because meaning is descriptive, not prescriptive. any arbitrary JSON payload has implicit semantics that can be made explicit with enough description -- that's what the JSON-LD context is.

                        yes, we can also write more/better libraries at the same time. let's do both.

                        nik@toot.teckids.orgN This user is from outside of this forum
                        nik@toot.teckids.orgN This user is from outside of this forum
                        nik@toot.teckids.org
                        wrote last edited by
                        #53

                        @trwnh

                        If we want to allow people to ignore RDF, then at least do it correctly (resolve all terms into full IRIs). The plain JSON form of a JSON-LD document is not the original JSON-LD with the context key stripped away, but with all keys containing full IRIs.

                        If we do that, I am perfectly fine with people just using it as plain JSON (with really odd keys).

                        trwnh@mastodon.socialT 1 Reply Last reply
                        0
                        • nik@toot.teckids.orgN nik@toot.teckids.org

                          @trwnh

                          If we want to allow people to ignore RDF, then at least do it correctly (resolve all terms into full IRIs). The plain JSON form of a JSON-LD document is not the original JSON-LD with the context key stripped away, but with all keys containing full IRIs.

                          If we do that, I am perfectly fine with people just using it as plain JSON (with really odd keys).

                          trwnh@mastodon.socialT This user is from outside of this forum
                          trwnh@mastodon.socialT This user is from outside of this forum
                          trwnh@mastodon.social
                          wrote last edited by
                          #54

                          @nik that’s indeed one thing i recommend to people — stop assuming everyone else shares your context, and always use full IRIs. in effect, this is like compacting *only* against the AS2 context and no additional context augmentations.

                          1 Reply Last reply
                          0
                          • trwnh@mastodon.socialT trwnh@mastodon.social

                            @jens it is possible to merge in a way that results in a valid graph with no semantic confusion. the goal of the thread was to describe such an approach.

                            > the path ".outer-key.actor" is different from ".actor", so whatever sits there as values doesn't have the same semantics

                            the ".outer-key" here has no inherent semantics for the value; it only has semantics for the subject. for example, the `object` of an Activity can be anything. you can't assume anything about `object.actor` vs `actor`.

                            jens@social.finkhaeuser.deJ This user is from outside of this forum
                            jens@social.finkhaeuser.deJ This user is from outside of this forum
                            jens@social.finkhaeuser.de
                            wrote last edited by
                            #55

                            @trwnh That depends on what the definition of "outer-key" in the context of the root object means. If the root object defines the key to point to any arbitrary value, that's an incomplete definition.

                            trwnh@mastodon.socialT 1 Reply Last reply
                            0
                            • jens@social.finkhaeuser.deJ jens@social.finkhaeuser.de

                              @trwnh That depends on what the definition of "outer-key" in the context of the root object means. If the root object defines the key to point to any arbitrary value, that's an incomplete definition.

                              trwnh@mastodon.socialT This user is from outside of this forum
                              trwnh@mastodon.socialT This user is from outside of this forum
                              trwnh@mastodon.social
                              wrote last edited by
                              #56

                              @jens well, that’s activity streams for ya 😛

                              an actor can be anything, an object can be anything. the most minimal way to serialize an activity is to just use references, but you often want more information about the actor and/or object, so you dereference those. but a lot of naive json producers want to be “helpful” and save you the extra http requests, so they embed the dereferenced json documents… naively…

                              jens@social.finkhaeuser.deJ 1 Reply Last reply
                              0
                              • trwnh@mastodon.socialT trwnh@mastodon.social

                                @jens well, that’s activity streams for ya 😛

                                an actor can be anything, an object can be anything. the most minimal way to serialize an activity is to just use references, but you often want more information about the actor and/or object, so you dereference those. but a lot of naive json producers want to be “helpful” and save you the extra http requests, so they embed the dereferenced json documents… naively…

                                jens@social.finkhaeuser.deJ This user is from outside of this forum
                                jens@social.finkhaeuser.deJ This user is from outside of this forum
                                jens@social.finkhaeuser.de
                                wrote last edited by
                                #57

                                @trwnh But if it's an incomplete definition, then it's hardly the naive JSON processor's fault 😁🤣

                                trwnh@mastodon.socialT 1 Reply Last reply
                                0
                                • jens@social.finkhaeuser.deJ jens@social.finkhaeuser.de

                                  @trwnh But if it's an incomplete definition, then it's hardly the naive JSON processor's fault 😁🤣

                                  trwnh@mastodon.socialT This user is from outside of this forum
                                  trwnh@mastodon.socialT This user is from outside of this forum
                                  trwnh@mastodon.social
                                  wrote last edited by
                                  #58

                                  @jens well, syntactically it’s either a JSON string (meant to be parsed as an id reference) or a JSON hash… or a JSON array containing either of these. (except the naive processor is so naive they probably don’t understand arrays because they expect a single value in all cases.)

                                  semantically, it’s saying “jens created something”, where the object of the sentence “something” can be whatever. you need to dereference “something” to get… 100% arbitrary information about it

                                  jens@social.finkhaeuser.deJ 1 Reply Last reply
                                  0
                                  • trwnh@mastodon.socialT trwnh@mastodon.social

                                    @jens well, syntactically it’s either a JSON string (meant to be parsed as an id reference) or a JSON hash… or a JSON array containing either of these. (except the naive processor is so naive they probably don’t understand arrays because they expect a single value in all cases.)

                                    semantically, it’s saying “jens created something”, where the object of the sentence “something” can be whatever. you need to dereference “something” to get… 100% arbitrary information about it

                                    jens@social.finkhaeuser.deJ This user is from outside of this forum
                                    jens@social.finkhaeuser.deJ This user is from outside of this forum
                                    jens@social.finkhaeuser.de
                                    wrote last edited by
                                    #59

                                    @trwnh Just to distinguish this *a little*, the syntax is JSON, and JSON processors will likely only process the document if it's valid JSON.

                                    Whether the value is an object, array, string or other JSON type is technically still part of the key's semantics, which should be defined.

                                    FWIW, I'm not hung up on whether you count that as part of syntax or semantics. It's basically a layering issue. If you look top down from meaning to bit stream, it seems more like syntax. But if you look bottom...

                                    jens@social.finkhaeuser.deJ 1 Reply Last reply
                                    0
                                    • jens@social.finkhaeuser.deJ jens@social.finkhaeuser.de

                                      @trwnh Just to distinguish this *a little*, the syntax is JSON, and JSON processors will likely only process the document if it's valid JSON.

                                      Whether the value is an object, array, string or other JSON type is technically still part of the key's semantics, which should be defined.

                                      FWIW, I'm not hung up on whether you count that as part of syntax or semantics. It's basically a layering issue. If you look top down from meaning to bit stream, it seems more like syntax. But if you look bottom...

                                      jens@social.finkhaeuser.deJ This user is from outside of this forum
                                      jens@social.finkhaeuser.deJ This user is from outside of this forum
                                      jens@social.finkhaeuser.de
                                      wrote last edited by
                                      #60

                                      @trwnh ... up, once you've turned a bit stream into structured, typed data, it's semantics.

                                      The key thing is how much meaning you assign to the notion of type here. You essentially treat type as "the full, abstract meaning is encapsulated" whereas I treat it as "I can distinguish it in code well enough to keep it apart from other types".

                                      The point being, it should be part of the specifications of the key whether a string, array or object is *valid* here.

                                      It's totally fine to e.g. say it has..

                                      jens@social.finkhaeuser.deJ 1 Reply Last reply
                                      0
                                      • jens@social.finkhaeuser.deJ jens@social.finkhaeuser.de

                                        @trwnh ... up, once you've turned a bit stream into structured, typed data, it's semantics.

                                        The key thing is how much meaning you assign to the notion of type here. You essentially treat type as "the full, abstract meaning is encapsulated" whereas I treat it as "I can distinguish it in code well enough to keep it apart from other types".

                                        The point being, it should be part of the specifications of the key whether a string, array or object is *valid* here.

                                        It's totally fine to e.g. say it has..

                                        jens@social.finkhaeuser.deJ This user is from outside of this forum
                                        jens@social.finkhaeuser.deJ This user is from outside of this forum
                                        jens@social.finkhaeuser.de
                                        wrote last edited by
                                        #61

                                        @trwnh ... to be an object with a "type" field that specifies other valid fields, or an array of such objects, or a JSON reference pointing at such an object or array.

                                        And then I can still write a naive-ish processor that can handle this, or a very naive processor that doesn't care at all about the value.

                                        But I do not have to know all possible type values or what they imply for the value.

                                        This is where you can go and say "well, but if I use LD for those objects, I can reason about stuff...

                                        jens@social.finkhaeuser.deJ 1 Reply Last reply
                                        0
                                        • jens@social.finkhaeuser.deJ jens@social.finkhaeuser.de

                                          @trwnh ... to be an object with a "type" field that specifies other valid fields, or an array of such objects, or a JSON reference pointing at such an object or array.

                                          And then I can still write a naive-ish processor that can handle this, or a very naive processor that doesn't care at all about the value.

                                          But I do not have to know all possible type values or what they imply for the value.

                                          This is where you can go and say "well, but if I use LD for those objects, I can reason about stuff...

                                          jens@social.finkhaeuser.deJ This user is from outside of this forum
                                          jens@social.finkhaeuser.deJ This user is from outside of this forum
                                          jens@social.finkhaeuser.de
                                          wrote last edited by
                                          #62

                                          @trwnh ... without hardcoding knowledge about different types", and that's true.

                                          But that isn't preventing a naive JSON processor from doing sensible things at the parent layer, nor is it preventing a semi-naive JSON processor to do sensible enough things with those objects for which it has some knowledge hardcoded.

                                          Again, it's only when you want to use LD to manipulate the entire document as a knowledge graph that you run into issues.

                                          That isn't really necessary, though. It's why I...

                                          jens@social.finkhaeuser.deJ 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          Powered by NodeBB Contributors
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Popular