5

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

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

如果您查看用于商业的 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 结构添加到现有标记中受到惩罚?

4

2 回答 2

6

那是“片段样式”中的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

于 2010-07-01T20:53:34.480 回答
0

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

于 2013-11-06T13:42:32.830 回答