Marking up a table with RDFa - Semantic Overflow most recent 30 from http://www.semanticoverflow.com 2010-03-21T04:25:05Z http://www.semanticoverflow.com/feeds/question/182 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://www.semanticoverflow.com/questions/182/marking-up-a-table-with-rdfa Marking up a table with RDFa Ian Davis 2009-11-06T11:29:37Z 2009-11-06T21:52:30Z <p>I think one of the sweet points of RDFa should be in marking up tabular data and then enabling sorting, grouping and simple numeric analysis such as summation over the table using Javascript.</p> <p>Does anyone have any pointers or examples of this being done?</p> <p>As an example, how could you mark up the table from Wikipedia's <a href="http://en.wikipedia.org/wiki/List%5Fof%5Ftallest%5Fstructures%5Fin%5Fthe%5Fworld#Structures%5F.28past%5For%5Fpresent.29%5Ftaller%5Fthan%5F600%5Fm%5F.281.2C969%5Fft.29" rel="nofollow">List of tallest structures</a>? (here are the first few rows slightly edited for clarity)</p> <pre><code>&lt;table class="wikitable"&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th colspan="2"&gt;Pinnacle height&lt;/th&gt; &lt;th&gt;Year&lt;/th&gt; &lt;th&gt;Structural type&lt;/th&gt; &lt;th&gt;Main use&lt;/th&gt; &lt;th&gt;Country&lt;/th&gt; &lt;th&gt;Town&lt;/th&gt; &lt;th&gt;Remarks&lt;/th&gt; &lt;th&gt;Coordinates&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a href="/wiki/Burj_Dubai" title="Burj Dubai"&gt;Burj Dubai&lt;/a&gt;&lt;/td&gt; &lt;td&gt;2,684 feet&lt;/td&gt; &lt;td&gt;818 m&lt;/td&gt; &lt;td&gt;2009&lt;/td&gt; &lt;td&gt;Skyscraper&lt;/td&gt; &lt;td&gt;Office, hotel, residential&lt;/td&gt; &lt;td&gt;&lt;a href="/wiki/United_Arab_Emirates" title="United Arab Emirates"&gt;United Arab Emirates&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="/wiki/Dubai" title="Dubai"&gt;Dubai&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Topped-out on 17 January 2009&lt;/td&gt; &lt;td&gt;&lt;span class="latitude"&gt;25°11′50.0″N&lt;/span&gt; &lt;span class="longitude"&gt;55°16′26.6″E&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;i&gt;&lt;a href="/wiki/Warsaw_Radio_Mast" title="Warsaw Radio Mast" class="mw-redirect"&gt;Warsaw Radio Mast&lt;/a&gt;&lt;/i&gt;&lt;/td&gt; &lt;td&gt;2,121 feet&lt;/td&gt; &lt;td&gt;646.4 m&lt;/td&gt; &lt;td&gt;1974&lt;/td&gt; &lt;td&gt;Guyed mast&lt;/td&gt; &lt;td&gt;LF-transmission&lt;/td&gt; &lt;td&gt;&lt;a href="/wiki/Poland" title="Poland"&gt;Poland&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="/wiki/G%C4%85bin" title="Gąbin"&gt;Gąbin&lt;/a&gt;-&lt;a href="/wiki/Konstantyn%C3%B3w_(P%C5%82ock_County)" title="Konstantynów (Płock County)" class="mw-redirect"&gt;Konstantynów&lt;/a&gt;, &lt;a href="/wiki/Masovian_Voivodeship" title="Masovian Voivodeship"&gt;Masovian Voivodeship&lt;/a&gt;&lt;/td&gt; &lt;td&gt;insulated; collapsed on August 8&lt;/td&gt; &lt;td&gt;&lt;span class="latitude"&gt;52°22′3.44″N&lt;/span&gt; &lt;span class="longitude"&gt;19°48′8.51″E&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> http://www.semanticoverflow.com/questions/182/marking-up-a-table-with-rdfa/183#183 Answer by billroberts for Marking up a table with RDFa billroberts 2009-11-06T11:48:26Z 2009-11-06T12:13:56Z <p>Hi Ian</p> <p>I wrote a blog post on this topic a couple of months back <a href="http://www.webofdatablog.com/articles/2009/08/25/publishing-table-based-data-as-rdfa" rel="nofollow">http://www.webofdatablog.com/articles/2009/08/25/publishing-table-based-data-as-rdfa</a> I was focusing on how to do the markup - I hadn't thought of your suggestion of using Javascript to allow operations on the data.</p> <p>From comments on that post and some further reading, I reckon that my N-ary relations approach is essentially the best bet, but using SCOVO would be an improvement over my initial experiment.</p> <p>My example was looking at time-varying data - as other responses to this question have shown, it probably doesn't need to be that complicated in the OP's example, as properties like the height and location of each tower could reasonably be taken to be constant in time.</p> http://www.semanticoverflow.com/questions/182/marking-up-a-table-with-rdfa/184#184 Answer by unknown (google) for Marking up a table with RDFa unknown (google) 2009-11-06T12:01:10Z 2009-11-06T12:01:10Z <p>I would probably do something along those lines (of course you should use another vocabulary than ex):</p> <pre><code>&lt;tr about="http://dbpedia.org/resource/Burj_Dubai"&gt; &lt;td rel="ex:seeAlso" resource="/wiki/Burj_Dubai" &gt;&lt;a href="/wiki/Burj_Dubai" title="Burj Dubai"&gt;Burj Dubai&lt;/a&gt;&lt;/td&gt; &lt;td property="ex:heightFeet"&gt;2,684 feet&lt;/td&gt; &lt;td property="ex:heightMeter"&gt;818 m&lt;/td&gt; &lt;td property="ex:yearBuilt"&gt;2009&lt;/td&gt; ... &lt;/tr&gt; </code></pre> http://www.semanticoverflow.com/questions/182/marking-up-a-table-with-rdfa/186#186 Answer by Egon Willighagen for Marking up a table with RDFa Egon Willighagen 2009-11-06T12:03:48Z 2009-11-06T21:52:30Z <p>Starting point below. It's marked community wiki, so please contribute.</p> <p>In <a href="http://www.w3.org/TR/xhtml-rdfa-primer/" rel="nofollow">XHTML+RDFa</a>:</p> <ul> <li>add the @about attribute to indicate the topic, which is for each row, so on &lt;tr></li> <li>namespace prefix dc -> Dublin Core</li> <li>does anyone know a common ontology for dimensions? height below?</li> <li>using @content to give machine readable version of the value</li> <li>using the <a href="http://www.geonames.org/ontology/#" rel="nofollow">geonames.org</a> ontology (wgs84_pos prefix) as suggested in another comment</li> </ul> <pre> &lt;tr about="http://en.wikipedia.org/wiki/Burj_Dubai"> &lt;td>&lt;a href="/wiki/Burj_Dubai" rel="dc:title" title="Burj Dubai">Burj Dubai&lt;/a>&lt;/td> &lt;td>&lt;span property="ex:height" content="2684" datatype="xsd:integer">2,684 feet&lt;/span>&lt;/td> &lt;td> &lt;span property="wgs84_pos:lat" content="25.19722" class="latitude">25°11′50.0″N&lt;/span> &lt;span property="wgs84_pos:long" content="55.27406" class="longitude">55°16′26.6″E&lt;/span> &lt;/td> &lt;/tr> </pre> http://www.semanticoverflow.com/questions/182/marking-up-a-table-with-rdfa/191#191 Answer by Xi Bai for Marking up a table with RDFa Xi Bai 2009-11-06T13:55:23Z 2009-11-06T13:55:23Z <p>You can use <em>genoname ontology</em>(www.geonames.org/ontology/#) to describe latitudes, longitudes and altitudes etc. using ''wgs84_pos:lat'', ''wgs84_pos:long'' and ''wgs84_pos:alt'' etc. Then <em>RDFQuery</em>(code.google.com/p/rdfquery/) can be employed to glean RDFa from your tables and this will be compatible with your later data processing using Javascript. </p>