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

New LinkRole type to support HTML attributes when data provided in JSON-LD #1045

Open
vholland opened this Issue Mar 21, 2016 · 20 comments

Comments

Projects
None yet
8 participants
@vholland
Contributor

vholland commented Mar 21, 2016

HTML's has a number of attributes for expressing language and how one URL relates to another. Unfortunately, JSON-LD has no such mechanism, so data in a feed cannot express things like "the endpoint is in Japanese" or "the endpoint is an alternate link".

We have touched on this idea in issue #561. A clearer, more extensible mechanism would be to add LinkRole:

A LinkRole is a Role that represents a Web link e.g. as expressed via the 'url' property. Its linkRelationship property can indicate URL-based and plain textual link types e.g. those in IANA
link registry
or others such as 'amphtml'. This structure provides a placeholder where details from HTML's element can be represented outside of HTML, e.g. in JSON-LD feeds.

Itt would have two properties:

inLanguage: The language of the resource. (This property already exists. We would be extending the domain.)

linkRelationship: Indicates the relationship type of a Web link.

@danbri

This comment has been minimized.

Show comment
Hide comment
@danbri

danbri Mar 21, 2016

Contributor

Thanks @vholland - would you have a full example handy?

Contributor

danbri commented Mar 21, 2016

Thanks @vholland - would you have a full example handy?

@vholland

This comment has been minimized.

Show comment
Hide comment
@vholland

vholland Mar 21, 2016

Contributor

I added these in pull request #1047.

For an EntryPoint which resolves to a resource/application available in multiple languages:

<script type="application/ld+json">                                                                                                                            
{                                                                                                                                                              
  "@context": "http://schema.org/",                                                                                                                            
  "@type": "Restaurant",                                                                                                                                       
  "potentialAction": {                                                                                                                                         
    "@type": "ReserveAction",                                                                                                                                  
    "target": [                                                                                                                                                
      "http://www.example.com/Reserve",                                                                                                                        
      {                                                                                                                                                        
        "@type": "LinkRole",                                                                                                                                   
        "target": "http://www.example.com/Reserve-JP",                                                                                                         
        "inLanguage": "jp",                                                                                                                                    
        "linkRelationship": "alternate"                                                                                                                        
      }                                                                                                                                                        
    ]                                                                                                                                                          
  }                                                                                                                                                            
}                                                                                                                                                              
</script>

For an article available in AMP HTML on mobile:

<script type="application/ld+json">                                                                                                                            
{                                                                                                                                                              
  "@context": "http://schema.org/",                                                                                                                            
  "@type": "Article",                                                                                                                                          
  "url": [                                                                                                                                                     
    "http://www.example.com/article",                                                                                                                          
    {                                                                                                                                                          
      "@type": "LinkRole",                                                                                                                                     
      "url": "http://www.example.com/article-amp",                                                                                                             
      "linkRelationship": "amphtml"                                                                                                                            
    }                                                                                                                                                          
  ]                                                                                                                                                            
}                                                                                                                                                              
</script>  
Contributor

vholland commented Mar 21, 2016

I added these in pull request #1047.

For an EntryPoint which resolves to a resource/application available in multiple languages:

<script type="application/ld+json">                                                                                                                            
{                                                                                                                                                              
  "@context": "http://schema.org/",                                                                                                                            
  "@type": "Restaurant",                                                                                                                                       
  "potentialAction": {                                                                                                                                         
    "@type": "ReserveAction",                                                                                                                                  
    "target": [                                                                                                                                                
      "http://www.example.com/Reserve",                                                                                                                        
      {                                                                                                                                                        
        "@type": "LinkRole",                                                                                                                                   
        "target": "http://www.example.com/Reserve-JP",                                                                                                         
        "inLanguage": "jp",                                                                                                                                    
        "linkRelationship": "alternate"                                                                                                                        
      }                                                                                                                                                        
    ]                                                                                                                                                          
  }                                                                                                                                                            
}                                                                                                                                                              
</script>

For an article available in AMP HTML on mobile:

<script type="application/ld+json">                                                                                                                            
{                                                                                                                                                              
  "@context": "http://schema.org/",                                                                                                                            
  "@type": "Article",                                                                                                                                          
  "url": [                                                                                                                                                     
    "http://www.example.com/article",                                                                                                                          
    {                                                                                                                                                          
      "@type": "LinkRole",                                                                                                                                     
      "url": "http://www.example.com/article-amp",                                                                                                             
      "linkRelationship": "amphtml"                                                                                                                            
    }                                                                                                                                                          
  ]                                                                                                                                                            
}                                                                                                                                                              
</script>  
@betehess

This comment has been minimized.

Show comment
Hide comment
@betehess

betehess Mar 21, 2016

Contributor

The solution discussed here seems very ad hoc as there seems to be a more general need to say that links/entities/endpoints are "the same" while being specific to a specific language/country.

A few things I do not understand wrt linkRelationship in the examples:

  • how to we know which Things are in the same link-relationship?
  • what are the kinds of linkRelationship one can use? Can't those be URIs?

Other remarks:

  • in #561, you used inLanguage on a EntryPoint: what was wrong with that approach?
  • in Question on expressing translations of terms , several of us discussed about extending schema:sameAs to things that are not webpages, which I believe that would apply quite well here as well
Contributor

betehess commented Mar 21, 2016

The solution discussed here seems very ad hoc as there seems to be a more general need to say that links/entities/endpoints are "the same" while being specific to a specific language/country.

A few things I do not understand wrt linkRelationship in the examples:

  • how to we know which Things are in the same link-relationship?
  • what are the kinds of linkRelationship one can use? Can't those be URIs?

Other remarks:

  • in #561, you used inLanguage on a EntryPoint: what was wrong with that approach?
  • in Question on expressing translations of terms , several of us discussed about extending schema:sameAs to things that are not webpages, which I believe that would apply quite well here as well
@vholland

This comment has been minimized.

Show comment
Hide comment
@vholland

vholland Mar 22, 2016

Contributor

The kinds of linkRelationships are the same as supported in the "rel" attribute for the HTML tag. I hesitate to enumerate as there is a difference between the HTML5 documentation and how sites are marked up today. For example, "canonical" is supported by most (all?) modern browsers, but is not listed in the W3C docs.

I was going with text because that is what HTML uses. The idea was to use the same string one would use if the document were in HTML.

Initially, I see "alternate" and "amphtml" the most useful.

in #561, you used inLanguage on a EntryPoint: what was wrong with that approach?

We would need to update everything that expects URL to also expect EntryPoint. This seemed less weighty as Roles can already be used anywhere.

in Question on expressing translations of terms , several of us discussed about extending schema:sameAs to things that are not webpages, which I believe that would apply quite well here as well

I don't think I understand. How would that apply?

Contributor

vholland commented Mar 22, 2016

The kinds of linkRelationships are the same as supported in the "rel" attribute for the HTML tag. I hesitate to enumerate as there is a difference between the HTML5 documentation and how sites are marked up today. For example, "canonical" is supported by most (all?) modern browsers, but is not listed in the W3C docs.

I was going with text because that is what HTML uses. The idea was to use the same string one would use if the document were in HTML.

Initially, I see "alternate" and "amphtml" the most useful.

in #561, you used inLanguage on a EntryPoint: what was wrong with that approach?

We would need to update everything that expects URL to also expect EntryPoint. This seemed less weighty as Roles can already be used anywhere.

in Question on expressing translations of terms , several of us discussed about extending schema:sameAs to things that are not webpages, which I believe that would apply quite well here as well

I don't think I understand. How would that apply?

@unor

This comment has been minimized.

Show comment
Hide comment
@unor

unor Mar 22, 2016

Contributor

I hesitate to enumerate as there is a difference between the HTML5 documentation and how sites are marked up today. For example, "canonical" is supported by most (all?) modern browsers, but is not listed in the W3C docs.

In HTML5, only link types defined in the spec or registered in the Microformats wiki (http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions) can be used. On this page in the Microformats wiki, the link types amphtml and canonical are (currently) registered.

So the definition of the linkRelationship property could refer to http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions (if there is value in allowing/expecting the same link types that are allowed in HTML5).

Contributor

unor commented Mar 22, 2016

I hesitate to enumerate as there is a difference between the HTML5 documentation and how sites are marked up today. For example, "canonical" is supported by most (all?) modern browsers, but is not listed in the W3C docs.

In HTML5, only link types defined in the spec or registered in the Microformats wiki (http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions) can be used. On this page in the Microformats wiki, the link types amphtml and canonical are (currently) registered.

So the definition of the linkRelationship property could refer to http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions (if there is value in allowing/expecting the same link types that are allowed in HTML5).

@vholland

This comment has been minimized.

Show comment
Hide comment
@vholland

vholland Mar 22, 2016

Contributor

So the definition of the linkRelationship property could refer to http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions (if there is value in allowing/expecting the same link types that are allowed in HTML5).

That makes sense. My point was that schema.org should not be defining these terms.

Contributor

vholland commented Mar 22, 2016

So the definition of the linkRelationship property could refer to http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions (if there is value in allowing/expecting the same link types that are allowed in HTML5).

That makes sense. My point was that schema.org should not be defining these terms.

@vholland

This comment has been minimized.

Show comment
Hide comment
@vholland

vholland Mar 25, 2016

Contributor

Thinking about this more, the AMP example would probably look like:

<script type="application/ld+json">                                                                                                                            
{                                                                                                                                                              
  "@context": "http://schema.org/",                                                                                                                            
  "@type": "Article",                                                                                                                                          
  "url": [                                                                                                                                                     
    {
      "@type": "LinkRole",
      "url": "http://www.example.com/article",
      "linkRelationship": "canonical"
    },                                                                                                                         
    {                                                                                                                                                          
      "@type": "LinkRole",                                                                                                                                     
      "url": "http://www.example.com/article-amp",                                                                                                             
      "linkRelationship": "amphtml"                                                                                                                            
    }                                                                                                                                                          
  ]                                                                                                                                                            
}                                                                                                                                                              
</script>
Contributor

vholland commented Mar 25, 2016

Thinking about this more, the AMP example would probably look like:

<script type="application/ld+json">                                                                                                                            
{                                                                                                                                                              
  "@context": "http://schema.org/",                                                                                                                            
  "@type": "Article",                                                                                                                                          
  "url": [                                                                                                                                                     
    {
      "@type": "LinkRole",
      "url": "http://www.example.com/article",
      "linkRelationship": "canonical"
    },                                                                                                                         
    {                                                                                                                                                          
      "@type": "LinkRole",                                                                                                                                     
      "url": "http://www.example.com/article-amp",                                                                                                             
      "linkRelationship": "amphtml"                                                                                                                            
    }                                                                                                                                                          
  ]                                                                                                                                                            
}                                                                                                                                                              
</script>
@danbri

This comment has been minimized.

Show comment
Hide comment
@danbri

danbri Apr 19, 2016

Contributor

I've taken the current proposal manually from @vholland 's pull request and added it to the development version of the pending extension for review:

http://pending.webschemas.org/LinkRole

Contributor

danbri commented Apr 19, 2016

I've taken the current proposal manually from @vholland 's pull request and added it to the development version of the pending extension for review:

http://pending.webschemas.org/LinkRole

@danbri

This comment has been minimized.

Show comment
Hide comment
@danbri

danbri Aug 10, 2016

Contributor

@vholland should we retract/retire this?

Contributor

danbri commented Aug 10, 2016

@vholland should we retract/retire this?

@vholland

This comment has been minimized.

Show comment
Hide comment
@vholland

vholland Aug 10, 2016

Contributor

Yes. I'll rethink and open a new issue when I can make a better case.

Contributor

vholland commented Aug 10, 2016

Yes. I'll rethink and open a new issue when I can make a better case.

@vholland vholland closed this Aug 10, 2016

@danbri

This comment has been minimized.

Show comment
Hide comment
@danbri

danbri Aug 10, 2016

Contributor

Thanks. This leaves us with an interesting howwework meta issue: what do we do with retracted proposals, can we delete them from pending? My inclination is that we should be able to do so, but we can also park things there indefinitely if they've seen some level of usage...

Contributor

danbri commented Aug 10, 2016

Thanks. This leaves us with an interesting howwework meta issue: what do we do with retracted proposals, can we delete them from pending? My inclination is that we should be able to do so, but we can also park things there indefinitely if they've seen some level of usage...

@vholland

This comment has been minimized.

Show comment
Hide comment
@vholland

vholland Aug 10, 2016

Contributor

I think we can delete them. Otherwise, we will accrue abandoned proposals and it will be unclear which are active and which are not.

Contributor

vholland commented Aug 10, 2016

I think we can delete them. Otherwise, we will accrue abandoned proposals and it will be unclear which are active and which are not.

@RichardWallis

This comment has been minimized.

Show comment
Hide comment
@RichardWallis

RichardWallis Aug 11, 2016

Contributor

+1 for deleting them

Contributor

RichardWallis commented Aug 11, 2016

+1 for deleting them

@danbri

This comment has been minimized.

Show comment
Hide comment
@danbri

danbri Aug 11, 2016

Contributor

That works for me. We could always keep an 'attic' of things that were in pending somehow. The raw materials are all preserved in this repository, at least. The list of closed issues tagged "pending.schema.org" is a reasonable path in, no need to code something dedicated.

Contributor

danbri commented Aug 11, 2016

That works for me. We could always keep an 'attic' of things that were in pending somehow. The raw materials are all preserved in this repository, at least. The list of closed issues tagged "pending.schema.org" is a reasonable path in, no need to code something dedicated.

@danbri

This comment has been minimized.

Show comment
Hide comment
@danbri

danbri Jan 31, 2018

Contributor

We did implement an Attic section to document terms that "didn't make it", e.g. after being tested via Pending. There are also various superseded terms that could be hidden there. Should LinkRole go into the Attic?

Contributor

danbri commented Jan 31, 2018

We did implement an Attic section to document terms that "didn't make it", e.g. after being tested via Pending. There are also various superseded terms that could be hidden there. Should LinkRole go into the Attic?

@danbri danbri reopened this Jan 31, 2018

@danbri

This comment has been minimized.

Show comment
Hide comment
@danbri

danbri Mar 5, 2018

Contributor

Ok, hearing no objections, I will move http://schema.org/LinkRole from "pending" to "attic" section, whose intent is to hide-but-not-delete the documentation of ideas that didn't work out.

Contributor

danbri commented Mar 5, 2018

Ok, hearing no objections, I will move http://schema.org/LinkRole from "pending" to "attic" section, whose intent is to hide-but-not-delete the documentation of ideas that didn't work out.

@danbri

This comment has been minimized.

Show comment
Hide comment
@danbri

danbri Jul 11, 2018

Contributor

Last call! @TzviyaSiegman

Contributor

danbri commented Jul 11, 2018

Last call! @TzviyaSiegman

@TzviyaSiegman

This comment has been minimized.

Show comment
Hide comment
@TzviyaSiegman

TzviyaSiegman Jul 11, 2018

The Publishing Working Group is interested in using this in the manifest for Web Publications. See https://w3c.github.io/wpub/#publication-link-def cc/@iherman @mattgarrish

TzviyaSiegman commented Jul 11, 2018

The Publishing Working Group is interested in using this in the manifest for Web Publications. See https://w3c.github.io/wpub/#publication-link-def cc/@iherman @mattgarrish

@mattgarrish

This comment has been minimized.

Show comment
Hide comment
@mattgarrish

mattgarrish Jul 11, 2018

Yes, without being able to express relationships we'll have to introduce something of our own making, as we've done in the interim in the draft. Definitely not the way we want to go, though.

mattgarrish commented Jul 11, 2018

Yes, without being able to express relationships we'll have to introduce something of our own making, as we've done in the interim in the draft. Definitely not the way we want to go, though.

@iherman

This comment has been minimized.

Show comment
Hide comment
@iherman

iherman Jul 15, 2018

What @mattgarrish said. LinkRole would fit our use case perfectly well, although there is an open issue filed elsewhere (#1959) that should also be resolved if this class is kept. It would be a pity if the publishing community was required to introduce its own type for something like this.

iherman commented Jul 15, 2018

What @mattgarrish said. LinkRole would fit our use case perfectly well, although there is an open issue filed elsewhere (#1959) that should also be resolved if this class is kept. It would be a pity if the publishing community was required to introduce its own type for something like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment