Difference between revisions of "Wikispooks:Semantic Templates"
(Semantic Output Templates) |
(t) |
||
Line 27: | Line 27: | ||
==Semantic Output Templates== | ==Semantic Output Templates== | ||
− | SMW has a ''{{t|template}}'' format, which allows use of a custom template to format results. Since this is more work, it is applied usually only on high traffic and/or specialist pages where the standard output formats fall short. As a consequence, these templates are usually quite specific, not general use. For general convenience, semantic web output templates should be placed in [[:Category:Semantic Output Templates] and named as a subpage "output" of the template for which they were developed. | + | SMW has a ''{{t|template}}'' format, which allows use of a custom template to format results. Since this is more work, it is applied usually only on high traffic and/or specialist pages where the standard output formats fall short. As a consequence, these templates are usually quite specific, not general use. For general convenience, semantic web output templates should be placed in [[:Category:Semantic Output Templates]] and named as a subpage "output" of the template for which they were developed. |
==See Also== | ==See Also== |
Revision as of 07:59, 19 September 2014
Although semantic properties can be added inline in text, this is cumbersome and unsystematic so should be used only for testing purposes. All the SMW data on Wikispooks pages is input through WikiSpooks:templates.
Contents
Object Orientation
- Full article: WikiSpooks:Semantic Objects
- Full article: WikiSpooks:Semantic Objects
The templates are structured around a set of objects. Each object its own set of semantic properties and accompanying template to mark process them. Some are displayed to the user, some are not. As of March 2014, the objects as currently defined, in descending order of completion are: Document, Website, Property, Person, Group, Event,Place, Operation
Syntax
A 'semantic template' is just a template which uses semantic mediawiki, whether for reading or writing properties. The basic parser directives you'll need are:
- #ask: & #show: For querying properties
- #set: For setting properties
- #arraymap: & #arraymaptemplate: For handling (usually comma-separated) lists
A helpful summary of syntax is the quick reference guide, available here.
Multiple Values for Fields
Some parameters can take multiple values (e.g. an article can have more than one author) and at least 3 approaches to this are tried and tested. Which method(s) would work best for Wikispooks is an open question.
Numbered Fields
The first approach used on Wikispooks was to have a set of numbered parameters, e.g Author, Author2, Author3 etc. This is straightforward but does not make full use of the facilities provided by SMW software and does makes for long, ugly templates. Some templates and forms still use this method.
Lists
The current preferred approach stores the data as separate items in a comma-separated list. This means that ',' should not be used in page titles. These lists are easily processed with the '#arraymap:' and '#arraymaptemplate:' parser instructions.
Note that the processing of two properties (Has keyProperties and Has keyPropertyHeaders) is too complex to be done with either #arraymap: or #arraymaptemplate: (since it is not done independently) so #titleparts: is needed instead, which requires use of slash(/)-separated lists.
Multiple Templates
Another approach is the use of multiple templates. This is not used on WikiSpooks, but may be seen in action at DiscourseDB, a site run by Yaron Koren, the key developer of SMW. This appears better supported as regards input (try adding multiple Wikipedia items on the DiscourseDB site, for example) but could lead to quite messy page source if applied to the large objects already developed at Wikispooks.
Semantic Output Templates
SMW has a template format, which allows use of a custom template to format results. Since this is more work, it is applied usually only on high traffic and/or specialist pages where the standard output formats fall short. As a consequence, these templates are usually quite specific, not general use. For general convenience, semantic web output templates should be placed in Category:Semantic Output Templates and named as a subpage "output" of the template for which they were developed.
See Also
- http://semantic-mediawiki.org/wiki/Help:Semantic_templates - The SMW official (and good) documentation on semantic templates
| ||||||
|