rdf - 如何在 rdfa lite 节点之间建立关系

标签 rdf semantic-web semantic-markup microdata rdfa

尝试在语义上标记有关特定地址的报告页面。该页面提供有关地址能源消耗的报告,并提供与能源消耗相关的服务。我想在语义上表示该地点的地址、与该地址相关的能源报告以及该地址可用的优惠。现在,我有一个标记,其中有一个 RDFa 精简版节点用于地点,另一个节点用于报价。构建此结构以在这些事物之间建立关系的最佳方式是什么,例如能源报告和该地点的相关报价?

<!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" .

为了补充 Joshua 所说的(这很棒),如果您不想添加可见链接,您也可以使用不可见的 <link>元素:

<link property="offer" href="#offer" />

另一个检查您的 RDFa 的是 RDFa / Play .更多工具可从 RDFa.info's Tools 获得.

关于rdf - 如何在 rdfa lite 节点之间建立关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19386362/

相关文章:

java - 将列表中的值输入 sparql 查询

metadata - LOM - RDF 绑定(bind)

rdf - 在 Protege 中为数据类型属性定义 DataRange 表达式

OWL/RDF 知识和(大多数数字)事实正确解耦的架构

html - 在 HTML 中只用一个列表项标记列表在语义上是否正确?

html - 画廊在 HTML5 中应该是什么元素?

java - 匹配至少有一个共同词的字符串

sparql - 如何在 python 中使用 RDFlib 将 RDF 数据存储到 Fuseki SPARQL 端点中的三元组存储

semantic-web - 向网站添加语义的最佳实践

html - 当每行写一个句子并且希望行与行之间有空格但只有一个语义段落时,我应该使用 <br> 还是 <p> ?