Page MenuHomePhabricator

Property parser function should return nothing for novalue snaktypes
Open, Needs TriagePublic

Description

Currently there are lots of templates on English Wikipedia that use infobox code similar to:

{{#if:{{#Property:P17}}|...

... or ...

XYZ = {{#Property:P43356}}

... which works great in most circumstances. However, in cases where a property is set to "no value" (as the snak type), calls to the {{#Property}} parser function actually return the string "no value". This causes "no value" to get output to the Infobox. It would be better if it returned nothing (i.e. an empty string or null value) in these cases, so that #if statements could work properly and "no value" is never output to the user. This should probably be the case for "unknown value" claims as well.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

For "no value" I think this makes sense. I think for "unknown" value we do want to return "unknown" because that is potentially important information.

More input from others?

@Lydia_Pintscher: That's fine with me. Let's just change the "no value" behavior for now.

Do we not want to keep the difference between "no value" and "missing value"?

Do we not want to keep the difference between "no value" and "missing value"?

On Wikidata it really matters and I definitely want to keep it. However I think it doesn't make a difference for an infobox on Wikipedia. Or?

However I think it doesn't make a difference for an infobox on Wikipedia. Or?

There might be an infobox field saying "no children" which makes it different from a missing value, just Wikidata-like "no value" is different from a missing statement. (Not opposing, just arguments.)

@matej_suchanek: That's definitely a possibility in theory, but in practice everyone seems to assume that {{#Property}} either returns an actual value or nothing.

This request seems clearly related to this discussion at MT:Wikidata on en.WP. Same actor and almost-same request. ;)

However I think it doesn't make a difference for an infobox on Wikipedia. Or?

Most infoboxes on Wikipedia aren't using the naive property parser function but instead the usually-richer Wikidata Lua module for providing information, at least on the big wikis. I suspect the smaller wikis will eventually adapt that for their languages as the big wikis continue to transition their templates to use Wikidata (per the usual flow of template knowledge from big to small).

There might be an infobox field saying "no children" which makes it different from a missing value, just Wikidata-like "no value" is different from a missing statement. (Not opposing, just arguments.)

I think the default should be to provide the "no value" in the property parser function. As it is, it's the naive way of handling things, so we should expect that a naive user will want everything that Wikidata knows. And when Wikidata knows something, that's a good thing to tell a reader!

@matej_suchanek: That's definitely a possibility in theory, but in practice everyone seems to assume that {{#Property}} either returns an actual value or nothing.

To which users are you referring, out of curiosity?

We should expect that a naive user will want everything that Wikidata knows.

If that were true, there would be examples of uses that actually checked for "no value", which I've never seen.

To which users are you referring, out of curiosity?

I'm referring to users of English Wikipedia. As you can see from this search result, existing uses of the Property parser function there generally assume that it will return an actual value (and sometimes even assume it is a linkable value).

We should expect that a naive user will want everything that Wikidata knows.

If that were true, there would be examples of uses that actually checked for "no value", which I've never seen.

I don't see how that follows. A naive user doesn't know "no value" exists, so why would he be expected to program for such (in templates)?

To which users are you referring, out of curiosity?

I'm referring to users of English Wikipedia. As you can see from this search result, existing uses of the Property parser function there generally assume that it will return an actual value (and sometimes even assume it is a linkable value).

And in mainspace, the link ones are an obvious issue, but c.f. my first comment; for non-link ones, I see nil issue in providing "no value" to the usually-consuming template. And besides, I might suggest that where the output is a negative output (as in, "no value" inside a link), the user will appropriately remove those uses of the property. Additionally, assuming "no value" should output in that case as "" will not fix the problem; a "[[]]" in the source is still an issue producing weird behavior (though I haven't checked to see if MediaWiki collapses that to an empty string or still outputs an <a></a> or what).

But maybe I'm assuming that users should have to monitor their pages for changes in Wikidata which may or may not be beneficial and which may change the output (sometimes significantly)? We have issues with that regardless though, dragging the clients' users' collective feet to care about the Wikidata.

Aside

I'm not sure why there are so many naive uses of the commons property in {{Commons category}} when the template handles the property correctly already.