【问题标题】:RDFa content implementation for products产品的 RDFa 内容实现
【发布时间】:2011-03-10 18:19:28
【问题描述】:

我深陷于产品信息的 RDFa 实施的噩梦中,我很好奇是否有人可以提供一些见解。

Google 明确表示不会仅仅为了向机器提供数据而隐藏信息,除非它是特定于机器的信息。但是,为了提供这些数据,我找不到任何关于包含空元素的信息。

如果您查看用于商业的 GoodRelations RDFa 生成器,您会看到一堆嵌套的 div,它们被告知要放在商品页面的底部。例如,我将使用我最喜欢的网站之一:

<div xmlns="http://www.w3.org/1999/xhtml"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
  xmlns:gr="http://purl.org/goodrelations/v1#"
  xmlns:foaf="http://xmlns.com/foaf/0.1/">

  <div typeof="gr:Offering" about="#offering">
    <div rev="gr:offers" resource="#company"></div>
    <div property="rdfs:label" content="Alpinestars S-MX Plus Racing Boots" xml:lang="en"></div>
    <div property="rdfs:comment" content="Alpinestars’ S-MX Plus racing boot raises performance and safety to new and unmatched levels with its innovative design, structural protection and comfort." xml:lang="en"></div>
    <div property="gr:hasEAN_UCC-13" content="0000000000000" datatype="xsd:string"></div>
    <div rel="foaf:depiction" resource="http://www.motorcycle-superstore.com/ProductImages/300/g17268.jpg"></div>
    <div rel="gr:hasBusinessFunction" resource="http://purl.org/goodrelations/v1#Sell"></div>
    <div rel="gr:hasPriceSpecification">
      <div typeof="gr:UnitPriceSpecification">
        <div property="gr:hasCurrency" content="USD" datatype="xsd:string"></div>
        <div property="gr:hasCurrencyValue" content="349.95" datatype="xsd:float"></div>
        <div property="gr:hasUnitOfMeasurement" content="C62" datatype="xsd:string"></div>
      </div>
    </div>
    <div rel="gr:acceptedPaymentMethods" resource="http://purl.org/goodrelations/v1#PayPal"></div>
    <div rel="gr:acceptedPaymentMethods" resource="http://purl.org/goodrelations/v1#AmericanExpress"></div>
    <div rel="gr:acceptedPaymentMethods" resource="http://purl.org/goodrelations/v1#Discover"></div>
    <div rel="gr:acceptedPaymentMethods" resource="http://purl.org/goodrelations/v1#MasterCard"></div>
    <div rel="gr:acceptedPaymentMethods" resource="http://purl.org/goodrelations/v1#VISA"></div>
    <div rel="foaf:page" resource="http://www.motorcycle-superstore.com/1/1/36/77/ITEM/Alpinestars-S-MX-Plus-Racing-Boots.aspx"></div>
  </div>
</div>

我在他们的实现中发现有趣的地方——百思买已经非常成功地使用了——这里的标签中没有实际的内容,而只有一个内容属性。

然后我的问题是,是否有人对这种类型的实现有任何见解,以及使用利用内容属性的空 div 结构是否会比将 RDFa 结构添加到现有标记中受到惩罚?

【问题讨论】:

    标签: xml rdf xml-namespaces rdfa


    【解决方案1】:

    即“sn-p 样式”中的 RDFa。完整的论点和背景在这里

    http://www.ebusiness-unibw.org/tools/rdf2rdfa/

    这里:

    赫普,马丁;加西亚,罗伯托; Radinger, Andreas: RDF2RDFa: Turning RDF into Snippets for Copy-and-Paste, Technical Report TR-2009-01, 2009。 PDF 在上面页面的底部。

    基本上,在 a) 为数据标记重用可见内容和 b) 关注点分离之间存在权衡。只要可见内容的数据结构和标记组织几乎 1:1 匹配,您就可以轻松地使用传统风格的 RDFa。但是,在丰富的元数据建模中强制执行可见标记的结构会导致标记混乱、难以维护、容易出错。

    最好的祝福

    马丁·赫普

    补充:您可以在 XHTML、HTML5 和 HTML4 模板中使用 RDFa 中的 GoodRelations,尽管各个 DOCTYPE 的标准化状态不同。以下是正确的 DOCTYPE 设置:

    1. XHTML: a) 将 DOCTYPE 设置为 XHTML+RDFa 1.0: b) 设置 html 版本属性为 XHTML+RDFa1.0

    2. HTML5 a) 将 DOCTYPE 设置为 html b) 设置html版本属性为HTML+RDFa1.1

    请注意,这只是现阶段的 W3C 工作草案,但仍然可以使用。

    1. 其他 HTML 标记 使用 HTML5 配方或简单地将 html 版本属性设置为 HTML+RDFa1.1 或 XHTML+RDFa1.0。大多数客户端将从这种类型中提取 RDF。 要么

    另请参阅: http://answers.semanticweb.com/questions/1187/can-i-use-the-html5-doctype-with-rdfa

    【讨论】:

    • 谢谢 Martin,我的下一个问题是:如果我们使用 HTML5,我们如何告诉 Google 在我们的页面上查找 RDFa 标记?
    【解决方案2】:

    对于 HTML5,您应该简单地使用 RDFa 1.1RDFa Lite,它们在 HTML5 中有效。例如,您必须将 xmlns: 转换为使用前缀属性。

    【讨论】:

      猜你喜欢
      • 2023-04-01
      • 2023-03-24
      • 1970-01-01
      • 2021-10-28
      • 1970-01-01
      • 1970-01-01
      • 2011-04-19
      • 2021-10-30
      • 2016-01-23
      相关资源
      最近更新 更多