Last modified: 2009-11-03 14:30:10 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T16464, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 14464 - n-ary data in queries to templates
n-ary data in queries to templates
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Markus Krötzsch
http://reformedword.org
:
Depends on: 16571
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-07 17:58 UTC by Robert Murphy
Modified: 2009-11-03 14:30 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Robert Murphy 2008-06-07 17:58:35 UTC
With format=template, one has no control over the individual field values passed to your template, it's just the wiki text of each item. In the case of n-ary data, the individual pieces are passed in one, gigantic parameter to the template.  One doesn't get the individual pieces of a many-valued property. Someone might want to get the number and units of a linear value separately.  The current work around is to install 4+ other extensions and chop of the string and put it in a kind of array.  

So, if inline queries had a new "parts=exploded" option to send the same individual elements of each value to a template, we would have more formatting control.  This would make accessing parts of n-ary data much simpler and not force SMW users to be dependent on so many other extensions of unknown future viability.
Comment 1 S Page 2008-06-09 22:15:29 UTC
As I wrote in message "[Semediawiki-user] enhancement: explode format in query results", it seems like the implementation of this feature could reuse datavalues' existing ability to provide their parts in response to getServiceLinkParams().

It's not as simple as it sounds.  E.g. some parts that datatypes return 
for service links are URL-encoded because service links are specifically 
for fabricating hyperlinks.
Comment 2 Robert Murphy 2008-06-10 03:36:34 UTC
Yeah, to be usable by templates, all linking would have to be stripped.
As one can see at http://sandbox.semantic-mediawiki.org/wiki/Comparison_shop, it would be far more useful to split output into individual data points: instead of {{{1}}} being "Best Buy" and {{{2}}} being "[[An Inconvenient Truth]] (20 USD), [[Babel]] (21 USD), [[The Matrix]] (25 USD)", I'm asking for {{{1}}} to be "Best Buy" and {{{2}}} to be "An Inconvenient Truth", {{{3}}} to be "20 USD", {{{4}}} to be "Babel", {{{5}}} to be "21 USD", etc. etc.
Would that be very complicated?  It seems like it would just be a matter of returning each part of an n-ary according to it's type.
Comment 3 Robert Murphy 2008-06-22 20:06:22 UTC
Perhaps this would be more helpful:

== Pseudocode ==
# Compile the n-ary data as normal to be sent to the template
# Create an array for each n-ary property
# Set array to the values obtained by splitting on "),"
# Split each array element on ","
# Split the first element in each array on "("
# Send each element of each array in turn as the next parameter, along with other data

Comment 4 Siebrand Mazeland 2008-08-11 11:05:30 UTC
Re-assign to extension developer for triage/comments.
Comment 5 Markus Krötzsch 2008-12-05 19:25:15 UTC
My preferred solution would be to be able to specify printouts not only for all parts of a multi-valued property, but also for selected components. Doing this, you could emulate your solution by just using multiple printouts, each for one of your data items. On the other hand, you could also customise the whole output to use only some of the components at all.

The implementation of this depends on Bug 16571.
Comment 6 Markus Krötzsch 2009-11-03 14:30:10 UTC
It is now possible to write "|+index=value" after some print request for multi-valued properties to obtain only one of the parts. Indexes range from 1 to the number of values that the property takes. This can be used to pass individual values to some template result formatter as well. The bug will thus be closed, although some open issues remain for printout parameters in general (see Bug 16571).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links