Tutorial
From LDTables Wiki
A Linked Data Table is a special kind of HTML table where the underlying data expressed in the table can be automatically extracted by standard software. The advantage to using Linked Data Tables, compared to other data formats, is that the data is presented in ordinary HTML. It can be created with ordinary HTML authoring techniques, and it can be be understood by people without any special tools or training. Compared to using other kinds of HTML tables, the advantage is in interoperability with standard RDF tools and other data aggregation and processing systems.
Contents |
[edit] A Simple Table
Here is a simple Linked Data Table:
| Name | Country | Population | Year Founded |
|---|---|---|---|
| Paris | France | 2,203,817 | 4200 BCE |
| London | UK | 7,556,900 | 43 AD |
| San Francisco | USA | 808,976 | 1776 |
At first glance, there is nothing surprising about this table. The typical reader can understand it easily, seeing that it contains several facts, such as:
- There is a city named "Paris" in a coutry called "France"
- The population of "Paris" is 2,203,817
- "London" has a popularion of 7,556,900
- "San Francisco" was founded in 1776
This table is special in one way: the headings ("Name", "Country", etc) are HTML links. The styling on this page hides that fact unless you point to them, because they are part of the mechanism or metadata of the table, not its central content.
This is a Linked Data Table because those heading links point to pages which declare precisely how to extract the data in this table. You can click on one of those links now, to step behind the curtain on this introduction, or just read on.
[edit] Variations
There are several equivalent ways to present a dataset in Linked Data Tables. For example, the headings can be on the left (in the first column) instead of at the top (in the first row). All we've done in flip the table around. It may feel a bit different to some human readers, but it contains the same information:
| Name | Paris | London | San Francisco |
|---|---|---|---|
| Country | France | UK | USA |
| Population | 2,203,817 | 7,556,900 | 808,976 |
| Year Founded | 4200 BC | 43 AD | 1776 |
Linked Data Table software reads this exactly like Example 1. The only difference is in how browsers present it for people; designers should pick the style that works best for their data, their site, and their readers.
A side-heading table with only one entry looks a lot like a form:
| Name | Paris |
|---|---|
| Country | France |
| Population | 2,203,817 |
| Year Founded | 4200 BC |
This table, along with similar tables about London and San Francisco, would (again) be read by software exactly like Example 1, freeing the designer to pick an approach that works best for the human reader.
One more common variation is to put the heading link into one part of the heading, instead of making it the entire heading. This is, again, just a matter of presentation and style. For some audiences, this approach may make it more clear that there is a link to an explanation of the heading:
| Name (?) | San Francisco |
|---|---|
| Country (?) | USA |
| Population (?) | 808,976 |
| Year Founded (?) | 1776 |
[edit] Links to More Data
Here are two Linked Data Tables. The first one is that same as Example 1, except the names of countries are links. The second table is a table of countries. In each table, country and city names link to rows in the other table.
(Perhaps we can use some javascript to highlight the link destination when you point to the link? Clicking is confusing.)
| Name | Country | Population | Year Founded |
|---|---|---|---|
| Paris | France | 2,203,817 | 4200 BC |
| London | UK | 7,556,900 | 43 AD |
| San Francisco | USA | 808,976 | 1776 |
| Name | Population | Capital | Other Tourist Cities |
|---|---|---|---|
| France | 65,073,482 | Paris | Nice, Marseilles |
| United Kingdom | 61,113,205 | London | Bristol, Manchester |
| United States | 307,619,000 | Washington, D.C. | Boston, San Francisco |
It can be confusing to link to individual rows in a table, as we've done in this example, and some HTML authoring environments do not allow it. The alternative is to use single-entry tables. If you want to avoid using ids and fragments entirely, you can put each single-entry table on a page by itself, like this: Paris, London, San Francisco, France, United Kingdom, United States.
[edit] Formats for Table Cells
Within the table cells for each heading, there are rules about what can appear. For instance, under the "Population" heading, only numbers are allowed. For this particular population heading, we require the numbers to include commas, in the standard American style. We call this the decimal-with-commas format, and it is one of several formats in the growing collection.
The data in Example 1 uses three different formats:
- string for text like "Paris" and "France"
- decimal-with-commas for the population numbers
- year for the when the city was founded.
In Example 5 we add another format:
- indirect-link which is an HTML link to some information about the item being referred to. For example, we referred to the country France using the URL of some text about France.
Example 6 used two more formats:
- comma-sepated-multi, for the collection of other tourist cities
- mixed, to allow the references to tourist cities to be either string or indirect-link.
There is an evolving library of such formats. At some point, it will need to be standardized.
[edit] Properties (Headings)
In general, you are free to make up whatever table headings make sense to you. You just have to make the heading link to a proper description.
If you can find an existing heading that has the right meaning, that may be easier for you, and it makes things much easier for your readers and systems consuming your data, because they need to understand fewer different sources.
