Discuss Help:Setting values using #set
Please note that using the {{#set:}} parser function, while it hides links on the subject page, if the page is transcluded via an embed query, the property that has been set with {{#set:}} will be transcluded as well--the same is not true of properties wrapped in a conventional hidden link, e.g., [[Some property::object page| ]].
Developers, please allow this behavior to continue, as it is very desirable and offers a great deal of flexibility! Edited 2011-02-10 in response to this email thread
--Alex 19:48, 9 February 2011 (CET)
VERY IMPORTANT NOTE[edit]
The above behavior has been reported and acknowledged as a bug, not a feature. Therefore, for the time being, you must either wrap your {{#set functions in noinclude tags or mark them as silent annotations, e.g., [[Property::value| ]] --Alex 19:36, 10 February 2011 (CET)
- [View source↑]
- [History↑]
Contents
Thread title | Replies | Last modified |
---|---|---|
Setting multiple values in one turn | 1 | 23:13, 2 January 2016 |
Template parameter | 2 | 04:40, 17 March 2015 |
Practical example | 2 | 18:21, 24 January 2015 |
parser in #set | 13 | 00:16, 7 January 2013 |
Dabbling a little bit with some old templates of mine I found out that
{{#set: |property1=value1|value2|value3 |property2=value1|value2|value3 ... }}
can be used to store multiple values for one property. Since I did not find any mention of it as I wanted to confirm this, I would like to ask, whether this is a solid feature (and remains so) or is it unwanted and will be removed somewhen?
I still don't get it.
> I still don't get it.
Well then you probably don't need it but some background can be found at [0].
[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/756
Now I get it. This is meant to enable adding some fancy formatting or navigation to semantic infoboxes.
This is really an important task. In my projects, I solve it with regular expressions, which is really costly.
But I don't think that {{#set:}}
, originally meant for silent annotations, should be charged with it.
Also, I think that parsing passed values is not about splitting their lists only. This is more complex task involving dealing with alternative texts (after |), footnotes and other accompanying text.
Hi, don't want to abuse this for self-marketing but as for us it would be helpful to see practical examples of how certain features can be used I thought we could also help others by adding something like this to the description:
Enter a new replication to the ReplicationWiki [1] [2]
What do you think?
Any example or use case that brings feature sets nearer to a user is welcome and appreciated. We have a new page called Use cases that is actually meant for this sort of purpose. You might want to describe your scenario in two or three sentences and link to the resource that contains your use case.
Thank you, the use cases are very helpful! They give general ideas about what kind of wikis are in use for what kind of purposes. What I was thinking of was more concrete examples of specific features, so links to specific pages in wikis where the features are used, not to wiki main pages (unless the features are used on the main pages). What I saw now is that I am at the wrong page here anyways because we don't set values like described on this help page here but with features of the forms extension, and how this works is described on the help pages of that extension. I now asked there. Sorry for the confusion.
Dear friends! I use SMW in my origami wiki. In version SMW 1.5 and SemanticResultFormats 1.5 I can use Wiki syntax with parser in #set
property for model - text. See here property on russian (описание модели)
On page in gallery caption I get wiki text
After update to version SMW 1.7.1 and SemanticResultFormats 1.7.1 now property model is empty.
Can you help me, how I can use parser and wiki syntax in my property for caption.
Thanks
This is the code that sets the property:
{{#set:Описание модели={{{!}} class="oritable" width="100%" {{!}}- {{!}}{{#if:{{{шагов|}}}|({{{шагов|}}})|}} ''{{{название модели|}}}'' {{#if:{{{opus|}}}|(op.{{{opus|}}}{{#if:{{{ver_opus|}}}| v.{{{ver_opus|}}}|}}{{#if:{{{num_opus|}}}|-{{{num_opus|}}}|}})|}} {{#if: {{{konkurs|}}}|([[{{{konkurs|}}}{{!}}{{{num_tur|}}} тур]])|}} {{!}}- {{!}}{{#if:{{{источник|}}}|[[{{{источник|}}}]]|~ ~ ~}} {{#if:{{{страница|}}}|(стр.{{{страница|}}})}} {{#if:{{{источники|}}}|{{!}}- {{!}} & ({{#arraymap:{{{источники|}}}|,|x|[[x]]}})}} {{#if:{{{автор|}}}|{{!}}- {{!}}[[{{{автор|}}}]]}} {{#if:{{{addtomodel|}}}|{{!}}- {{!}}({{{addtomodel|}}}{{#if:{{{formattomodel|}}}| + {{{formattomodel|}}}}})|}} {{!}}} }}
It is called from within a template hence the named parametres.
This wikicode is almost undebuggable. Sir, I can only suggest:
- copy it into a separate template, check its calls with different combinations of empty and non-empty parametres, and comment out fragments of the template (using binary search) until the source of trouble is found;
- replace wiki markup for the table with pure HTML;
- upgrade to the last stable versions of MW and SMW.
Thanks for reply!
1. First, I am upgrade wiki to v.1.20 and SMW to 1.8. - my query not displayed. Now I use on local SMF 1.7.1
2. Yes, I did it. And find problem with parser
{{#set:Описание модели= ''{{{название модели|}}}'' }} - work is good
{{#set:Описание модели= {{#if:{{{var|}}}|({{{var|}}})|}} ''{{{название модели|}}}'' }} - not worked. Property is empty.
If you have SMW > 1.7 - Can you check it out with parser function {{#if:{{{var|}}}|({{{var|}}})|}}
Thanks
If {{{название модели|}}} is empty, the apostrophes are interpreted as ''' ' and therefore unbalanced. Try replacing them with <em>. Not that I hope it would help (in a wiki I checked it in, the property was set anyway).
You could also try to replace emptyness in the else branch of the {{#if:}} call with a space or, better, <nowiki></nowiki>. {{#set:}} might break on empty substrings.
Worst of all, {{#set:}} may be called before {{#if:}}, not after as expected.
Видно, мне это не по силам сообразить. Перепробовал массу вариантов, и последовательно обновлял вики и SMF. Не сочтите за наглость - обратился к вам за помощью через http://www.formspring.me.
Попробую еще убрать апострофы.
Anyway, look here. It works. So I recommend to upgrade anyway (don't forget to run the upgrade scripts for MW and SMW).
Действительно, работает. Большое спасибо. Я обновляю как раз-таки через web-интерфейс. Видимо в этом и кроется пробема. А по другому у меня не получится - я делаю все на локалке (windows). Или можно как-то по другому обновить (руководство по обновлению читал)
Тогда учтите, что семантические данные обновляются не мгновенно, а посредством рабочих заданий, что может привести ко временному отсутствию результатов в запросах SMW, пока данные не перегенерируются. Кстати, недавно в этой вики обсуждался вопрос (ссылки не могу найти) обновления, когда доступен только веб-интерфейс. Кажется, написали даже страницу справки. У кого-то тоже были затруднения.
Вообще, для полноценного администрирования вики его недостаточно. Подумайте об организации доступа через удалённый рабочий стол или по telnet.
You also should make sure that, after the upgrade, SMW still understands that Описание модели is still of Text type. Merry Christmas.