Register | Sign In  
Wiki Lens/Structured Data Tutorial    avg: 5.0 (1 rating)

This page is for users of structured data pages. If you're a programmer who wants to write plugins that interact with structured data you should look at WikiLens/Developers/StructuredDataTutorial.

To set up a WikiLens Category for objects that have structured data in them (like Title and Author for a Book Category, or Price and Location for a Restaurant Category):

  1. Create the new category page. You can easily do this from the home page of a Wiki by clicking on Create Category and following the instructions.
  2. Add a line to the category page that points to the fields page for the new Category. A great name for this page is <NewCategory>/Fields. Example

    Fields: Restaurant/Fields

  3. Add the fields to the Fields page by editing that page directly. The things that can go on the Fields page are:

    • The name of a field. This field is by default a default-sized text box. To create a field just have a line with a * and the name of the field. Example:
    * Name
    * Address
  • A fixed sized textbox. This field is a widget of type textbox with optional size and maxlength keyword parameters. Example:
    * Zip
      * Widget: textbox(size=5,maxlength=10)
  • A set of radio buttons. These are great when only one of several choices must be made. As with any field, an optional name can be set with the * Name option. That name will be used in display to users, but not internally. A radio button widget is of type radio, with keyword parameter cols to define how many columns the options should be lined up in. The available selections should be listed under an Options option. Notice that there also is a Default option used here. This specifies what value this field has for items that have not yet had a value specified by someone. Example:
    * lunchCost
      * Name: Average lunch cost
      * Widget: radio(cols=6)
      * Options:
        * $3-5
        * $5-7
        * $7-10
        * $10-15
        * $15-20
        * $20+
      * Default: $5-7
  • A set of checkboxes. One or more of these can be checked. The widget is called checkbox, and it takes the same cols parameter as radio buttons. Also, notice that the Options list here is in "key: value" form. Users will see the value part of the option, but when storing data, the system will use the key. This is useful for cases where you expect that the user-facing text of the choices may change. Example:
    * otherFeatures
      * Name: Other features
      * Widget: checkbox
      * Options:
        * veggie: Has vegetarian entrees
        * lunch_buffet: Has lunch buffet
  • Some other supported widget types are:

    • select - a listbox that accepts multiple selections (the size parameter specifies the listbox size)
    • dropdown - a dropdown menu or listbox depending on the size parameter that accepts a single selection
    • textarea - a larger multi-line text input box (the rows and cols parameters specify how big it is)
    • hidden - a field that isn't rendered but is stored and can be editted manually in the Wiki text

A nice feature of the structured data support in WikiLens is that it will try to adjust as you make changes to the types of structured data. In particular, it does a pretty good job of dealing with your adding fields to a category. It does a much worse job of dealing with changing fields, since the old values might not make sense. For options that change, the "key: value" method of specifying options allows you to change the text of an option without changing the data.