Help:Join data from two pages into one table

I found myself in a situation where I wanted to list in a table data properties scattered over two wiki pages for each row. That is, given one table row, one column was found on one page, while the other column was found on another page. After asking on #semantic-mediawiki, faceface explained me how to do this, and to write it up here. The key here is to use templates.

I had these semantic pages:


 * http://drugmet.rilspace.org/wiki/FC(F)(F)CO, which links semantically with HasPKaValue to
 * http://drugmet.rilspace.org/wiki/An_experimental_pKa_value_from_10.1021/ja01489a008_for_FC(F)(F)CO

Both pages have data properties associated: SIO_000300 to a value, and Label on the first.

The example website is no longer available.

query created

 * Here's the query I have on the "All_pKa_values" page

The templates (the crucial part below) create the table. The main template part uses a #show statement to get the SIO_0003000 property from the second page:. The first page is what is being queried for with #ask: HasPKaValue::+.

templates required

 * PKaValueTemplate

| ||  |-


 * PKaValueTemplateHeader

Just call this template footer so you may reuse it for other queries. Thus you do not have to create several templates with the same content.

related tip

 * Use the template format to create tabular output