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>
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 thetypeof
attribute, like this:typeof="Place Offer"
.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:Another to check your RDFa is RDFa / Play. More tools are available from RDFa.info's Tools.
If you're not already, I suggest that you try out the W3C's RDFa 1.1 Distiller and Parser. You can copy in your RDFa and see the data that is produces. For instance, your current markup yields these triples:
This means that you have a relatively easy to use tool for checking whether modifications to your markup produce the kinds of results that you're looking for. (You should also check whether or not the triples above accurately represent the data that you've attempted to represent so far.) I think there may be some issues with the data as it is now. For instance, did you actually intend that the report is a place, i.e., that:
At any rate, to add a relationship between one thing and another, just add another link like you've done for things so far, but use the identifier of another resource. For instance, if you add
to the
Energy Assessment for 1 main st. townville, ca Energy Potential for 1 main st., townville, ca. Explore installation offers. Find the best choice for your home. an offer for this placediv
that describes#energyreport
, so that you have:you'll get triples like:
which include the relationship that you wanted (modulo the particular URIs used):