Thanks for this tip Yaron (and thanks for the pointer to the vid). For
some reason I didn't think of storing the 'display-version' of the
property, but it makes sense.


On 31 October 2011 14:39, Yaron Koren <ya...@wikiworks.com> wrote:
> Hi,
>
> This seems like good timing, because Markus gave a good talk at the
> most recent SMWCon, in Berlin, that included a discussion about
> template queries; and that talk has been uploaded, so you can see it
> here:
>
> http://www.youtube.com/watch?v=e0DI_GyIBbw
>
> (Not all of the videos from last month's SMWCon have been uploaded yet
> - there will hopefully be another email sent out when that happens.)
>
> Anyway, the relevant recommendation from that talk is, instead of
> using additional templates, to add to the template where the data is
> stored a silent property like "Has query display", that stores the
> wiki-text for that record in the query result, and then just display
> that in the query. (You would still need to put the table header and
> footer around the query itself, if you wanted to show the results as a
> table.) This approach might not be as slick-looking as direct inline
> formatting of the results, but performance-wise, it's quite a bit more
> efficient than any of the three options mentioned before.
>
> -Yaron
>
> On Sat, Oct 29, 2011 at 2:50 PM, Dan Bolser <dan.bol...@gmail.com> wrote:
>> I like this idea too. However, I suspect it will be hard to get MW to
>> ignore {{{#n}}} just for the purposes of SMW.
>>
>> Is there a cleaner way to 'inline' a format template in the query?
>>
>> I totally agree that creating two or three templates for one ask query
>> is the main reason that template format is a pain.
>>
>>
>> Cheers,
>> Dan.
>>
>> On 28 October 2011 23:18, Jon Lang <datawea...@gmail.com> wrote:
>>> Dan Bolser wrote:
>>>>
>>>> Hi,
>>>>
>>>> Currently we have tabular format results and, if we want
>>>> customization, we have 'template' format results.
>>>> * Tabular format is great, but is quite inflexible.
>>>> * Template format is very flexible, but complex, hard to develop and
>>>> maintain.
>>>>
>>>> I'd like to suggest a half way house for simple column based tabular
>>>> formatting. Something along the lines of the following:
>>>>
>>>> {{#ask: [[My Cat]]
>>>>  |? My prop 1 # Template for p1
>>>>  |? My prop 2 # Template for p2
>>>>  |? My prop 3
>>>>  |? My prop 4 = P4
>>>> }}
>>>>
>>>> For each row, this would call the template 'Template for p1' with just
>>>> one parameter, the value for 'My prop 1'. The resulting wikitext would
>>>> then be passed back for regular tabular layout. As implied, these 'per
>>>> column' templates could be mixed with 'unadorned' values, that would
>>>> appear just as in regular tabular output.
>>>>
>>>> This would be a much lighter and easier way to 'tweak' the results of
>>>> tabular format without going to the full blown (and sometimes
>>>> unpopular) template format.
>>>>
>>>> I've posted here for discussion, but we can start a feature request
>>>> instead.
>>>>
>>>
>>> I like this idea, and would like to piggyback a suggestion of my own here.
>>>
>>> Sometimes, the reason why the template format is unpopular is because it is
>>> overkill.  For instance, if you're only going to be formatting a single
>>> #ask, creating a full template page for it seems like a bit much.  I'd like
>>> to see an "inline" result format that works just like the template result
>>> format except that it embeds the template directly into the query.  For
>>> example:
>>>
>>> {{#ask: [[Category:City]] [[Area::+]] [[Population::+]]
>>>   | ?Population=Inhabitants
>>>   | ?Area#km²=Size in km²
>>>   | format=inline
>>>   | inline={{{#2}}} people squeeze into the {{{#3}}} of {{{#1}}}.
>>>   | limit=3
>>> }}
>>>
>>> The hash marks inside the triple-curlies are to distinguish these "inline
>>> template" parameters from any regular template parameters that may be in
>>> play if the #ask appears on a template page.
>>>
>>> This is germane to Dan's proposal in that I would recommend inline templates
>>> for what he's suggesting rather than regular templates:
>>>
>>> {{#ask: [[My Cat]]
>>>   |? My prop 1 # format string for p1
>>>   |? My prop 2 # format string for p2
>>>   |? My prop 3
>>>   |? My prop 4 = P4
>>> }}
>>>
>>> As with my "inline result format" suggestion above, the value for each
>>> cell's format would be specified as {{{#1}}}.  So:
>>>
>>> {{#ask: [[Category:City]] [[Area::+]] [[Population::+]]
>>>   | ?Population=Inhabitants # {{{#1}}} people
>>>   | ?Area#km²=Size in km²
>>>   | limit=3
>>> }}
>>>
>>> would produce something like:
>>>
>>> {|
>>> ! Inhabitants !! Size in km²
>>> |-
>>> | Berlin || 3,391,409 people || 891.85 km²
>>> |-
>>> | Frankfurt || 679,664 people || 248.31 km²
>>> |-
>>> | Karlsruhe || 285,812 people || 173.46 km²
>>> |}
>>>
>>> If you wish to utilize an actual template page, you can do so using the
>>> regular wiki syntax for including a template; the only catch is that I think
>>> that you'd have to explicitly pass the value into the template:
>>>
>>> {{#ask: [[My Cat]]
>>>   |? My prop 1 # {{template for p1|{{{#1}}}}}
>>>   |? My prop 2 # {{template for p2|{{{#1}}}}}
>>>   |? My prop 3
>>>   |? My prop 4 = P4
>>> }}
>>>
>>> --
>>> Jonathan "Dataweaver" Lang
>>>
>>
>> ------------------------------------------------------------------------------
>> Get your Android app more play: Bring it to the BlackBerry PlayBook
>> in minutes. BlackBerry App World&#153; now supports Android&#153; Apps
>> for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple
>> it is! http://p.sf.net/sfu/android-dev2dev
>> _______________________________________________
>> Semediawiki-user mailing list
>> semediawiki-u...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>>
>
>
>
> --
> WikiWorks · MediaWiki Consulting · http://wikiworks.com
>

------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World&#153; now supports Android&#153; Apps 
for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to