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

url is defined as @type: @id in the context document which precludes use of xsd:anyURI values #596

Open
trwnh opened this issue Apr 29, 2024 · 5 comments
Labels
Needs primer page Need to add a page at https://www.w3.org/wiki/Activity_Streams/Primer on this topic Next version Things that should probably be resolved in a next version of AS2

Comments

@trwnh
Copy link

trwnh commented Apr 29, 2024

w3c/activitypub#375 (comment)

The AS2-Vocab normative spec defines url as Link | xsd:anyUri

The AS2 context document defines url as @type: @id which disallows use of values (so no @type: @value)

Conclusions:

  • Maybe define urlValue as a term with @type: xsd:anyURI
  • Provide guidance for producers that url must always point to a Link node, and thus when referred to by @id alone after compaction, should respond with a Link node if content negotiation is used
@nightpool
Copy link
Collaborator

nightpool commented Apr 29, 2024 via email

@trwnh
Copy link
Author

trwnh commented Apr 29, 2024

@nightpool this actually simplifies things for consumers, in that they no longer have to deal with the question of "wait, is this just a uri or can i fetch it and get more info about the Link?” if producers are doing the right thing, the answer should always be "yes, you can fetch more info, it is always a Link". consumers now only have to deal with handling the "embedded or not" issue. i'd actually go further and say that producers should consider making Links always be embedded

@steve-bate
Copy link

Has this caused a problem for any implementor ever?

This does cause problems in some contexts, especially for linked-data consumers, but even for JSON-only consumers (long discussion in #498, which you participated in back in 2018).

Like @trwnh said, when a developer sees a non-embedded url property, there's no way to know if it's a Link reference or something else (an image, HTML page, etc.) without dereferencing it and determining the content type.

(Warning: potentially obscure linked data discussion follows...)

The Link | xsd:anyUri range is ambiguous and contradictory. It can't be represented in the OWL ontology, for example, since it declares the property to be both an object property and a data property (union of the types).

It's difficult to make sense of it, but the Link subset refers to either a Link URI (which looks like an xsd:anyUri value) or a blank node identifier (an embedded object with no identifier in the JSON-LD serialization). The xsd:anyUri range subset refers to a data value with a URI syntax. In JSON-LD, "any URI" will have the same form as a Link URI so there's an ambiguity.

@trwnh trwnh changed the title url is defined as @type: @id in the contdxt document which precludes use of xsd:anyUri values url is defined as @type: @id in the context document which precludes use of xsd:anyUri values Apr 30, 2024
@evanp
Copy link
Collaborator

evanp commented May 1, 2024

So we have a problem here, in that the text is canonical, but the specification is not realisable in JSON-LD. Unfortunately, we do have examples in the text using both Link and bare URLs. It's pretty clear that the intention is to use both, not just Link.

We think that a bare URL will work here, but the implication is that it is the URL for a Link object, which is rarely the case. The primer page on URLs as values gives some guidance, but it would be great to have a clearer path here. Definitely something to consider in the next version.

@evanp evanp added Needs primer page Need to add a page at https://www.w3.org/wiki/Activity_Streams/Primer on this topic Next version Things that should probably be resolved in a next version of AS2 labels May 1, 2024
@evanp
Copy link
Collaborator

evanp commented May 1, 2024

One thing that's important to recognize is that @trwnh is recommending that even when an URL looks like an URL for a binary representation, like an image, it should still return Activity Streams 2.0 Link object when fetched with Accept: application/activity+json (or other JSON types).

{
    "@context": "https://www.w3.org/ns/activitystreams",
    "type": "Link",
    "id": "https://example.com/uploads/file123.png",
    "href": "https://example.com/uploads/file123.png",
    "mediaType": "image/png",
    "name": "The numbers 1, 2, and 3"
}

I think this is a nice solution and would be good to add to the Primer page.

@trwnh trwnh changed the title url is defined as @type: @id in the context document which precludes use of xsd:anyUri values url is defined as @type: @id in the context document which precludes use of xsd:anyURI values May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs primer page Need to add a page at https://www.w3.org/wiki/Activity_Streams/Primer on this topic Next version Things that should probably be resolved in a next version of AS2
Projects
None yet
Development

No branches or pull requests

4 participants