Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use schema.org to label a person (without repeating myself) as both a member of an organization and the author of a book?

I'm trying to add schema.org markup to a site for a law firm (itemtype=schema.org/Attorney). That site contains a page dedicated to each lawyer in the firm (itemtype=schema.org/Person). Those profile pages include a list of published works (e.g. itemtype=schema.org/Book). I would like to specify that the person is a member of the organization and the author of the books. I'm struggling to accomplish that.

Here's some code I'm working with:

<body itemscope itemtype="http://schema.org/Attorney">
    <!-- this stuff just so the Yandex validator doesn't freak out -->
    <meta itemprop="name" content="some law firm">
    <meta itemprop="address" content="some address">
    <meta itemprop="telephone" content="555-555-5555">
    <h1>Book Test</h1>
    <div id="profile" itemscope itemtype="http://schema.org/Person">
        <h1 itemprop="name">John Smith</h1>
        <h3>Published Works</h3>
        <ul>
            <li itemscope itemtype="http://schema.org/Book"><span itemprop="name">Some Book</span><meta itemprop="author" itemref="profile"></li>
        </ul>
    </div>
    <meta itemprop="member" itemref="profile">
</body>

Check it out in browser at https://dl.dropboxusercontent.com/u/292741/schema-test-book-stackoverflow.html

When testing this with Google's structured data tool (google.com/webmasters/tools/richsnippets) or Yandex (webmaster.yandex.com/microtest.xml), I'm not getting the results I want. In this case, the member and author properties aren't registering.

I've tried a number of variations. Here are a few of the important ones:

If I put an itemscope and itemtype=Person on both the member and author property meta tags, then the properties register, but the tools think I'm talking about three different people (as though the itemref isn't registering).

If I put the member and author properties on #profile, they work, but I get errors because organizations don't have authors and books don't have members.

Combinations of those two are only partially successful. So putting the just member property on #profile and doing author through a meta tag either causes the author property to be ignored (when I don't give it its own scope and type=Person) or it applies to some random person unassociated with the one defined by #profile (when I do give it its ow scope, etc.).

I've also tried playing with schema.org/WriteAction as another way to who the relationship between the book and the person, but I run into the same problems there. I can either get organization->member or writeaction->agent to work, not both.

This is the structure I'm getting (as represented by Google's tool):

  Item 
    type:   schema.org/attorney
    property:   
      name:   some law firm
      address:  some address
      telephone:  555-555-5555
      member:

  Item 
    type:   schema.org/book
    property:   
      name:   Some Book
      author:

  Item
    type:   schema.org/person
    property:   
      name:   John Smith

My desired structure (as represented by Google's tool) is something like this:

  Item 
    type:   schema.org/attorney
    property:   
      name:   some law firm
      address:  some address
      telephone:  555-555-5555
      member: Item 1 <-- now references the person

  Item 
    type:   schema.org/book
    property:   
      name:   Some Book
      author: Item 1 <-- now references the person

  Item 1
    type:   schema.org/person
    property:   
      name:   John Smith

I'd really appreciate any advice. Thanks!

like image 226
Matt R Avatar asked Oct 02 '22 19:10

Matt R


1 Answers

Update (2016)

The use of multi-type entities seems to catch up in Microdata, so using properties not defined for all of the specified types (as described in my old answer below) might be fine in Schema.org.

Anyway, the support for identifiers (in Microdata: with itemid) seems to be better now (at least it’s supported in Google’s testing tool), and this might be an appropriate solution for your case:

  • give the person a URI in itemid
  • reference this URI as value for author and for member

Example:

<div itemscope itemtype="http://schema.org/Person" itemid="/team/alice#i">
</div>

<div itemscope itemtype="http://schema.org/LegalService">
  <link itemprop="member" href="/team/alice#i" />
</div>

<div itemscope itemtype="http://schema.org/Book">
  <link itemprop="author" href="/team/alice#i" />
</div>

Note that the Attorney type is deprecated now, so I used LegalService in this example.


Old answer (2014)

(Note that your use of itemref is not correct, because it can only be used on elements with itemscope.)

This is not possible with Microdata.

It would lead to the use of properties that are not valid for their parent (whether via nesting or via itemref) itemtype:

You can’t reference the Person via itemref for both, the Attorney and the Book, because that would require to use itemprop="author member" (which is valid syntax-wise) on Person, but author is not a valid property for Attorney and member is not a valid property for Book.

Same problem if you‘d nest Person under Book and use itemref to reference this same Person from Attorney. Or vice-versa.

So the only way I can see is duplicating the information, which is a pity.

like image 189
unor Avatar answered Oct 05 '22 11:10

unor