SMW notes: Difference between revisions
Jump to navigation
Jump to search
Undo revision 3647 by Osejisycym (talk)
Osejisycym (talk | contribs) No edit summary |
(Undo revision 3647 by Osejisycym (talk)) |
||
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. | ||
Line 67: | Line 59: | ||
a page. It looks like this: | a page. It looks like this: | ||
<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 | ||
<nowiki>{{ #var: some_variable_name }}</nowiki> | |||
=== Specific searches === | === Specific searches === | ||
<nowiki> | |||
<inputbox> | |||
type=search | type=search | ||
width=30 | width=30 | ||
Line 85: | Line 77: | ||
bgcolor=#cee0f2 | bgcolor=#cee0f2 | ||
break=no | break=no | ||
</inputbox> | |||
</nowiki> | |||
(requires the Input Box extension) | (requires the Input Box extension) | ||
Line 108: | Line 100: | ||
== SMW tricks == | == SMW tricks == | ||
<nowiki>[[Went past deadline::{{#expr:{{{End date|}}}>{{{Deadline|}}} }}]]</nowiki> | |||
=== Remote data === | === Remote data === | ||
Line 124: | Line 116: | ||
=== Hiding set data === | === Hiding set data === | ||
<nowiki>[[propertyA::{{{propertyA|}}}|]]</nowiki> | |||
By adding the | after the enclosing }}}, the property value will not show. | By adding the | after the enclosing }}}, the property value will not show. | ||
Line 130: | Line 122: | ||
For multi value properties: | For multi value properties: | ||
<nowiki>{{#arraymap:{{{Eating disorders behaviors|}}}|,|x|[[Eating disorders behaviors::x|]]}}</nowiki> | |||
(why not just use #set?) | (why not just use #set?) | ||
Line 138: | Line 130: | ||
(from Markus Kr?tzsch) | (from Markus Kr?tzsch) | ||
* make a new property | * make a new property "has checked" of type page, | ||
* make and a new page | * make and a new page "main page news editor" (or whatever) and protect this page just like your main page, | ||
* add an entry | * 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 | * extend your #ask query on the main page with the condition <nowiki>[[-has | ||
checked::main page news editor]] | checked::main page news editor]]</nowiki>. | ||
... Note that you can also have a group of editors with separate (protected) | ... 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. | 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 | Of course, this is no longer a spam protection since categories are not | ||
protected either, but you can use another level of | 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 | master editor who checks other editors to grant them trust. All of this | ||
readily works with subqueries+inverses. Applying similar methods but without | readily works with subqueries+inverses. Applying similar methods but without | ||
Line 221: | Line 213: | ||
extension don't work in MW higher of 1.10. | extension don't work in MW higher of 1.10. | ||
Alternatively I'm using the [http://enlloc.net/hkp/w/index.php/Plantilla:International | 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 | 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 | 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 | button" depending if the translation page exist or not: | ||
<nowiki>{{#ifeq:{{SUBPAGENAME}}|es| | |||
{{exists | page={{NAMESPACE}}:{{BASEPAGENAME}}/ca | then= | else= | {{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| | {{#formlink:Entrada Wlog traduir ca|Traducir al catal?n|button| | ||
preload={{FULLPAGENAME}}& | preload={{FULLPAGENAME}}&Gesti? traduccions[p?gina | ||
original]={{BASEPAGENAME}}& | original]={{BASEPAGENAME}}&Entrada Wlog[llengua entrada]=es&namespace=Wlog }} | ||
}} | }} | ||
}} | }}</nowiki> | ||
Right now I have not solution for having only one form for all | Right now I have not solution for having only one form for all |