Difference between revisions of "Help:Semantic Forms"
(Created page with '{{WikihelpHeader}} This section gives some guidance on, and provides some examples for the use the Semantic Forms. For more detailed descriptions see the '''[http://www.mediawik...') |
|||
Line 1: | Line 1: | ||
{{WikihelpHeader}} | {{WikihelpHeader}} | ||
− | This section gives some guidance on, and provides some examples for | + | This section gives some guidance on, and provides some examples for using the Semantic Forms extension. For more detailed descriptions see the '''[http://www.mediawiki.org/wiki/Extension:Semantic_Forms Semantic Forms website]'''. |
==Introduction== | ==Introduction== | ||
Line 7: | Line 7: | ||
==Defining properties and data types== | ==Defining properties and data types== | ||
− | As explained in the [[Help:SemanticMW| Semantic Mediawiki help section]] the data need to be defined as properties and data types. However, you only need properties for the data which you want to call up later in queries. In our example we | + | As explained in the [[Help:SemanticMW| Semantic Mediawiki help section]] the data need to be defined as properties and data types. However, you only need properties for the data which you want to call up later in queries. In our example we have created the properties<br> |
[[Property:Publication title]]<br> | [[Property:Publication title]]<br> | ||
[[Property:Publication authors]]<br> | [[Property:Publication authors]]<br> | ||
Line 17: | Line 17: | ||
==Creating categories for the form and the journals== | ==Creating categories for the form and the journals== | ||
− | Each form needs a special category which defines a link to the form. Here we | + | Each form needs a special category which defines a link to the form. Here we have created the [[:Category:Publications]]. In the text for this category we provide the link to our form through the following assignment:<pre>[[Has default form::Publication in journal]]</pre> where "Publication in journal" is the name of our form.<p> |
We further need the [[:Category:Journals]] to be able to bring the articles into a structure where they can be found easily. | We further need the [[:Category:Journals]] to be able to bring the articles into a structure where they can be found easily. | ||
==Creating a template for the form== | ==Creating a template for the form== | ||
− | The [[Template:Publication in journal]] provides formatting instructions for the data entered into the form. Each form needs a template and in order to avoid confusion the template should have the same name as the form. In this template the text between the <noinclude> and </noinclude> only provide some information on the data fields used by the template which should be later also included in the form. If these data elements have been defined as properties they should be here, of course, referred to with exactly the same spelling. The actual content of the template is enclosed in the <includeonly> and </includeonly> tags. The content consists of the following parts: | + | The [[Template:Publication in journal]] provides formatting instructions for the data entered into the form. Each form needs a template and in order to avoid confusion the template should have the same name as the form. In this template the text between the <nowiki><noinclude> and </noinclude></nowiki> tags only provide some information on the data fields used by the template which should be later also included in the form. If these data elements have been defined as properties they should be here, of course, referred to with exactly the same spelling. The actual content of the template is enclosed in the <nowiki><includeonly> and </includeonly></nowiki> tags. The content consists of the following parts: |
* '''Defining the format in which the data will be displayed in a page created by the form:''' | * '''Defining the format in which the data will be displayed in a page created by the form:''' | ||
*#For each data field the content to be entered into the form is enclosed in 3 curly braces, e.g. the text - <nowiki>'''Abstract:''' {{{Publication abstract|}}}</nowiki> - defines how and where the abstract of an article will appear in the final page. In this case it will appear after a line stating the journal, volume and page numbers and will be preceded by the bold text "Abstract:". | *#For each data field the content to be entered into the form is enclosed in 3 curly braces, e.g. the text - <nowiki>'''Abstract:''' {{{Publication abstract|}}}</nowiki> - defines how and where the abstract of an article will appear in the final page. In this case it will appear after a line stating the journal, volume and page numbers and will be preceded by the bold text "Abstract:". | ||
− | *#For data fields like authors, title, journal, volume and page number which we want to call-up later in semantic queries we need to format them as semantic assignments (see [[Help:SemanticMW| Semantic Mediawiki help section]]). This means use the format "<nowiki>[[property::value]]</nowiki>". For example in "<nowiki>[[Publication title::{{{Publication title|}}}]]</nowiki>" The first "Publication title" is the property name and the "<nowiki>{{{Publication title|}}}</nowiki>" is what will be entered as title later in the form. | + | *#For data fields like authors, title, journal, volume and page number which have been defined as properties and which we want to call-up later in semantic queries we need to format them as semantic assignments (see [[Help:SemanticMW| Semantic Mediawiki help section]]). This means we use the format "<nowiki>[[property::value]]</nowiki>". For example in "<nowiki>[[Publication title::{{{Publication title|}}}]]</nowiki>" The first "Publication title" is the property name and the "<nowiki>{{{Publication title|}}}</nowiki>" is what will be entered as title later in the form. |
− | *#The "<nowiki>{{#if: ....}}</nowiki>" constructions simply make sure none of the formatting instructions are applied if the field is left blank in the form. Note that the abstract field is not enclosed in "<nowiki>{{#if: ....}}</nowiki>". Therefore the bold text "Abstract:" will appear in the page even if no abstract has been entered, in order to encourage other users to add an abstract at a later stage. | + | *#The "<nowiki>{{#if: ....}}</nowiki>" constructions simply make sure none of the formatting instructions are applied if the field is left blank in the form. Note that the abstract field is not enclosed in an "<nowiki>{{#if: ....}}</nowiki>" statement. Therefore the bold text "Abstract:" will appear in the page even if no abstract has been entered, in order to encourage other users to add an abstract at a later stage. |
− | *'''Defining a table for some data.''' The text starting with "<nowiki>{| border= ...</nowiki> defines a table to display the fields journal, year, volume, and pages. These are important data which are used to generate the name of the article page. | + | *'''Defining a table for some data.''' The text starting with "<nowiki>{| border= ...</nowiki>" defines a table to display the fields journal, year, volume, and pages. These are important data which are used to generate the name of the article page. |
− | *'''Link to [[:Category:Publications]].''' We finally need a link to the special property assigned to | + | *'''Link to [[:Category:Publications]].''' We finally need a link to the special property page assigned to this form. |
==Creating the form "Publication in journal"== | ==Creating the form "Publication in journal"== | ||
− | + | Often it is helpful to use the page '''[[Special:CreateForm]]''' to create a new form. However, a new form can be also created like other pages, provided the page name "Form:<form name>" is used. The script in '''[[Form:Publication in journal]]''' contains the following elements: | |
+ | * '''An internal link for creating a new page with this form.''' This is the text within the <nowiki><noinclude> and </noinclude></nowiki> tags. | ||
+ | * '''A statement for generating the pagename automatically from the data entered'''. This is the text within the "<nowiki>{{{info|page name= ...}}}</nowiki>" statement. It simply states which fields in which sequence will be used to create the pagename. | ||
+ | * '''Display of the fields which have been described in the template of the form.''' This is the text included within the <nowiki>{{{for template|Publication in journal}}} and {{{end template}}}</nowiki> statements (if a form contains additional subforms there may be several such template statements in the form). Here the text for displaying the fields defines a table with the texts preceded by "!" are labels in the table and texts within the "<nowiki>{{{field| ...}}}</nowiki>" statements define the input boxes for each field. Each such statement contains the field name and other commands to define the size and function of the input boxes. Useful commands for the input boxes are, for example: | ||
+ | *# '''mandatory''' which ensures that this field will contain some text. If such a field is left blank the form cannot be saved and the warning "cannot be blank" appears in red beside the field. | ||
+ | *# '''maxlength''' to specify the maximum number of characters or digits which can be entered into an input box. For example, since the pagename cannot exceed 255 characters, it is useful to limit the length of the fields journal, year, volume and pages. | ||
+ | *# '''autocomplete on category''' provides the names of the pages which already exist in the specified category below the input box when the user starts typing; this allows the user to quickly select a given input text for this field. | ||
+ | *'''Standard inputs.''' Several standard input boxes (e.g. the summary input box) or commands (e.g. the "preview button" or the "cancel" command) can be defined. | ||
==Calling-up the data entered== | ==Calling-up the data entered== |
Revision as of 19:38, 4 April 2010
Help sections |
---|
Contents · Semantic MediaWiki · Semantic Forms |
Add Ontology · Semantic links and import/export features · Import external vocabulary |
Other SemanticMW extensions · Other extensions |
This section gives some guidance on, and provides some examples for using the Semantic Forms extension. For more detailed descriptions see the Semantic Forms website.
Contents
Introduction
The Semantic Forms extension is used in connection with the Semantic Mediawiki extension. It is useful for creating forms which can greatly facilitate the entry of data in the semantic system. As an example we explain here the creation of a form for entering data into a semantic literature database, specifically articles published in journals. This system sorts the literature automatically in the respective journal page and allows formatting and displaying the literature in different ways.
Defining properties and data types
As explained in the Semantic Mediawiki help section the data need to be defined as properties and data types. However, you only need properties for the data which you want to call up later in queries. In our example we have created the properties
Property:Publication title
Property:Publication authors
Property:Publication journal
Property:Publication year
Property:Publication volume
Property:Publication pages
However, we do not need to create properties for other elements of the publication pages, like abstracts or external links to the full texts of the articles.
Creating categories for the form and the journals
Each form needs a special category which defines a link to the form. Here we have created the Category:Publications. In the text for this category we provide the link to our form through the following assignment:[[Has default form::Publication in journal]]where "Publication in journal" is the name of our form.
We further need the Category:Journals to be able to bring the articles into a structure where they can be found easily.
Creating a template for the form
The Template:Publication in journal provides formatting instructions for the data entered into the form. Each form needs a template and in order to avoid confusion the template should have the same name as the form. In this template the text between the <noinclude> and </noinclude> tags only provide some information on the data fields used by the template which should be later also included in the form. If these data elements have been defined as properties they should be here, of course, referred to with exactly the same spelling. The actual content of the template is enclosed in the <includeonly> and </includeonly> tags. The content consists of the following parts:
- Defining the format in which the data will be displayed in a page created by the form:
- For each data field the content to be entered into the form is enclosed in 3 curly braces, e.g. the text - '''Abstract:''' {{{Publication abstract|}}} - defines how and where the abstract of an article will appear in the final page. In this case it will appear after a line stating the journal, volume and page numbers and will be preceded by the bold text "Abstract:".
- For data fields like authors, title, journal, volume and page number which have been defined as properties and which we want to call-up later in semantic queries we need to format them as semantic assignments (see Semantic Mediawiki help section). This means we use the format "[[property::value]]". For example in "[[Publication title::{{{Publication title|}}}]]" The first "Publication title" is the property name and the "{{{Publication title|}}}" is what will be entered as title later in the form.
- The "{{#if: ....}}" constructions simply make sure none of the formatting instructions are applied if the field is left blank in the form. Note that the abstract field is not enclosed in an "{{#if: ....}}" statement. Therefore the bold text "Abstract:" will appear in the page even if no abstract has been entered, in order to encourage other users to add an abstract at a later stage.
- Defining a table for some data. The text starting with "{| border= ..." defines a table to display the fields journal, year, volume, and pages. These are important data which are used to generate the name of the article page.
- Link to Category:Publications. We finally need a link to the special property page assigned to this form.
Creating the form "Publication in journal"
Often it is helpful to use the page Special:CreateForm to create a new form. However, a new form can be also created like other pages, provided the page name "Form:<form name>" is used. The script in Form:Publication in journal contains the following elements:
- An internal link for creating a new page with this form. This is the text within the <noinclude> and </noinclude> tags.
- A statement for generating the pagename automatically from the data entered. This is the text within the "{{{info|page name= ...}}}" statement. It simply states which fields in which sequence will be used to create the pagename.
- Display of the fields which have been described in the template of the form. This is the text included within the {{{for template|Publication in journal}}} and {{{end template}}} statements (if a form contains additional subforms there may be several such template statements in the form). Here the text for displaying the fields defines a table with the texts preceded by "!" are labels in the table and texts within the "{{{field| ...}}}" statements define the input boxes for each field. Each such statement contains the field name and other commands to define the size and function of the input boxes. Useful commands for the input boxes are, for example:
- mandatory which ensures that this field will contain some text. If such a field is left blank the form cannot be saved and the warning "cannot be blank" appears in red beside the field.
- maxlength to specify the maximum number of characters or digits which can be entered into an input box. For example, since the pagename cannot exceed 255 characters, it is useful to limit the length of the fields journal, year, volume and pages.
- autocomplete on category provides the names of the pages which already exist in the specified category below the input box when the user starts typing; this allows the user to quickly select a given input text for this field.
- Standard inputs. Several standard input boxes (e.g. the summary input box) or commands (e.g. the "preview button" or the "cancel" command) can be defined.