Jump to content

Module talk:OSM

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Module talk:OSM/doc)

Error with no linktext

[edit]

@Polyglot: Nice module! This is a really interesting idea. I just noticed that the module will produce an error if you don't supply frame.args.linktext and the page also has a Wikidata entry. Should there be a default display value instead of a red error message? (Also, maybe "display" or something would be a more elegant parameter name than "linktext"?) Best — Mr. Stradivarius ♪ talk ♪ 06:27, 5 August 2015 (UTC)[reply]

I just saw the error appearing myself. Yesterday all tests were fine, because the Module was only present on nl.WP. I'll have to find a better way to simulate a page with no link to a wikidata entry.
Oops, you're talking about something else. I considered the linktext parameter as mandatory. This means it can't be used in templates for references though. I guess I'll have some more coding to do... Maybe simply text? I'll add a parameter to have it return simply text without link as well. --Polyglot (talk) 08:59, 5 August 2015 (UTC)[reply]
@Polyglot: If linktext is really compulsory, then you could output a more informative error message, e.g.:
if not frame.args.linktext then
	error('No "linktext" argument provided', 2)
end
Or if you would rather that the error didn't show up in Category:Pages with script errors then you could do the same thing with wikitext:
if not frame.args.linktext then
	return '<strong class="wikitext">No "linktext" argument provided</strong>'
end
Or alternatively you could make the subpage name the default display text:
local display = frame.args.linktext or mw.title.getCurrentTitle().subpageText
Whichever you think works the best. :) — Mr. Stradivarius ♪ talk ♪ 09:14, 5 August 2015 (UTC)[reply]
Also, I like "linktext" better than "text", although I think "display" is better than both. (That's just my personal preference, though.) — Mr. Stradivarius ♪ talk ♪ 09:24, 5 August 2015 (UTC)[reply]
@Mr. Stradivarius: I'll start changing it to display. You seem to be the goto guy if it comes to Lua scripts! :-) I was wondering. I copied the code to test the scripts from Module:Wikidata on nl.WP, but it has an incredible amount of duplication, which makes it error prone to work with. Isn't there a more elegant way to accomplish testing? I would have written more tests if it were more practical to do so. I'm a big believer in TDD. --Polyglot (talk) 10:16, 5 August 2015 (UTC)[reply]

Unit testing

[edit]

@Mr. Stradivarius: I tried to create a module to ease unit testing, but it doesn't get transcluded. Do you see a way to make that work?--Polyglot (talk) 12:48, 5 August 2015 (UTC)[reply]

@Polyglot: Where are you trying to transclude it? We usually put the test cases at "/testcases" (so Module:OSM/testcases in this case) and then run the tests on the talk page (so Module talk:OSM/testcases. We already have a couple of unit test modules to make things easier - my favourite is Module:ScribuntoUnit. The other main one is Module:UnitTests. See Module:Dts/testcases and Module talk:Dts/testcases for a recent example that I wrote. — Mr. Stradivarius ♪ talk ♪ 13:45, 5 August 2015 (UTC)[reply]
Also, if you just want to do the testing on nlwiki, then that might be the best solution. Maintaining different sets of test cases for different wikis is quickly going to get unwieldy. — Mr. Stradivarius ♪ talk ♪ 13:46, 5 August 2015 (UTC)[reply]
@Mr. Stradivarius:I'll start using one of those. I don't know how to nominate the Module I created for speedy deletion
Module:Unittest
Wouldn't it be better if I copied the better way of unit testing over to nl.WP?--Polyglot (talk) 17:46, 5 August 2015 (UTC)[reply]
@Polyglot: I've deleted the module for you. We've never quite worked out a way to tag modules for speedy deletion, so people usually either make a request at WP:AN or at WP:MFD. And yes, copying the unit test modules to nl.WP sounds like a good idea. :) — Mr. Stradivarius ♪ talk ♪ 01:55, 6 August 2015 (UTC)[reply]

Multiple objects with same Wikidata ID

[edit]

This page says: Now if a way is split, both parts will continue with the proper wikidata tag. However, the OpenStreetMap wiki says: There shouldn't be more than one Openstreetmap item with the same Wikidata ID.

Personally, I don't agree with what the OSM wiki says, what do you think? --Peter (talk) 08:32, 19 January 2016 (UTC)[reply]

Hi Peter, I don't agree with that statement at all either. Streets will get fragmented and the attempt to group them by means of associatedStreet relations has been deemed "too complicated" (another statement I don't agree with, but OK). Using Wikidata IDs to indicate that it's the same object we're talking about seems like the best solution.
On the other hand, I recently had a street by the same name, that continued into the next gemeente/commune/city part. I would have used 2 associatedStreet relations for that one, since the postal code differs, but there is only 1 Wikipedia article and hence only 1 Wikidata ID for it. I think there, the cleanest solution would be to create 2 wikidata IDs, but there will probably be Wikipedias that don't agree with splitting the article. So, I guess, then the solution becomes to create 2 extra WD entries.

At the moment I'm adding Wikidata IDs for railway stations. Now, what is a railway station? Is it the node railway=station, or is it the building tagged building=train_station? What about the bus stops that serve the railway station? Are they part of it. If there are more than 2, you could argue they form a bus station, but with only 2, that's not exactly a bus station in its own right. At the moment I'm tagging all those with 1 Wikidata ID. The result of this, is that the module will show all that is relevant for the railway station described in the Wikipedia article. The alternative is to create separate wikidata IDs for each item and on the OSM side create an area for the whole railway station and mark that with the 'primary' WD ID. --Polyglot (talk) 09:06, 19 January 2016 (UTC)[reply]