SMW notes: Difference between revisions

5,581 bytes added ,  19 April 2011
Undo revision 3647 by Osejisycym (talk)
No edit summary
(Undo revision 3647 by Osejisycym (talk))
 
(21 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Some tips and tricks for using Semantic Mediawiki from SMW mailing list, various web sites, etc.
Some tips and tricks for using Semantic Mediawiki from SMW mailing list, various web sites, etc.
== Workshops, tutorials, etc ==
* [[Semantic Mediawiki workshop]]
* [[Encouraging SMW use with non technical people]]
* [[Semantic Mediawiki compared with Drupal and content management systems]]
* [https://dya-knowledge.sogeti.nl/dir/DyA_Infrastructure_decomposition_and_modeling information modelling]


== Other tip sources ==
== Other tip sources ==
http://semantic-mediawiki.org/wiki/FAQ


http://smwforum.ontoprise.com/smwforum/images/a/ad/Manual_SMW.pdf
http://smwforum.ontoprise.com/smwforum/images/a/ad/Manual_SMW.pdf
Line 12: Line 21:


http://semantic-mediawiki.org/wiki/Image:SMW_quick_reference.pdf
http://semantic-mediawiki.org/wiki/Image:SMW_quick_reference.pdf
http://www.organicdesign.co.nz/MediaWiki_code_snippets (mediawiki)
http://smw.referata.com/wiki/Overview_of_Semantic_MediaWiki_and_Semantic_Forms


== Data design ==
== Data design ==
Line 29: Line 42:
== Discussion ==
== Discussion ==


Categories can be hierarchical; properties can't (yet).
Categories can be hierarchical; properties can't (yet) - actually they can be, using subproperty of.


When to use categories vs properties?


== MW tricks ==
== MW tricks ==
Line 45: Line 59:
a page. It looks like this:
a page. It looks like this:


  {{ #vardefine: some_variable_name | {{#show:{{PAGENAME}}| ?propertyname}} }}
  <nowiki>{{ #vardefine: some_variable_name | {{#show:{{PAGENAME}}| ?propertyname}} }}
(silent) or
(silent) or
  {{ #vardefineecho: some_variable_name | {{#show:{{PAGENAME}}| ?propertyname}} }} (with output)
  {{ #vardefineecho: some_variable_name | {{#show:{{PAGENAME}}| ?propertyname}} }} (with output)</nowiki>


Further down in the page you can write
Further down in the page you can write


  {{ #var: some_variable_name }}
  <nowiki>{{ #var: some_variable_name }}</nowiki>


=== Specific searches ===
=== Specific searches ===
Line 71: Line 85:


http://www.mediawiki.org/wiki/How_to_debug#Profiling
http://www.mediawiki.org/wiki/How_to_debug#Profiling
== Semantic Mediawiki performance ==
http://www.snpedia.com/index.php/Special:Statistics
20,000 pages, 132,00 property values for 60 properties


=== Mediawiki performance tuning ===
=== Mediawiki performance tuning ===
Line 81: Line 101:


<nowiki>[[Went past deadline::{{#expr:{{{End date|}}}>{{{Deadline|}}} }}]]</nowiki>
<nowiki>[[Went past deadline::{{#expr:{{{End date|}}}>{{{Deadline|}}} }}]]</nowiki>
=== Remote data ===
Philipp writes:
if you want to query an SMW installation from remote and re-use the results in
other applications, I recommend checking out our [http://smwforum.ontoprise.com/smwforum/index.php/Help:Basic_Triplestore Triplestore Connector]. It delivers the results as XML format (compliant with the SPARQL recommendation).
If you want to query semantic data in your wiki, coming from another SMW
installation you should take a further look at the [http://projects.csail.mit.edu/wibit/wiki/index.php?title=Wibit Exhibit result printer].
[http://www.basil-ell.de/data_integration/ Freebase query]


=== Hiding set data ===
=== Hiding set data ===
Line 91: Line 123:


   <nowiki>{{#arraymap:{{{Eating disorders behaviors|}}}|,|x|[[Eating disorders behaviors::x|]]}}</nowiki>
   <nowiki>{{#arraymap:{{{Eating disorders behaviors|}}}|,|x|[[Eating disorders behaviors::x|]]}}</nowiki>
(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 <nowiki>[[has checked::some page]]</nowiki> 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 <nowiki>[[-has
checked::main page news editor]]</nowiki>.
... 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 ==
== Misc ==
Line 103: Line 156:


$smwgNamespacesWithSemanticLinks array
$smwgNamespacesWithSemanticLinks array
=== Enable links in property values ===
$smwgLinksInValues = true;
== Dark background theme css ==
http://software.wikia.com/wiki/User:Ose/SMW.css
== Multi language SMW ==
=== Creationwiki ===
(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.
=== HKp wiki ===
'HKp wiki' is  a bilingual (potentially multilingual) spanish-catalan
wiki in the same installation.
http://enlloc.net/hkp/w
I'm using Polyglot extension [1] to redirect to appropriate language
pages depending on the browser language settings or the user wiki
settings.
I'm using Language Selector extension for providing a language
selector for every page in the sidebar.
I wanted to use the Multilang extension for changing the language in
pages and forms depending on the user settings. But unfortunately this
extension don't work in MW higher of 1.10.
Alternatively I'm using the [http://enlloc.net/hkp/w/index.php/Plantilla:International <nowiki>{{international}}nowiki> template]. It is useful
for pages and templates but not for forms because it need a
<nowiki>{{SUBPAGENAME}}</nowiki> with language code (/ca, /es, /en, /fr, /pt, ...).
I'm using [http://enlloc.net/hkp/w/index.php/Plantilla:Entrada_Wlog my own code in templates] to show or hide a "translation
button" depending if the translation page exist or not:
  <nowiki>{{#ifeq:{{SUBPAGENAME}}|es|
{{exists | page={{NAMESPACE}}:{{BASEPAGENAME}}/ca | then= | else=
<p style="margin-top:2em; color: rgb(100, 100, 100)">'''Traducci?n'''<br>[[Categoria:Per traduir al Castell?]]
<small>Esta p?gina a?n no est? en catal?n. Quieres colaborar a traducirla?</small></p>
{{#formlink:Entrada Wlog traduir ca|Traducir al catal?n|button|
preload={{FULLPAGENAME}}&Gesti? traduccions[p?gina
original]={{BASEPAGENAME}}&Entrada Wlog[llengua entrada]=es&namespace=Wlog }}
}}
}}</nowiki>
Right now I have not solution for having only one form for all
languages. What is annoying.


== Media ==
== Media ==
Anonymous user