Page Forms

The educational technology and digital learning wiki
Jump to navigation Jump to search

Draft

This article or section is currently under construction

In principle, someone is working on it and there should be a better version in a not so distant future.
If you want to modify this page, please discuss it with the person working on it (see the "history")

Don't trust anything yet - Daniel K. Schneider 18:01, 26 August 2011 (CEST) !!!

Introduction

Semantic Forms is an Mediawiki extension for the Semantic MediaWiki extension.


Semantic Forms is an extension to MediaWiki that allows users to add, edit and query data using forms. It is heavily tied in with the Semantic MediaWiki extension, and is meant to be used for structured data that has semantic markup. Having Semantic MediaWiki installed is a precondition for the Semantic Forms extension; the code will not work without it (and you must have version 1.4 or higher of SMW).

Very simply, Semantic Forms allows you to have forms for adding, editing and querying data on your wiki, without any programming. Forms can be created and edited not just by administrators, but by users themselves.

The main components of Semantic Forms functionality are form definition pages, which exist in a new namespace, 'Form:'. These are pages consisting of markup code which gets parsed when a user goes to add or edit data. Since forms are defined strictly through these definition pages, users can themselves create and edit forms, without the need for any actual programming.

(Extension:Semantic Forms, retrieved 13:30, 25 August 2011 (CEST))

The semantic forms extension is very complex and requires a bit of technical background in both knowledge representation and markup languages. However, a few special pages can help with creation of various items needed to define a form and the underlying semantic data structures.

Principles

Workflow for creating a form

A form is usually made for creating object of a given type, i.e. a class. The form itself relies on pre-defined properties and mediawiki templates. Without these, the form won't work !

  1. Define properties that will represent the data structure of objects. For each property a page in the property: namespace will be created. Thus, properties also can be documented.
  2. Create templates, one for each object.
  3. Create forms for creating objects with values
  4. Create categories, typically one for each form/object
  5. Enable links to forms
  6. Add data using forms

The easiest way of creating classes and forms from scratch is using the Special:CreateClass page. It's an all-in-one solution with a form that allows to define property names, associated form field names, property types, allowed valudes and a checkbox for multiple values.

SMW principles

(should be moved to its own page once I get going ...)

Data in Semantic MediaWiki are defined by properties.

Each property must be created as a page in the properties namespace. E.g. to create a name property, use:

[[property:: name]]

You then can type the property. By default a property if of type page (see below). You could edit the property:your_property page and add a type declaration like this:

This is a property of type [[Has type::URL]].

The easiest way to create such a property page is to use the Special:CreateProperty "special" page.

Properties do have data types, for example

  • Page (i.e. the value of the property is a wiki page)
  • String (a short text)
  • Text (a longer text)
  • Code (same but pre-formatted)
  • URL
  • Number
  • Date
  • Enumeration
  • Boolean

The Form markup language

The markup language used by this extension uses the MediaWiki templates syntax. “Forms are defined using a set of tags that specify templates and fields within those templates. Wiki-text, and some HTML, can be freely embedded anywhere outside of the tags.” (Extension:Semantic Forms, retrieved 25 August 2011)

Forms must be created within the Form: namespace

A somewhat minimual form definition looks like this:

Example 1

We shall reproduce the example referred to in the Semantic Forms documentation, i.e. the Item defined in the Discourse DB wiki. However, we will make some changes, i.e. make it a bit simpler. In particular, some data just will be strings as opposed to pages.

The example includes 3 classes

  • Option item (called just Item in the original). It is defined by the four properties: Author, Was published by, Was published on, Has URL, Has Quote.
  • Opinion is defined by three properties:
  • Reference

Create properties

The easiest way to create properties is to use the Special:CreateProperty page. Alternatively you just could create a page like [[Property:XXX]]

When you copy forms and templates from other SWM web sites you have to be carefuls understanding what the property names are. Not to be confused with form field names (although they can be the same of course).

So let's create all the properties needed using the Special:CreateProperty page. By default, a property is of type page. In other words if you get a "red link" after filling in a form and you don't want one, it means that you didn't define the property or that your form isn't using the right property.

An Opinion item (called item) in the original is represented by the following properties

Property name               Type       changes from discourse db

Was written by              String     was Type=page
Was published by            String     was Type=page
Was published on            Date
Has URL			    URL
Has quote		    Text

An Opinion (simplified, in the original opinions were implemented a subpages of a page representing the topic).

Property name               Type       changes from discourse db

addresses topic             Page
is for                      String     was Type = Page
is against                  String     was Type = Page
is mixed on                 String     was Type = Page

A Opinion reference (called reference in the original) links to a prior Opinion item.

Property name               Type       changes from discourse db

refers to                  Page

Were therefore get this list of properties:

  1. Property:Addresses topic
  2. Property:Has URL
  3. Property:Has quote
  4. Property:Is against
  5. Property:Is for
  6. Property:Is mixed on
  7. Property:Refers to
  8. Property:Was published by
  9. Property:Was published on
  10. Property:Was written by

Create templates

For each of these classes, a template that defines (part) of its visual layout should now be created.

See:

Create the forms

This example uses two forms. One main form for defining opinion items. And a form that could be used to add references to other items.

Finally, you should create one (or more) forms for editing the data

See:

Edit the category

Add:

[[Has default form::your_form-name_here]]

Example:

Pointing red links to an appropriate form

Example 2

Links

Homepage and download

Introductions, manuals

Examples sites using this extension