如何指定 Schema.org 中的相似项目?

How to specify similar items in Schema.org?

假设我有 placebusiness ( itemType = LocalBusiness ) 并想在页面中列出其相似项目 (businesses)。

我想要这样的东西:

<div itemscope itemType="https://schema.org/LocalBusiness">
    <div itemprop="name">Biz Name</div>
    <meta itemprop="image" content="image url" />
    <div itemprop="description">Description</div>
    .
    .
    .
</div>


<!--What should be the itemType of #other-similar-businesses to tell search engines these are Similar Items-->
<div id="other-similar-businesses" itemscope itemType="?" itemprop="?">
    <div itemscope itemType="https://schema.org/LocalBusiness">
        <div itemprop="name">Biz Name</div>
        <meta itemprop="image" content="image url"/>
        <div itemprop="description">Description</div>
        .
        .
        .
    </div>
    <div itemscope itemType="https://schema.org/LocalBusiness">
        <div itemprop="name">Biz Name</div>
        <meta itemprop="image" content="image url"/>
        <div itemprop="description">Description</div>
        .
        .
        .
    </div>
</div>

有一个sameAs属性。 According to schema.org :

URL of a reference Web page that unambiguously indicates the item's identity. E.g. the URL of the item's Wikipedia page, Freebase page, or official website.

但是不知道适不适合这种情况。

我应该使用哪种类型(以及 属性 如果可用)?

Schema.org 没有提供一般性的 属性 来表示事物 A 与事物 B[= 相似51=]。 (最接近的 属性 可能是 relatedLink, but this can only be used on WebPage 项。)
可能是因为那将是一种相当无用的关系,因为事物可能在许多不同方面相似。相反,Schema.org 倾向于定义更具体的关系,例如,如果这些地点位于另一个地方(例如,在同一个城市),则 containedInPlace/containsPlace

但我认为您的问题可以用不同的方式解决。如果我正确理解你的情况,你有一个关于单个(例如)Restaurant 项目的页面,并且在该页面上你还 link 到关于(不知何故 related/similar)Restaurant 项。消费者应该明白,一个是该页面所涉及的餐厅,另一个是有自己的页面。

mainEntity/mainEntityOfPage 主要餐厅

那你就可以利用mainEntity (if you have a WebPage item) or the inverse mainEntityOfPage ()。这使您可以传达许多 Restaurant 项中的哪一项是主要项,即页面是关于:

<body itemscope itemtype="http://schema.org/ItemPage">

  <main>

    <article itemprop="mainEntity" itemscope itemtype="http://schema.org/Restaurant">
      <!-- primary restaurant -->
    </article>

  </main>

  <aside>

    <article itemscope itemtype="http://schema.org/Restaurant">
      <!-- secondary restaurant -->
    </article>

    <article itemscope itemtype="http://schema.org/Restaurant">
      <!-- secondary restaurant -->
    </article>

  </aside>

</body>

这不改变二级餐厅是顶级项目,但这应该不是问题。拥有多个顶级项目并没有什么不好;它通常无法避免,因为没有适合所有情况的属性。

如果您绝对不想这样做,hasPart 属性 可用于所有 Restaurant 项目。我不喜欢这样,因为我不认为二级餐厅真的是页面的一部分,但严格来说,它们是(即以预告片的形式)。

relatedLink links 到二级餐厅

如果您不需要该页面上二级餐厅的结构化数据,您当然可以通过使用已经提到的 relatedLink 属性 简单地 link 给他们:

<body itemscope itemtype="http://schema.org/ItemPage">

  <main>

    <article itemprop="mainEntity" itemscope itemtype="http://schema.org/Restaurant">
      <!-- primary restaurant -->
    </article>

  </main>

  <aside>

    <ul>
      <li><a itemprop="relatedLink" href="/r2">Restaurant 2</a></li>
      <li><a itemprop="relatedLink" href="/r3">Restaurant 3</a></li>
    </ul>

  </aside>

</body>