Page MenuHomePhabricator

parser function #ask / behaviour change when querying for one page (1.8 alpha)
Closed, InvalidPublic

Description

Since probably SMW 1.7.0 the behaviour of #ask changed when querying for one page, e.g.

{{#ask: [[Berlin]]

| ?
| ?Population
| ?Area#km²
| format=template
| template=Query output demo

}}

produced "3,391,409 people squeeze into the 891.85 km² of Berlin." in SMW <1.7+, now it produces "Berlin people squeeze into the 3,391,409 of Berlin." SMW >1.7+

As you do this with #show

{{#show: Berlin

| ?
| ?Population
| ?Area#km²
| format=template
| template=Query output demo

}}

nothing changed: "3,391,409 people squeeze into the 891.85 km² of Berlin."

A work-around would be

{{#ask: [[Berlin]]

| ?Population
| ?Area#km²
| format=template
| template=Query output demo

}}

or

{{#ask: [[Berlin]]

| mainlabel=-
| ?Population
| ?Area#km²
| format=template
| template=Query output demo

}}

This may be inspected on [1].

I do not know if this is a bug since there are other ways to get the intended results. However I do not know if this was done intentionally since it breaks consistency between #ask and #show.

[1] http://semantic-mediawiki.org/wiki/Help:Template_format


Version: unspecified
Severity: minor

Details

Reference
bz35211

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:18 AM
bzimport set Reference to bz35211.
bzimport added a subscriber: Unknown Object (MLST).
Kghbln created this task.Mar 13 2012, 11:02 PM

Markus, did you change anything that might have caused this? I'm thinking of the "allow for duplicate printouts" change.

I actually remember fixing something like this two or there months back. Not sure if it broke again or if this is something else...

Heiya Markus, just a tiny assessment like "intentional / unintentional" and "will be changed / will not be changed" on this would be cool. Cheers Karsten

I think this is correct behaviour. If you add "?" as a printout request, you probably want to have it in the results, don't you? If the user explicitly adds "?", why should SMW ignore it? Or am I missing something?

There was definitively a change in behaviour to the #ask parser function in SMW 1.7.0.

My assessment is that #ask was made consistent ("fixed"). Before there was a difference between querying for just one page and querying for multiple pages (which may of course have only one page as a result). The specified page is now considered as the result of the query, too.

<1.7:

{{#ask: [[Berlin]] |? }} → Berlin
or
{{#ask: [[Category:City]] }} → Berlin (in case only Berlin was added to the wiki

// #ask is inconsistent

{{#show: Berlin |? }} → Berlin

1.7:

{{#ask: [[Berlin]] }} → Berlin
or
{{#ask: [[Category:City]] }} → Berlin (in case only Berlin was added to the wiki

// #ask is consistent

{{#show: Berlin |? }} → Berlin

Nothing had to be changed for #show since the specified page will never be the result of the query.

Thus I am closing this bug as RESOLVED INVALID. I will amend the documentation on the wiki accordingly. Thank you for your patience with me.

Ouch, I forgot to add the property to be queried for. I guess you still get what I meant to elaborate.