Help talk:Array format

From semantic-mediawiki.org

Is the template {{#smwdoc:array}} intended to be commented out[edit]

Is the template {{#smwdoc:array}} intended to be commented out in the section Parameters? Thanks. --Linforest 05:51, 13 March 2012 (CET)

At the time this help page was written, #smwdoc was not yet available for this result format. It works in the meantime, but so far #smwdoc has some shortcomings which I believe need to be adressed first when it comes to this format: See here for some improvements what need to be done. Cheers --[[kgh]] 16:04, 13 March 2012 (CET)
Thanks, kgh. Cheers --Linforest 17:51, 13 March 2012 (CET)

sep parameter working all right?[edit]

Hi, it seems that the 'sep' parameter is not doing anything. Could that indeed be the case?

--Ad Strack van Schijndel 13:26, 8 May 2012 (CEST)

... in a way most suitable for further processing by MediaWiki templates or parser functions[edit]

If I understand this correctly, you can use a template to post-process the query. For instance, if property values contain commas, you can use the array format to separate the results with symbols other than commas (e.g. using semi-colons) and the template format to process the results. For instance:

{{#ask: ....
|link=none
|format=array
|sep=;
|template= <sometemplate>
|userparam=...
}}

Yet there is nothing in the documentation about templates and I haven't succeeded to make it work either. If something else is meant by the lede, then please rephrase. Cavila 11:26, 18 May 2012 (CEST)

I just found out that the array format, even if it works, is not actually necessary for the function I just outlined. In fact, the process that once involved delimiting results and using arraymap in a template to define a new separator appears to have changed in ways I don't yet grasp. Cavila 12:10, 18 May 2012 (CEST)
This has nothing to do with the template parameter. The sentence just says that the format is very handy for having a query result in a format suitable for templates. Templates would just have to deal with arrays rather than doing a lot of string magic. --Daniel A. R. Werner (talk) 20:30, 17 October 2012 (CEST)

Contents

Thread titleRepliesLast modified
Documentation Issues111:38, 21 December 2020
Uniqueness of Query Results104:11, 20 October 2012

Documentation Issues

Maybe it's just me, but I don't really follow this article.

For example, you have:

  • propsep - Separator between the requested properties per page
What are the properties?
  • manysep - Separator between many valued property values
what are many valued property values?

It would also be nice to have some examples on the page.

The reason it's important to me, is becuase I have a query

{{#ask: [[{{FULLPAGENAME}}]]|?has person |link=none |mainlabel=- |headers=hide |format=array |sep=,}}

which results with person one<MANY>person two.

I just feel like I don't have enough context in this article to figure out why it's not giving me a normal array.

08:06, 21 December 2020

The array format is in a way "special". It may very well be that the updates of SMW 3.0 changed the behaviour of this result format. The docu definitively predates that version. Currently I do not have the time to dig into this. Perhaps someone on the mailing list uses the format and would like to help. Also adding examples to the sandbox wiki is always good when requesting help. Prevents swimming in the dry.

Many valued properties are properties of type Record.

11:38, 21 December 2020
 

Uniqueness of Query Results

Playing with the Array SRF I found that if a query result returns a list of values from a page that contains a multi-valued property, then the entire string is returned as a single value instead of a list of values that get merged into the named array.

To overcome this I return query results as a list and put the query inside the array definition, as the list of array values.

You can see an example of the difference on stratchpad.Referata, here.

15:56, 20 August 2012

I am not quite sure I understand what you mean. If there are multi-valued property results in the array, they have to share one array element, yes. But within that element, they are separated by the manysep. So if you set manysep=,, print the result array into a new array definition which uses "," as separator + unique option, then you should get your desired array. Anyhow, please take a look at http://scratchpad.referata.com/wiki/Front-wheel_drive again and tell me wether that solution is sufficent now :) I use <SEP> as separator there because it will allow you to have "," within the property values.

23:07, 19 October 2012