bridgy-fed icon indicating copy to clipboard operation
bridgy-fed copied to clipboard

ActivityPub: handle fragments in ids

Open snarfed opened this issue 1 year ago • 2 comments

There's a steady trickle of ActivityPub object ids that have fragments. Fetching/dereferencing fragment ids isn't specified in AP, but best practice seems to be to at least fetch the URI without the fragment and then try to load the fragment as a top-level property in the returned object: https://github.com/w3c/activitypub/issues/367 , https://www.w3.org/wiki/ActivityPub/Primer/Object_identifiers

snarfed avatar Nov 22 '23 18:11 snarfed

Pretty much the whole of the linked data stack revolves around fragids which denote "Things" as opposed to "Documents".

Documents have meta data and headers, such as "created", if you mix that with a fragid, you create an ambiguity as to what was created, e.g. the Actor or the Document.

In some cases it might continue gracefully, in others it would fail catastrophically. For example in Solid, or WebID, or any system where there's more than one item on a page, you could be in trouble.

Better to include fragids as it's the more powerful form. To get the object, simply go to the document and look for a field where the @id is the fragid. This is a nice way of dealing with nested objects, too.

melvincarvalho avatar Nov 22 '23 21:11 melvincarvalho

Thank you! I'm not sure how much any of this applies to the fediverse right now in practice, but it is helpful in general.

snarfed avatar Nov 22 '23 21:11 snarfed