User:Najevi/sandbox2

Case study - a shared library
Let's go through a specific example of setting up a Semantic Forms-based wiki from scratch. We'll now go through in detail each of the steps outlined at "Getting started".
 * Let's say that you want to create a wiki that shows all the books you have at a shared library. (It might be a book club, a dormitory, a school or similar community.)

Figure out the data structure.
You'll want three kinds of pages on your wiki:
 * 1) one for books,
 * 2) one for authors
 * 3) and a third for library members.

If you can imagine other properties or attributes of each book then go ahead now and make a list of those.
 * Each book page should hold:
 * 1) a title,
 * 2) an author name (or names),
 * 3) a genre (or genres),
 * 4) a year of publication,
 * 5) a number of pages
 * 6) and the names of any members who have read the book.

Once again, if you can imagine other properties or attributes for each author then go ahead now and make a list of those. Keep in mind that a URL to a Wikipedia article about the author is much more efficient than duplicating in your library catalog system a lot of biographical data about an author.
 * Each author page should hold:
 * 1) the author name,
 * 2) their country of origin,
 * 3) and a list of all the books they have written that can be found in the shared library.

If you can imagine some relevant properties/attributes for each member then make a list.
 * Each member page: need be nothing more than a regular user-page at the wiki hosting this library catalog. However, in response to member requests, you plan to give each member at their individual and personalized member-page:
 * a compact table listing which books of each genre they have read.


 * ''We'll return to any custom lists after the initial set up because that will demonstrate the other realistic element of creating a semantic-empowered wiki, namely, adding or extending the structure to accommodate some new idea or recently emerged requirement.

Create properties
You will use Special:CreateProperty to create each of the following semantic properties.


 * For books: there is no need to create a property for the title, since the title of each page representing a book will be the title of that book.


 * That leaves five fields:
 * Author(s) - you create a property called "Was written by", of type "Page" (since each author will have his/her own page)
 * Genre(s) - you create a property called "Has genre", of type "String",
 * and give it the following list of allowed values: "Art, Cookbook, Fiction, History, Poetry, Science" (this is just an example, of course)
 * Year of publication - you create a property called "Was published in year", of type "Number"
 * Number of pages - you create a property called "Has number of pages", of type "Number"
 * Library members who have read the book - you create a property called "Was read by", of type "Page" (you plan to use each member's user-page at the wiki)


 * For authors: you only need to create one property:
 * Country of origin - you create a property called "Is from country", of type "String"


 * For members: there need not be any properties created for a member.

If you have a custom list of additional properties please chose just one item from each list to add at this initial set up phase and leave at least one item to be added "after the fact". It makes no difference to the procedure for creating a property but in later steps there is a different procedure involved so you will appreciate the practice gained from going through the entire work flow, beginning with the creating of new properties, after the fact.

Create templates
You need to create two templates, one for books and one for authors. Recall that member/user pages have no semantic data associated with them and so we don't need a template for member pages. (It would not hurt to have one but we don't need one.)

Books
Using Special:CreateTemplate, you create a template called "Book", and set it to define the category "Books". You add to it four fields, and for each field you specify three values: its field name in the template source code, its display label on each page, and the semantic property it populates.
 * For the first field, you set the field name to be "Authors", the label to be "Author(s)" and the semantic property to be "Was written by", and check the box indicating that this field can hold a list of values (since a book can have more than one author);
 * Click the Add field button and then for the second field, you set the three values to be "Genres", "Genre(s)" and "Has genre", and also check the box for a list of values;
 * Click the Add field button and then for the third, you set the values to be "Year", "Year of publication" and "Was published in year";
 * Click the Add field button and then and for the fourth field, you set them to be "Number of pages", "Number of pages" and "Has number of pages".
 * Click the Add field button and then and for the fifth field, you set them to be "Readership", "Members who have read this book" and "Was read by".
 * Click the Save page button.

Authors
Using Special:CreateTemplate, you create a template called "Author", and set it to define the category "Authors".
 * You add to it just one field for which you set the three values to be "Country", "Country of origin" and "Is from country".
 * For this template, you also fill out the "Aggregation" fields in the form, since you want each author page to list all the books the author has written. Under "Semantic property", you select "Was written by", and for "Title for list" you put "Books by this author".
 * Click the Save page button.

Create forms
You need to create two forms, one for books and one for authors:
 * Books - using the "Create a form" page, you make a form called "Book", and add to it the template "Book". You do not do any further customizations on this form, but just save the form once you have created it.
 * Authors - using the "Create a form" page, you make a form called "Author", and add to it the template "Author". As before, you do not do any further customizations - you just save the page.

Create categories
You need to create two categories, one for books and one for authors; you have already specified these categories' names before:
 * Books - using the "Create a category" page, you make a category called "Books", and give it the default form "Book".
 * Authors - using the "Create a category" page, you make a category called "Authors", and give it the default form "Author".

Enable links to forms
You add the text "This property uses the form Has default form::Form:Author." to the "Was written by" property's page.
 * (If your version of MediaWiki is lower than 1.13, you also need to make a small code change in MediaWiki to enable red-links to point to forms; see here.)

Add data
Using the new "Book" form, you create pages for some books; you check to make sure that both the form and the resulting pages look alright. Each book page will now have a red link to its author, that should point to the "Author" form for adding that author (you may need to refresh the page for the right link to show up). You can then add a few authors, either through these links or from the form page directly, to make sure that this setup works correctly too. Each created author's page should show a list of the books you've saved that have that person as the author.

Add links on sidebar and elsewhere
Your structures are now all set up, and you can add links to the sidebar for easy adding and viewing, by modifying the page 'MediaWiki:Sidebar' (or its equivalent if you're using a language other than English). You can add links to the "Book" and "Author" forms to make it easy to add new ones, and links to the "Books" and "Authors" categories to be able to see the full list of either one at a glance.

Add queries at member pages
No this was not forgotten and tacked on as an after-thought. It's simply easier to to add a query after you've populated some data. Otherwise you'd be doing so "blind" i.e. withou the benefit of visible and meaningful feedback.