Page Forms: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{stub}}
{{stub}}
{{under construction}}
{{under construction}}
Don't trust anything yet - [[User:Daniel K. Schneider|Daniel K. Schneider]] 13:46, 26 August 2011 (CEST) !!!
Don't trust anything yet - [[User:Daniel K. Schneider|Daniel K. Schneider]] 15:35, 26 August 2011 (CEST) !!!
== Introduction ==
== Introduction ==


Line 21: Line 21:
=== Workflow for creating a form ===
=== Workflow for creating a form ===


A form is usually made for creating object of a given type. The form itself relies on pre-defined properties and mediawiki templates. Without these, the form won't work !
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 !


# 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.
# 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.
Line 29: Line 29:
# Enable links to forms
# Enable links to forms
# Add data using forms
# 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 ===
=== SMW principles ===
Line 59: Line 61:
A somewhat minimual form definition looks like this:
A somewhat minimual form definition looks like this:


== Example ==
== Example 1 ==
 
We shall reproduce the example referred to in the [http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms] documentation, i.e. the '''Item''' defined in the [http://discoursedb.org/ 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 ===
=== Create properties ===


The easiest way to create properties is to use the [[Special:CreateProperty]] page. Alternatively you just could create a page like <nowiki>[[Property:XXX]]</nowiki>
The easiest way to create properties is to use the [[Special:CreateProperty]] page. Alternatively you just could create a page like <nowiki>[[Property:XXX]]</nowiki>
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]]
An '''Opinion item''' is represented by the following properties
<pre>
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
</pre>
An '''Opinion'''
<pre>
Property name              Type      changes from discourse db
addresses topic            Page
is for                      Page
is against                  Page
is mixed on                Page
</pre>
=== Create templates ===
=== Create the form ===
=== Edit the category ===
Add:
<nowiki>[[Has default form::''form-name'']]</nowiki>
Example:
=== Pointing red links to an appropriate form ===
== Example 2 ==


== Links ==
== Links ==
Line 78: Line 134:


* [http://postable.net/smwqr/ SMW QuickReference]. Includes also help for ''semantic drilldown'' and ''external data''.
* [http://postable.net/smwqr/ SMW QuickReference]. Includes also help for ''semantic drilldown'' and ''external data''.
* [http://smw.referata.com/wiki/Special:BrowseData/Tips?Extension=Semantic_Forms Tips for Semantic Forms]


=== Examples sites using this extension ===
=== Examples sites using this extension ===

Revision as of 15:35, 26 August 2011

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 15:35, 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]]

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

An Opinion item 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

Property name               Type       changes from discourse db

addresses topic             Page
is for                      Page
is against                  Page
is mixed on                 Page


Create templates

Create the form

Edit the category

Add:

[[Has default form::''form-name'']]

Example:


Pointing red links to an appropriate form

Example 2

Links

Homepage and download

Introductions, manuals

Examples sites using this extension