问题描述
试图在语义上标记有关特定地址的报告页面.该页面提供有关地址能耗的报告,并提供与能耗有关的服务的报价.我想在语义上表示该地点的地址,与该地址有关的能源报告以及该地址可用的报价.现在,我有一个标记,其中有一个RDFa lite节点用于放置,另一个节点用于商品.构造此关系以在这些事物之间建立关系的最佳方法是什么,例如,该地点的能源报告和相关报价?
trying to semantically mark up a report page about specific addresses. The page provides a report about the address's energy consumption and presents offers for a service related to the energy consumption. I would like to semantically represent the place's address, the energy report related to the address, and offers that are available to the address. Right now, I have markup that has an RDFa lite node for place and another node for the offers. What is the best way to structure this to establish a relationship between these things, e.g., energy report and related offers for this place?
<!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"
.
First of all, the additionaltype
attribute is not valid in HTML and should not be used. With RDFa, you can safely put multiple types in the typeof
attribute, like this: typeof="Place Offer"
.
要补充约书亚所说的话(很棒),如果您不想添加可见链接,也可以使用不可见的<link>
元素:
To complement what Joshua said (which is great), if you don't want to add a visible link, you can also use an invisible <link>
element:
<link property="offer" href="#offer" />
另一个检查您的RDFa的是 RDFa/播放.可从 RDFa.info的工具中获得更多工具.
Another to check your RDFa is RDFa / Play. More tools are available from RDFa.info's Tools.
这篇关于如何建立rdfa lite节点之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!