Post on 14-Apr-2017
transcript
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
SEMANTIC FORMS & FAMILY
a story with a happy ending
SMWCon Fall 2016Tutorial Day
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
A SEMANTIC FORM
The Hero of the Story
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
SEMANTIC FORMS
• use with Semantic MediaWiki, Cargo or independently• add data via forms• style outputs with templates• documentation on mediawiki.org
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
SEMANTIC FORMS
üeasy data input and editing – nowikitext needed
üidentical styling of printoutüautomatic storage of propertiesüarraymap (& arraymaptemplate)
Help: arraymap
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
SEMANTIC FORMS
Let‘s standardize display andcreation of book pages!
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATE A NEW FORM
Get to know the classy family
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
A FORM‘S FAMILY (= CLASS)
template
property
form category
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATE A NEW FORM
• create with Special:CreateClass• create individually
1. properties & their data types2. templates3. forms4. categories
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATE A CLASS
• create with Special:CreateClass• add field names, property names,
data types, allowed values• job queue!
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATECLASS
• create with Special:CreateClass• add field names, property names,
data types, allowed values• job queue!
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
DATA STRUCTURE
FIELD NAME
INPUTVALUE
PROPERTY DATA TYPE ALLOWED VALUES
Author Hermann Hesse
Has author Page
Publishingyear
1974 Was publishedin
Year/Date YYYY
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATE INDIVIDUALLY
• create individually1. properties > Special:CreateProperty2. templates > Special:CreateTemplate3. forms > Special:CreateForm4. categories > Special:CreateCategory
Help: special pages
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATE INDIVIDUALLY
• create individually1. properties > Special:CreateProperty2. templates > Special:CreateTemplate3. forms > Special:CreateForm4. categories > Special:CreateCategory
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATE A TEMPLATE
• create individually1. properties > Special:CreateProperty2. templates > Special:CreateTemplate3. forms > Special:CreateForm4. categories > Special:CreateCategory
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATE A TEMPLATESpecial:CreateTemplate
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATE A TEMPLATE
• table, side infobox, plain text, sections
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATE A TEMPLATE
semantic storage & styling
<noinclude>[[Category:Bookform]]</noinclude>
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
USE THE TEMPLATE
but that‘s tedious to write!
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
A SIMPLE FORM
{{{for template|Book}}}{| class="formtable“! Author: | {{{field|Author|mandatory}}}|-! Publisher: | {{{field|Publisher}}}|}{{{end template}}}
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
CREATE A NEW FORM
• create individually1. properties > Special:CreateProperty2. templates > Special:CreateTemplate3. forms > Special:CreateForm4. categories > Special:CreateCategory
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
1 form can fill 1 or more templates
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
properties are taken from template
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
extra parameters according to input type
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
PARAMETERS
• mandatory – *• restricted – only for
admins• class• default value• preload content• size, rows/columns,
maxlength, autogrow• placeholder• uploadable, default
filename• values – set of values:
values from property, from category, fromnamespace, from concept, from url
• list, delimiter• show on select (input type
dropdown)
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
missing the ”Edit with form” tab?
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
Don’t forget the category:{{#default_form:Book}}
• based on category, namespace or single page
Help: the "edit with form" tab
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
FORM:BOOK
OK, but I want:• text area instead of text!• date instead of year!• a country dropdown field!
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
FORM:BOOK
So I make those changes:• {{{field|Title|mandatory|inputtype=text}}}
• {{{field|Publishing year|inputtype=year}}}
• {{{field|Publishing country|valuesfrom property=Has publishingcountry}}}
• {{{field|Author|inputtype=combobox}}}
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
A SIMPLE FORM
{{{for template|Book}}}{| class="formtable“! Author: | {{{field|Author|mandatory}}}|-! Publisher: | {{{field|Publisher}}}|}{{{end template}}}
Help: defining forms
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
„For TEMPLATE“ Tag
{{{for template|Book}}}multiplelabel= for multiple instancesdisplay= table/spreadsheetadd button text
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
„Info“ Tag{{{info}}}{{{for template|Book}}}{| class="formtable“! Author: | {{{field|Author|mandatory}}}|-! Publisher: | {{{field|Publisher}}}|}{{{end template}}}
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
„Info“ Tag
{{{info}}}partial formcreate titleedit titlequery titlepage name= formula 1-step-process!onlyinclude free text
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
„field“ Tag
{{{field|Author}}}input type= hiddenmandatoryrestricteddefaultclass
propertycargo table, cargo fieldlist, delimiterholds templateunique, unique forcategory/fornamespace/for concept
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
STANDARD INPUTS
• {{{standard input|free text|rows=10}}}• {{{standard input|summary}}}• {{{standard input|minor edit}}}• {{{standard input|watch}}}• {{{standard input|save}}}• {{{standard input|preview}}}• {{{standard input|changes}}}• {{{standard input|cancel}}}
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
INPUT TYPES
text (with autocomplete)textarea (with autocomplete)comboboxtokensradiobuttondropdowncheckboxeslistbox
treecheckboxdatedatetimeyeardatepickeropenlayers, googlemapsregexp
Help: input types
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
TEXT & TEXTAREA
with autocomplete
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
DROPDOWN, CHECKBOXES, RADIOBUTTON
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
LINK TO THE NEW FORM
• add links to forms (on startpage, in templates)– categories have default forms– links in sidebar and on pages– #formredlink
Help: #formredlink
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
data structure
DISPLAYTITLE
FIELD INPUT VALUE
PROPERTY DATA TYPE INPUT TYPE
Author Author Hermann Hesse
Has author Page Text with autocomplete
Publishing year
Year 1974 Was publishedin
Year/Date Datetime/Year/Datepicker
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
name properties wisely
• generic vs specific• thinking in sentences to make the
direction clear • Capital vs. Is capital of / Has capital
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
2-step vs. 1-step process
page name is created during input, related to input or not important.
page name is created by user
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
2-step vs. 1-step process
{{#formlink:form=Book|link text=Create a new book|link type=button|namespace=Books|new window}}
{{{info|page name=B<unique number start=000001>}}}
Special:FormEdit/Book
{{#forminput:form=Book}}
Help: one-step process
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
care for your dropdowns(and users)
{{{field|Country|inputtype=dropdown|values from
property=takes place in the country}}}
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
care for your dropdowns
{{Countrylist}}
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
care for your users
• add placeholder text & tooltips• use meaningful input type• group long forms into sections
Help: tooltipsHelp: input types
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
keep it all together
keep all corresponding pages (pages, forms, templates, properties, categories in one category for easy administraion
SMWCon Fall 2016 in Frankfurt am Main | Tutorial Day | Sabine Melnicki
use #if to style your tables and sideboxes
Help: #if parser function