8000 Remove rel from as:Link by jasnell · Pull Request #100 · w3c/activitystreams · GitHub
[go: up one dir, main page]

Skip to content

Conversation

jasnell
Copy link
Collaborator
@jasnell jasnell commented Apr 21, 2015

Per the recent discussions about as:Link, I propose removing
the rel property from as:Link. It's been pointed out that there
are modeling issues in terms of how the rel property semantically
relates to the property name. This simplifies things by eliminating
the potential conflict.

jasnell added 2 commits April 21, 2015 08:41
Per the recent discussions about as:Link, I propose removing
the `rel` property from as:Link. It's been pointed out that there
are modeling issues in terms of how the rel property semantically
relates to the property name. This simplifies things by eliminating
the potential conflict.
@elf-pavlik
Copy link
Member

@bblfish
Copy link
bblfish commented Apr 21, 2015

So that goes some of the way but it still keeps the Link object which is no longer needed as explained in
#98 (comment)

To take an example from the spec: currently the Turtle is:

<http://example.org/application/123> a as:Application ;
    as:displayName "My Application" ;
    as:image [   a  as:Link ;      
                 as:href <http://example.org/application/123.png> ;
                 as:mediaType "image/png"
              ] .

Why not instead do the simple thing, namely

<http://example.org/application/123> a as:Application ;
    as:displayName "My Application" ;
    as:image <http://example.org/application/123.png> .

<http://example.org/application/123.png> as:mediaType "image/png" .

@jasnell
Copy link
Collaborator Author
jasnell commented Apr 22, 2015

If that's what you want to do the spec allows it. as:Link is there for publishers who want to describe the relationship separately from the target object. I've shown examples where that is useful. I'm absolutely -1 on removing as:Link.

@akuckartz
Copy link

I am still trying to understand why as:Link is required. But the current issue seems to be resolved.

@bblfish
Copy link
bblfish commented Apr 22, 2015

ok, I see that we are moving in the right direction with the new examples. But it is not quite work right for content negotiated resources. Imagine I am writing a JavaScript client and I want to display an image for an application, but I want my JavaScript to work on all browsers with minimal effort - that is I don't want to keep for each browser a list of types of preferred mime types it supports. So I'd like to just be able to follow the as:image relation and get the URL of the content negotiated resource.

The following is allowed by your current spec and is great for that:

</application/123> a as:Application ;
  as:displayName "My Application" ;
  as:image </application/image> .

Here I can follow the as:image relation and create the following html template <img src="/application/image"> . Great.

Now I suppose the Link type is needed for clients that know a lot more about the browser they are working in and that can choose the specific representation. If as a AS2.0 publisher I want to use the current proposed spec to also cater to those client I'd want to do the following:

</application/image> a as:Link;
   as:href </application/image.png>; 
   as:mediaType "image/png" ;
   as:href </application/image.jpeg> ;
   as:mediaType "image/jpeg" .

But since RDF triples are not ordered that would be equivalent to the following:

</application/image> a as:Link;
   as:href </application/image.png>; 
   as:mediaType "image/jpeg" .

</application/image> a as:Link;
   as:mediaType "image/png" ;
   as:href </application/image.jpeg> ;

What this shows is that there is no way to specify the mime types for the particular representation. This is because in a graph format we have the following.

linkinfoloss

But what we really need is that the mime type be attached to the final representation resource not the content negotiation one. Like this:

linkinfoloss-improved

And indeed RFC 5988 the Web Linking Spec confirms this with the following text:

The "type" parameter, when present, is a hint indicating what the media type of the result of dereferencing the link should be. Note that this is only a hint; for example, it does not override the Content-Type header of a HTTP response obtained by actually following the link. There MUST NOT be more than one type parameter in a link-value.

@bblfish
Copy link
bblfish commented Apr 22, 2015

Note that all of that makes more sense when one removes the legacy ontology elements that try to mimic the atom <link ...> element. Here I replace the href with an iana:alternate relation, and remove the link class. Doing this allows us to do the same as above, but it is clearer, simpler, and works nicely with content negotiation

linkinfoloss-improved2

One should be careful when modelling things not to get mislead by syntax. It makes modelling a lot more complicated, the advantages are short lived - syntax fashions change - and it makes the whole code more complex.

@jasnell
Copy link
Collaborator Author
jasnell commented Apr 22, 2015

​That's not how it currently works. One, href and mediaType are defined as functional properties of as:Link. ​Two, it would be more like:

{
  "@id": "http://example.org/application",
  "@type": "Application",
  "image": [
    {
      "@type": "as:Link",
      "mediaType": "image/jpeg",
      "href": "http://example.org/application/image.jpeg"
    },
    {
      "@type": "as:Link",
      "mediaType": "image/png",
      "href": "http://example.org/application/image.png"
    }
  ]
}

​Which translates down to:

​<http://example.org/application> a as:Application ;
  as:image _:b0, _:b1 .

_:b0 a as:Link ;
  as:mediaType "image/jpeg",
  as:href <http://example.org/application/image.jpeg> .

_:b1 a as:Link ;
  as:mediaType "image/png",
  as:href <http://example.org/application/image.png> .

​Which is exactly what one would expect.

@bblfish
Copy link
bblfish commented Apr 22, 2015

One, href and mediaType are defined as functional properties of as:Link.

In which case the problem is: how do you deal with content negotiated resources?

To develop this further: I was trying to get you to consider the case where there is one image with a number of different content negotiated representations - which is what web architecture enables for the sanity of all developers. So if you don't allow that, you don't allow something pretty important for the system we are trying to build, and one that LDP is constantly using. Hence the SWWG issue-14 on "as:Link complexity" which you argued should be closed for lack of details. So I am providing arguments here as to why it is not just complex but does not answer an important need.

Another way to put the question is: does as:image allow its object to be a content negotiated image?
I don't think it can, because you end up with a contradiction. Let's do a reductio ad absurdum, and assume it can be.
Since you allow us to have

<application> as:image _:b0.
_:b0 as:href <image.jpg> .
_:b0 as:mimeType "application/jpeg"   .

then it has to be possible to replace the blank node _:b0 with a URL for a content negotiated image, which we'll call <image>. This would give us:

<application> as:image <image> .
<image> as:href <image.jpg> .
<image> as:mimeType "application/jpeg"   .

Assume the following is true of <image>

linkinfoloss-improved2

Then we have to arbitrarily choose one of the content negotiated representations as the object of your as:href and as:mimeType values. Or to put it as a question: which of the red lines are we meant to choose in the following diagram?

linkinfoloss-reductio

If as:href and as:mimeType are functional relations they cannot point to two different things, and the choice of which representation they point to cannot be arbitrary. So as a consequence you have ended up creating a as:image relation whose domain is a specific representation resource, which won't be correct if anyone points it to a resource that has multiple representations. ( and this is our reductio )

Note that this won't be the case just for the objects of the as:image relation but it will be the case for any thing that can be of type as:Link . This immediately excludes such things as LDPRGs that can be in Turtle, JSON-LD or even micro-formats. So you are oddly making it logically impossible to use this with LDP.

Now as I think there are a number of reasons why you ended up in this conundrum, which I think can be explained in part by the tension you feel between making an ontology and thinking also about how it will look in one of the preferred formats. But we have to do here a job of reverse knowledge engineering to extract the semantics behind the original format of Atom XML, by considering its use, and this type of work can lead to some unexpected conclusions.

But luckily the way you have modelled the atom <link> xml from which it was agreed at the last conf call that Activity Streams is rooted, is not the only way to model it. That is the link element as found in this example taken from RFC 4287

<entry>
       <title>Atom draft-07 snapshot</title>
       <link rel="alternate" type="text/html"
        href="http://example.org/2005/04/02/atom"/>
       <link rel="enclosure" type="audio/mpeg" length="1337"
        href="http://example.org/audio/ph34r_my_podcast.mp3"/>
       <id>tag:example.org,2003:3.2397</id>
       <updated>2005-07-31T12:29:29Z</updated>
       <published>2003-12-13T08:29:29-04:00</published>
...
</entry>

can be modelled differently as I argued in issue #98 "removing the as:Link element. If one considers it carefully I argued there, these are just reifications that we no longer need to use. But I won't repeat here what I wrote there yesterday.

@elf-pavlik
Copy link
Member

@bblfish do you see any issue with as:Collection allowing as:Link instances as its items (usually blank nodes)? I also now notice as:items defined as owl:FunctionalProperty which confuses me. (ignoring for now historical use of plural name for property...)

as:items a owl:ObjectProperty, 
           owl:FunctionalProperty ;  
  rdfs:label "items"@en ;       
  rdfs:domain as:Collection ;
  rdfs:subPropertyOf prov:hadMember ;
  rdfs:range [
    a owl:Class ;
    owl:unionOf (
      [
        a owl:Class ;
        owl:unionOf ( as:Object as:LinkNotHandler )
      ]
      as:OrderedItems
    )
  ] .

as:LinkNotHandler a owl:Class ;
  rdfs:label "Links that are Not Handlers"@en ;
  rdfs:subClassOf as:Link ,
                  [ rdf:type owl:Class ;
                    owl:complementOf as:ActivityHandler
                  ] ;
  rdfs:comment "Represents instances of as:Link that are not also as:ActivityHandler"@en .

http://www.w3.org/TR/activitystreams-vocabulary/#non-normative-ontology-definition

@bblfish
Copy link
bblfish commented Apr 24, 2015

@elf-pavlik that looks like another issue. I opened a link to it here: #104

@jasnell
Copy link
Collaborator Author
jasnell commented Apr 28, 2015

Issue resolved on the call: Maintain current status quo and keep rel

@jasnell jasnell closed this Apr 28, 2015
@jasnell jasnell deleted the remove-link-rel branch October 24, 2015 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0