尝试在语义上标记有关特定地址的报告页面。该页面提供有关地址能源消耗的报告,并提供与能源消耗相关的服务优惠。我想在语义上表示该地点的地址、与该地址相关的能源报告以及该地址可用的优惠。现在,我的标记有一个用于地点的 RDFa lite 节点和另一个用于报价的节点。构建此结构以在这些事物(例如能源报告和该地点的相关报价)之间建立关系的最佳方法是什么?
<!DOCTYPE html>
<html version="HTML+RDFa 1.1" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Energy Report For 1 main st, townville, ca</title>
</head>
<body>
<div xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:gr="http://purl.org/goodrelations/v1#"
xmlns:pto="http://www.productontology.org/id/"
xmlns:foo="http://example.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<div vocab="http://schema.org/" typeof="Place" additionaltype="Offer" resource="#energyreport">
<h1 property="name">Energy Assessment for <div property="address" resource="#address" typeof="PostalAddress">
<span property="streetAddress">1 main st.
</span> <span property="addressLocality">townville</span>,
<span property="addressRegion">ca</span></div></h1>
<span property="description">Energy Potential for 1 main st., townville, ca. Explore installation offers. Find the best choice for your home.
</span>
</div>
<div vocab="http://schema.org/" resource="#offer" typeof="Offer">
<!-- The offer to sell it -->
<div about="#offer" >
<div property="name">Energy Offerings</div>
<div rel="gr:hasBusinessFunction" resource="http://purl.org/goodrelations/v1#Sell"></div>
<div rel="gr:includes">
<!-- The object -->
<div about="#myObject" typeof="http://www.productontology.org/id/Energy">
<div rel="rdf:type" resource="http://purl.org/goodrelations/v1#SomeItems"></div>
<div property="gr:description" xml:lang="en">Offer Details For Premium Lease Option</div>
<div property="gr:name" xml:lang="en">Premium Lease</div>
</div>
</div>
<div rel="foaf:page" resource="http://URI_of_the_page_containing_the_offer"></div>
<div rel="gr:hasPriceSpecification">
<div typeof="gr:UnitPriceSpecification">
<span property="gr:hasCurrency" content="USD" datatype="xsd:string">$</span>
<span property="gr:hasCurrencyValue" datatype="xsd:float">2.5</span>
</div>
</div>
</div>
</div>
</div>
</body>
<div vocab="http://schema.org/" typeof="Place" additionaltype="Offer" resource="#energyreport">
首先,additionaltype
属性在 HTML 中无效,不应使用。使用 RDFa,您可以安全地将多种类型放入typeof
属性,像这样:typeof="Place Offer"
.
为了补充约书亚所说的(这很棒),如果你不想添加可见链接,你也可以使用不可见链接<link>
元素:
<link property="offer" href="#offer" />
另一个检查你的 RDFa 的方法是RDFa / 播放 http://rdfa.info/play/。更多工具可从RDFa.info 的工具 http://rdfa.info/tools/.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)