Cargo Data

Cargo is used to store and query data contained within AntWiki pages. Data is added to pages by including specially formatted templates on individual pages. These templates not only display data on the page, but also add it to a database table. Each template uses a single table, with a column for each template parameter. There are a few exceptions to this; see Cargo Documentation for a full discussion of the details.

Cargo is similar to the extension Dynamic Page List [DPL] (which is used extensively throughout AntWiki) in that sets of pages meeting user-defined conditions can be retrieved and displayed. For example, this DPL code:

gives the same result as this Cargo code:

While these simple queries are essentially the same, Cargo offers extended functionality that supports much more sophisticated queries, as well as allowing complex data to be stored without relying on page categories alone. This extends and greatly simplifies data storage and retrieval.

Example
As an example, here is how AntWiki stores and manages karyotype data using the Karyotype template.

The standard karyotype template has two sections added beyond what is needed to display data on the page, one to create the database table and one to add data to the table.

Code to create the table with the fields Haploid, Diploid, Karyotype, Locality, Source, Notes:

Code to store the data:

When adding the template to a page, each of the included parameters (those that are non-blank) will be displayed on the page as well as stored in the table named “Karyotype”. The table can be viewed in its entirety or queries of the data can be included on individual pages.

Displaying Queried Data on Individual Pages
This query (when added to a page):

will display this table (this is live data but only the top 10 rows are included here):

To include only data for the genus ‘’Aphaenogaster’’, this query:

will return (only the first 10 rows shown):

Complex Data Queries
The database used by Cargo is a relational database. This means that separate tables within the database can be joined together to return a single, combined result set containing data from both tables. As an example, AntWiki holds data on both karyotypes and worker morphology. By combining these two tables, information on the (say) diploid karyotype number can be compared to (say) the antennal segment number for any given taxon.

In this query, the tables WorkerMorphology and Karyotype are joined on the field _pageName (which occurs in both tables) and three fields are returned: taxon name (from either table), diploid number (from Karyotype) and antennal segment count (from WorkerMorphology):

with the result (first 10 rows only):

Using this technique, complex questions can be answered by combining data from across AntWiki.

Real-World Examples
A few of the AntWiki pages that use Cargo data include:
 * Karyotypes - As a table.
 * Karyotype records for a genus - As a table.
 * Doleromyrma - Worker morphology in paragraph format.