如何使用 schema.org 将一个人(无需重复我自己)标记为组织成员和书籍作者?

Mat*_*t R 5 html microdata schema.org

我正在尝试将 schema.org 标记添加到律师事务所的网站 (itemtype=schema.org/Attorney)。该网站包含专门针对该公司每位律师的页面 (itemtype=schema.org/Person)。这些个人资料页面包括已发表作品的列表(例如 itemtype=schema.org/Book)。我想指出的是,此人是该组织的成员,也是书籍的作者。我正在努力实现这一目标。

这是我正在使用的一些代码:

<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>
Run Code Online (Sandbox Code Playgroud)

在浏览器中查看https://dl.dropboxusercontent.com/u/292741/schema-test-book-stackoverflow.html

当使用 Google 的结构化数据工具 (google.com/webmasters/tools/richsnippets) 或 Yandex (webmaster.yandex.com/microtest.xml) 对此进行测试时,我没有得到我想要的结果。在这种情况下,成员和作者属性未注册。

我尝试了多种变体。以下是一些重要的内容:

如果我将 itemscope 和 itemtype=Person 放在成员和作者属性元标记上,则属性会注册,但工具认为我正在谈论三个不同的人(就好像 itemref 没有注册一样)。

如果我将成员和作者属性放在 #profile 上,它们就可以工作,但我会收到错误,因为组织没有作者,书籍也没有成员。

这两者的结合只取得了部分成功。因此,将 just 成员属性放在 #profile 上并通过元标记进行作者操作,要么会导致作者属性被忽略(当我没有给它自己的范围和类型=人时),要么它适用于与该人无关的某个随机人。一个由 #profile 定义的(当我给它它的工作范围等时)。

我还尝试使用 schema.org/WriteAction 作为确定书与人之间关系的另一种方式,但我在那里遇到了同样的问题。我可以让组织->成员或写入操作->代理工作,但不能同时工作。

这是我得到的结构(如 Google 工具所示):

  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
Run Code Online (Sandbox Code Playgroud)

我想要的结构(如谷歌工具所代表的)是这样的:

  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
Run Code Online (Sandbox Code Playgroud)

我真的很感激任何建议。谢谢!

uno*_*nor 4

更新(2016)

\n\n

多类型实体的使用似乎在 Microdata 中迎头赶上,因此在 Schema.org 中使用未为所有指定类型定义的属性(如下面我的旧答案中所述)可能没问题。

\n\n

无论如何,对标识符的支持(在 Microdata 中: with itemid)现在似乎更好了(至少在 Google\xe2\x80\x99s 测试工具中支持 it\xe2\x80\x99s ),这可能是适合您情况的解决方案:

\n\n
    \n
  • 给这个人一个 URIitemid
  • \n
  • 引用此 URI 作为author和 的值member
  • \n
\n\n

例子:

\n\n
<div itemscope itemtype="http://schema.org/Person" itemid="/team/alice#i">\n</div>\n\n<div itemscope itemtype="http://schema.org/LegalService">\n  <link itemprop="member" href="/team/alice#i" />\n</div>\n\n<div itemscope itemtype="http://schema.org/Book">\n  <link itemprop="author" href="/team/alice#i" />\n</div>\n
Run Code Online (Sandbox Code Playgroud)\n\n

请注意,该Attorney类型现已弃用,因此我LegalService在本示例中使用了该类型。

\n\n
\n\n

旧答案(2014)

\n\n

(请注意,您的使用itemref不正确,因为它只能用于带有 的元素itemscope。)

\n\n

这对于微数据来说是不可能的。

\n\n

这将导致使用对其父项无效的属性(无论是通过嵌套还是通过itemref)itemtype:

\n\n

itemref您可以\xe2\x80\x99t 通过律师和书籍引用人员,因为这需要在人员上使用itemprop="author member"(这是有效的语法),但author不是律师的有效属性,也不member是Book 的有效属性。

\n\n

如果您\xe2\x80\x98d 将 Person 嵌套在 Book 下并用于itemref引用来自律师的同一个人,也会出现同样的问题。或相反亦然。

\n\n

所以我能看到的唯一方法就是复制信息,这很遗憾。

\n