Skip to content
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

Should @id of parent objects be used as a base IRI for relative IRI references? #447

Open
trwnh opened this issue Nov 18, 2024 · 0 comments

Comments

@trwnh
Copy link

trwnh commented Nov 18, 2024

By my understanding, the way to absolutize a relative IRI reference in JSON-LD is currently something like this:

  • if the JsonLdProcessor has JsonLdOptions.base set, then use that.
  • otherwise, if the active context includes a @base declaration, then use that.
  • otherwise, if the document was fetched from a remote location, then the base IRI can be inferred by the IRI of the request.
    • if the response was HTML, then maybe <base> can be used?
  • otherwise, emit a warning?

However, there is a possibility for objects to be nested or embedded in other objects. Especially in non-flattened form.

I would interpret a document like so:

{
  "@context": [
    "https://www.w3.org/ns/did/v1",
    "https://w3id.org/security/multikey/v1",
    "https://w3id.org/security/suites/secp256k1-2019/v1"
  ],
  "alsoKnownAs": [
    "at://atproto.com"
  ],
  "id": "did:plc:ewvi7nxzyoun6zhxrhs64oiz",
  "service": [
    {
      "id": "#atproto_pds",  // this is a relative reference, right?
      "serviceEndpoint": "https://enoki.us-east.host.bsky.network",
      "type": "AtprotoPersonalDataServer"
    }
  ],
  "verificationMethod": [
    {
      "controller": "did:plc:ewvi7nxzyoun6zhxrhs64oiz",
      "id": "did:plc:ewvi7nxzyoun6zhxrhs64oiz#atproto",
      "publicKeyMultibase": "zQ3shunBKsXixLxKtC5qeSG9E4J5RkGN57im31pcTzbNQnm5w",
      "type": "Multikey"
    }
  ]
}

where it seems like the node with "id": "#atproto_pds" is part of its parent context, the node with "id": "did:plc:ewvi7nxzyoun6zhxrhs64oiz"... which I think represents the document?

So the question is: Should the @id of parent objects be considered in the expansion of relative IRI references? If not, why not? If yes, should we consider only the top-level parent or should we instead consider the most recent absolutized parent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant