<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.townx.org" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>townx - Example of how to put RDFa into an HTML list - Comments</title>
 <link>http://www.townx.org/blog/elliot/example-how-put-rdfa-html-list</link>
 <description>Comments for &quot;Example of how to put RDFa into an HTML list&quot;</description>
 <language>en</language>
<item>
 <title>Thank you</title>
 <link>http://www.townx.org/blog/elliot/example-how-put-rdfa-html-list#comment-40220</link>
 <description>&lt;p&gt;i like JQuery :))&lt;/p&gt;</description>
 <pubDate>Wed, 30 Dec 2009 15:32:25 -0600</pubDate>
 <dc:creator>Forum</dc:creator>
 <guid isPermaLink="false">comment 40220 at http://www.townx.org</guid>
</item>
<item>
 <title>Example of how to put RDFa into an HTML list</title>
 <link>http://www.townx.org/blog/elliot/example-how-put-rdfa-html-list</link>
 <description>&lt;p&gt;I&#039;m not going to try to explain &lt;a href=&quot;http://www.w3.org/TR/rdf-primer/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;&lt;/a&gt; and/or &lt;a href=&quot;http://www.w3.org/TR/xhtml-rdfa-primer/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;a&lt;/a&gt; here, but thought any poor suckers looking for &lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;a examples might benefit from me posting what I finally worked out, with help from my colleague &lt;a href=&quot;http://dynamicorange.com/&quot;&gt;Rob&lt;/a&gt;. Namely, how to annotate an &lt;span class=&quot;caps&quot;&gt;HTML &lt;/span&gt;ordered list (&amp;lt;ol&amp;gt;) with &lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;a attributes; and how to put &lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;a attributes onto form elements.&lt;/p&gt;

&lt;p&gt;Here&#039;s the &lt;span class=&quot;caps&quot;&gt;HTML &lt;/span&gt;page with &lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;a embedded in it. What I&#039;m representing here is a sequence of collections, and the individual collections within it:&lt;/p&gt;



&lt;pre&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML+RDFa 1.0//EN&amp;quot; &amp;quot;http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd&amp;quot;&amp;gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Collections&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Collections&amp;lt;/h1&amp;gt;
    &amp;lt;form method=&amp;quot;post&amp;quot; action=&amp;quot;http://receptacular.org/collections&amp;quot;&amp;gt;
      &amp;lt;ol xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot; xmlns:rdfs=&amp;quot;http://www.w3.org/2000/01/rdf-schema#&amp;quot; xmlns:rdf=&amp;quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;quot; xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema#&amp;quot; xmlns:rec=&amp;quot;http://receptacular.org/schema#&amp;quot; typeof=&amp;quot;rdf:Seq&amp;quot; about=&amp;quot;http://receptacular.org/collections&amp;quot;&amp;gt;
        &amp;lt;li rel=&amp;quot;rdf:_1&amp;quot; resource=&amp;quot;http://receptacular.org/collections/1&amp;quot;&amp;gt;
          &amp;lt;span style=&amp;quot;display:none;&amp;quot; rel=&amp;quot;rdf:type&amp;quot; resource=&amp;quot;http://receptacular.org/schema#Collection&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
          &amp;lt;div class=&amp;quot;collection-label&amp;quot; property=&amp;quot;rdfs:label&amp;quot;&amp;gt;Vague Collection&amp;lt;/div&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-1-hidden&amp;quot; property=&amp;quot;rec:hidden&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;false&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-1-hidden&amp;quot;&amp;gt;hidden&amp;lt;/label&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-1-defaultSearch&amp;quot; property=&amp;quot;rec:defaultSearch&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;false&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-1-defaultSearch&amp;quot;&amp;gt;use for searches&amp;lt;/label&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li rel=&amp;quot;rdf:_2&amp;quot; resource=&amp;quot;http://receptacular.org/collections/2&amp;quot;&amp;gt;
          &amp;lt;span style=&amp;quot;display:none;&amp;quot; rel=&amp;quot;rdf:type&amp;quot; resource=&amp;quot;http://receptacular.org/schema#Collection&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
          &amp;lt;div class=&amp;quot;collection-label&amp;quot; property=&amp;quot;rdfs:label&amp;quot;&amp;gt;Archive Collection&amp;lt;/div&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-2-hidden&amp;quot; property=&amp;quot;rec:hidden&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;false&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-2-hidden&amp;quot;&amp;gt;hidden&amp;lt;/label&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-2-defaultSearch&amp;quot; property=&amp;quot;rec:defaultSearch&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;false&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-2-defaultSearch&amp;quot;&amp;gt;use for searches&amp;lt;/label&amp;gt;
        &amp;lt;/li&amp;gt;
        &amp;lt;li rel=&amp;quot;rdf:_3&amp;quot; resource=&amp;quot;http://receptacular.org/collections/3&amp;quot;&amp;gt;
          &amp;lt;span style=&amp;quot;display:none;&amp;quot; rel=&amp;quot;rdf:type&amp;quot; resource=&amp;quot;http://receptacular.org/schema#Collection&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
          &amp;lt;div class=&amp;quot;collection-label&amp;quot; property=&amp;quot;rdfs:label&amp;quot;&amp;gt;Main Collection&amp;lt;/div&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-3-hidden&amp;quot; property=&amp;quot;rec:hidden&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;true&amp;quot; checked=&amp;quot;checked&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-3-hidden&amp;quot;&amp;gt;hidden&amp;lt;/label&amp;gt;
          &amp;lt;input type=&amp;quot;checkbox&amp;quot; id=&amp;quot;collections-3-defaultSearch&amp;quot; property=&amp;quot;rec:defaultSearch&amp;quot; datatype=&amp;quot;xsd:boolean&amp;quot; content=&amp;quot;true&amp;quot; checked=&amp;quot;checked&amp;quot;/&amp;gt;
          &amp;lt;label for=&amp;quot;collections-3-defaultSearch&amp;quot;&amp;gt;use for searches&amp;lt;/label&amp;gt;
        &amp;lt;/li&amp;gt;
      &amp;lt;/ol&amp;gt;
      &amp;lt;p&amp;gt;
        &amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;Save&amp;quot; id=&amp;quot;save-collections&amp;quot;/&amp;gt;
      &amp;lt;/p&amp;gt;
    &amp;lt;/form&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;



&lt;p&gt;Available online here: &lt;a href=&quot;http://receptacular.org/collections&quot; title=&quot;http://receptacular.org/collections&quot;&gt;http://receptacular.org/collections&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Things of note:&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;The doctype declaration. This is the &lt;span class=&quot;caps&quot;&gt;W3C &lt;/span&gt;sanctioned doctype for &lt;span class=&quot;caps&quot;&gt;XHTML&lt;/span&gt;+RDFa pages. By the way, the &lt;span class=&quot;caps&quot;&gt;W3C &lt;/span&gt;validator will correctly validate this page, but standard &lt;span class=&quot;caps&quot;&gt;XHTML &lt;/span&gt;validators don&#039;t (e.g. like &quot;this one&quot;http://nutrun.com/weblog/xhtmlvalidator-validate-xhtml-in-java/:). That&#039;s another story...&lt;/li&gt;
&lt;li&gt;Namespace declarations on the &amp;lt;ol&amp;gt; element wrapping the list items. This is what causes standard &lt;span class=&quot;caps&quot;&gt;XHTML &lt;/span&gt;validation approaches to fail.&lt;/li&gt;
&lt;li&gt;The &amp;lt;ol&amp;gt; element is defined with &lt;strong&gt;typeof=&quot;rdf:Seq&quot;&lt;/strong&gt; and &lt;strong&gt;about=&quot;http://receptacular.org/collections&quot;&lt;/strong&gt;. This sets it up as the &lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt; Seq resource.&lt;/li&gt;
&lt;li&gt;The &amp;lt;li&amp;gt; elements inside the &amp;lt;ol&amp;gt; are Seq items, within the wrapping Seq resource. Each is each defined as a resource using the &lt;strong&gt;resource&lt;/strong&gt; attribute. They are linked back to the enclosing &amp;lt;ol&amp;gt; element using the &lt;strong&gt;rel&lt;/strong&gt; attribute on each. Note that the value for the &lt;strong&gt;rel&lt;/strong&gt; attribute is an rdf Seq number, which orders the items within the enclosing Seq resource.&lt;/li&gt;
&lt;li&gt;The &lt;span class=&quot;caps&quot;&gt;RDF &lt;/span&gt;type of each Seq item is set using a hidden &amp;lt;span&amp;gt; element. Note that these elements have no text in them, but have opening and closing tags. If you just use a self-closing start tag for this element, the &lt;span class=&quot;caps&quot;&gt;HTML &lt;/span&gt;doesn&#039;t display property. &lt;/li&gt;
&lt;li&gt;The &amp;lt;span&amp;gt; elements use the &lt;strong&gt;rel&lt;/strong&gt; attribute to mark their &lt;span class=&quot;caps&quot;&gt;RDF &lt;/span&gt;type relationship to the outer list item; and the &lt;strong&gt;resource&lt;/strong&gt; attribute to specify the location of the resource representing their type.&lt;/li&gt;
&lt;li&gt;Each Seq item has an enclosed &amp;lt;div&amp;gt; which represents its &lt;strong&gt;rdfs:label&lt;/strong&gt; property. Note that the &lt;strong&gt;property&lt;/strong&gt; RDFa attribute is used to specify which property of the enclosing resource is being defined. Also note that the value of the property is inlined between the start and end tags of the &amp;lt;div&amp;gt;.&lt;/li&gt;
&lt;li&gt;The two checkboxes define two more properties for each Seq resource: &lt;strong&gt;rec:hidden&lt;/strong&gt; and &lt;strong&gt;rec:defaultSearch&lt;/strong&gt;. (The semantics of the properties aren&#039;t discussed here, as I&#039;m concentrating on syntax.) Each is defined on a standard &lt;span class=&quot;caps&quot;&gt;XHTML &lt;/span&gt;&amp;lt;input&amp;gt; element: the relationship to the enclosing Seq item is defined with the &lt;strong&gt;property&lt;/strong&gt; attribute; the value of the property is defined using the &lt;strong&gt;content&lt;/strong&gt; attribute; and the data type of the literal value is defined via the &lt;strong&gt;datatype&lt;/strong&gt; attribute. Any of the standard &lt;span class=&quot;caps&quot;&gt;XML &lt;/span&gt;datatypes could be used here, or other types from other schemas.&lt;/li&gt;
&lt;li&gt;When working with form elements which represent property values for &lt;span class=&quot;caps&quot;&gt;RDF &lt;/span&gt;resources, you may need to change the &lt;strong&gt;content&lt;/strong&gt; attribute in response to UI changes. (In the application from which this example was extracted, we use &lt;a href=&quot;http://jquery.com/&quot;&gt;JQuery&lt;/a&gt; to respond to changes in the check box which set the &lt;strong&gt;content&lt;/strong&gt; attribute.)&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;To see the &lt;span class=&quot;caps&quot;&gt;RDF &lt;/span&gt;which can be extracted from this page, you can use the &lt;span class=&quot;caps&quot;&gt;W3C&#039;&lt;/span&gt;s &lt;a href=&quot;http://www.w3.org/2007/08/pyRdfa/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;a Distiller&lt;/a&gt;. Here&#039;s the resulting &lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;:&lt;/p&gt;



&lt;pre&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;
&amp;lt;rdf:RDF
  xmlns:dist=&amp;quot;http://www.w3.org/2007/08/pyRdfa/distiller#&amp;quot;
  xmlns:rdf=&amp;quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;quot;
  xmlns:rdfs=&amp;quot;http://www.w3.org/2000/01/rdf-schema#&amp;quot;
  xmlns:rec=&amp;quot;http://receptacular.org/schema#&amp;quot;
  xmlns:xhv=&amp;quot;http://www.w3.org/1999/xhtml/vocab#&amp;quot;
  xmlns:xml=&amp;quot;http://www.w3.org/XML/1998/namespace&amp;quot;
  xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema#&amp;quot;
&amp;gt;
  &amp;lt;rdf:Seq rdf:about=&amp;quot;http://receptacular.org/collections&amp;quot;&amp;gt;
    &amp;lt;rdf:_1&amp;gt;
      &amp;lt;rec:Collection rdf:about=&amp;quot;http://receptacular.org/collections/1&amp;quot;&amp;gt;
        &amp;lt;rec:hidden rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;false&amp;lt;/rec:hidden&amp;gt;
        &amp;lt;rec:defaultSearch rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;false&amp;lt;/rec:defaultSearch&amp;gt;
        &amp;lt;rdfs:label&amp;gt;Vague Collection&amp;lt;/rdfs:label&amp;gt;
      &amp;lt;/rec:Collection&amp;gt;
    &amp;lt;/rdf:_1&amp;gt;
    &amp;lt;rdf:_2&amp;gt;
      &amp;lt;rec:Collection rdf:about=&amp;quot;http://receptacular.org/collections/2&amp;quot;&amp;gt;
        &amp;lt;rec:hidden rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;false&amp;lt;/rec:hidden&amp;gt;
        &amp;lt;rec:defaultSearch rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;false&amp;lt;/rec:defaultSearch&amp;gt;
        &amp;lt;rdfs:label&amp;gt;Archive Collection&amp;lt;/rdfs:label&amp;gt;
      &amp;lt;/rec:Collection&amp;gt;
    &amp;lt;/rdf:_2&amp;gt;
    &amp;lt;rdf:_3&amp;gt;
      &amp;lt;rec:Collection rdf:about=&amp;quot;http://receptacular.org/collections/3&amp;quot;&amp;gt;
        &amp;lt;rec:hidden rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;true&amp;lt;/rec:hidden&amp;gt;
        &amp;lt;rec:defaultSearch rdf:datatype=&amp;quot;http://www.w3.org/2001/XMLSchema#boolean&amp;quot;&amp;gt;true&amp;lt;/rec:defaultSearch&amp;gt;
        &amp;lt;rdfs:label&amp;gt;Main Collection&amp;lt;/rdfs:label&amp;gt;
      &amp;lt;/rec:Collection&amp;gt;
    &amp;lt;/rdf:_3&amp;gt;
  &amp;lt;/rdf:Seq&amp;gt;
&amp;lt;/rdf:RDF&amp;gt;
&lt;/pre&gt;



&lt;p&gt;Saving changes to an &lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;a-enabled form like this is another challenge, for which we used &lt;a href=&quot;http://code.google.com/p/rdfquery/&quot;&gt;rdfquery&lt;/a&gt;, and &lt;span class=&quot;caps&quot;&gt;RDF &lt;/span&gt;library for JQuery. (I recommend you use the latest svn &lt;span class=&quot;caps&quot;&gt;HEAD &lt;/span&gt;version of this library, as older versions have a bug where they ignore &lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;a elements nested inside elements without &lt;span class=&quot;caps&quot;&gt;RDF&lt;/span&gt;a attributes.) Maybe I&#039;ll get round to that another time.&lt;/p&gt;</description>
 <comments>http://www.townx.org/blog/elliot/example-how-put-rdfa-html-list#comments</comments>
 <category domain="http://www.townx.org/tech">tech</category>
 <category domain="http://www.townx.org/howtos">howtos</category>
 <pubDate>Tue, 30 Jun 2009 04:52:35 -0500</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">779 at http://www.townx.org</guid>
</item>
</channel>
</rss>
