SMW notes: Difference between revisions
Line 125: | Line 125: | ||
$smwgNamespacesWithSemanticLinks array | $smwgNamespacesWithSemanticLinks array | ||
== Multi language SMW == | |||
(From Temlakos on the mailing list regarding <http://creationwiki.org/ and http://creationwiki.org/fr/) | |||
Here's how I do it: As I have said many times before, I routinely | |||
declare all properties. And every declaration that is implemented in | |||
both languages, has the language-specific Interwiki prefix added, so | |||
that you can follow a property declaration from one language to the | |||
other and back. | |||
All that is involved is making parallel property declarations and | |||
placing Interwiki language links in each one. | |||
In general: a multilingual wiki is actually a family of wikis, each set | |||
up in its own language. | |||
The important part is to make sure that the SMW language files exist in | |||
each language in which you are planning to implement SMW. Right now the | |||
language support is a little thin, in comparison to the incredible | |||
multiplicity of languages on Wikipedia. So those of you who are trying | |||
to persuade Wikipedia to implement SMW across their project will have an | |||
immediate problem: you don't support more than a handful of the | |||
languages they use. | |||
... | |||
anyone who implements SMW in an unsupported language is going to have to | |||
write a language file. And make sure that his language is supported in | |||
SMW_Aliases.php and SMW_Messages.php. | |||
== Media == | == Media == |
Revision as of 13:14, 29 September 2009
Some tips and tricks for using Semantic Mediawiki from SMW mailing list, various web sites, etc.
Other tip sources
http://smwforum.ontoprise.com/smwforum/images/a/ad/Manual_SMW.pdf
http://smw.referata.com/wiki/Special:BrowseData/Tips
http://smwforum.ontoprise.com/smwforum/index.php/Example:All_libraries
http://help.wikia.com/wiki/Help:Semantic_MediaWiki/Tips_and_tricks
http://semantic-mediawiki.org/wiki/Image:SMW_quick_reference.pdf
Data design
http://www.mediawiki.org/wiki/Extension:Semantic_Forms#Data_design_issues
- Create a top category for Semantic Classes. I called mine 'Categories'. It holds only categories used to define a 'Is-a' relationship. Doing so has at least two benefits : 1- You can do a query on your core content by restricting it to the 'Categories' level. 2- You can define other categories outside of that structure for whatever your system needs.
Redirects can be used to create property synonyms.
Discussion
Categories can be hierarchical; properties can't (yet).
When to use categories vs properties?
MW tricks
If you want to clear out old pages you can delete them and use deleteArchivedRevisions.php to erase the deleted revisions from the database.
Variables
You can make use of the VariablesExtension [1] and store the query (or its result? I'd like to know which one, but in the end it doesn't really matter) in a variable, which is helpful when you need the same query multiple times within a page. It looks like this:
{{ #vardefine: some_variable_name | {{#show:{{PAGENAME}}| ?propertyname}} }} (silent) or {{ #vardefineecho: some_variable_name | {{#show:{{PAGENAME}}| ?propertyname}} }} (with output)
Further down in the page you can write
{{ #var: some_variable_name }}
Specific searches
<inputbox> type=search width=30 namespaces=Help**,Wikipedia**,Template** searchbuttonlabel=Search help pages bgcolor=#cee0f2 break=no </inputbox>
(requires the Input Box extension)
Profiling mediawiki
http://www.mediawiki.org/wiki/How_to_debug#Profiling
Mediawiki performance tuning
http://www.mediawiki.org/wiki/Manual:Performance_tuning
- APC can be used with SMW without problems
SMW tricks
[[Went past deadline::{{#expr:{{{End date|}}}>{{{Deadline|}}} }}]]
Hiding set data
[[propertyA::{{{propertyA|}}}|]]
By adding the | after the enclosing }}}, the property value will not show.
For multi value properties:
{{#arraymap:{{{Eating disorders behaviors|}}}|,|x|[[Eating disorders behaviors::x|]]}}
(why not just use #set?)
Protecting #ask results
(from Markus Kr?tzsch)
- make a new property "has checked" of type page,
- make and a new page "main page news editor" (or whatever) and protect this page just like your main page,
- add an entry [[has checked::some page]] on "main page news editor" for every page that the editor has found to be okay to make it on the main page news feed,
- extend your #ask query on the main page with the condition [[-has checked::main page news editor]].
... Note that you can also have a group of editors with separate (protected) pages. You can also work with categories of editors for different topics etc. Of course, this is no longer a spam protection since categories are not protected either, but you can use another level of "has checked" to have a master editor who checks other editors to grant them trust. All of this readily works with subqueries+inverses. Applying similar methods but without actually protecting any pages maybe still be useful for managing feeds together in cases where spam is not a major issue.
Misc
Enable links in property values
$smwgLinksInValues = true;
Must add namespaces to config
Otherwise they won't have semantic properties.
$smwgNamespacesWithSemanticLinks array
Multi language SMW
(From Temlakos on the mailing list regarding <http://creationwiki.org/ and http://creationwiki.org/fr/)
Here's how I do it: As I have said many times before, I routinely declare all properties. And every declaration that is implemented in both languages, has the language-specific Interwiki prefix added, so that you can follow a property declaration from one language to the other and back.
All that is involved is making parallel property declarations and placing Interwiki language links in each one.
In general: a multilingual wiki is actually a family of wikis, each set up in its own language.
The important part is to make sure that the SMW language files exist in each language in which you are planning to implement SMW. Right now the language support is a little thin, in comparison to the incredible multiplicity of languages on Wikipedia. So those of you who are trying to persuade Wikipedia to implement SMW across their project will have an immediate problem: you don't support more than a handful of the languages they use.
... anyone who implements SMW in an unsupported language is going to have to write a language file. And make sure that his language is supported in SMW_Aliases.php and SMW_Messages.php.
Media
Neat talk on MW, with refs to SMW: http://www.youtube.com/watch?v=Ukytqe9pwDM