Depending on how the Wikidata proposal is implemented, there may be a need for a format to describe the structure of wikidata tables. This page proposes a format that uses the pipe syntax wikicode. Obviously, the wikidata implementation would ignore attributes (like border="1"), table headings (beginning with |+), and row/column headings (beginning with !).
The middle column in the examples above contains a keyword that describe the datatype of the field.
Table of keywords
Keyword
Meaning
number
The third column of the structure description contains the units of this number, if applicable.
year
Like a number, except it's autolinked and has no unit information
line
The field should be edited with an <input type="text">. If the third column contains autolink, then when the field is automatically linked. Otherwise the third column should be empty.
url
Like the line type, but it is automatically linked as an external link.
multiline
The field should be edited with a <textarea>...</textarea>
enumeration
The third column of the structure description is a sub-table where each row is a possible value for the enumeration. When editing an instance of this structure, the user is presented with a combo-box of the possible values.
enumeration-other
Like an enumeration, except there's an Other option in the combo box, and a text field next to the combo box for entering something that isn't in the enumeration.
substructure-array
The third column is a nested structure description. The only restrictions on the structure description are that it can't have fields of type multiline or substructure-array, and it can't have more than 10 fields.
Consider the example of the Movie datastructure. It has a field called cast that is of type substructure-array. The substructure has two fields--Actor and Character--both of type line. This can store a mapping of actors to characters.
This function takes a string containing wikicode as an argument, and returns a 2-dimensional array of strings representing the first table found in the wikicode.