Module talk:Wikidata

Latest comment: 10 years ago by Tpt in topic Support to coordinates

Property P in lower case edit

An other issue with this module is that the property P should be in lower case. Uppercase P give error: Property not found.

{{#invoke:Wikidata|formatStatements|property=p19}} OK
{{#invoke:Wikidata|formatStatements|property=P19}} Property not found

Should be more robust. Especially when {{#property:P19}} is working. HenkvD (talk) 12:14, 31 March 2013 (UTC)Reply

Easy fix. Why did nobody program this sooner???? HenkvD (talk) 18:25, 8 May 2013 (UTC)Reply

separator edit

In Germany test {{#invoke:Wikidata|formatStatements|property=p47|separator=<br />}}:

Show: "Netherlands and Denmark". But could is "Netherlands <br /> Denmark" --Shizhao (talk) 14:10, 27 April 2013 (UTC)Reply

It works, but you have to add conjunction=<br />
{{#invoke:Wikidata|formatStatements|property=p47|separator=<br />|conjunction=<br />}}
HenkvD (talk) 18:01, 5 May 2013 (UTC)Reply

entity-not-found edit

Do we really need the error "entity-not-found"? It shouldn't show anything if entity doesn't exist, but now it shows error instead. --Nullzero (talk) 06:43, 30 April 2013 (UTC)Reply

I removed it as this indeed not needed and giving errors on pages. See also discussion on ru:Обсуждение шаблона:Wikidata. HenkvD (talk) 18:28, 14 May 2013 (UTC)Reply

Number of statements edit

Is it possible to add a function that just returns the number of available statements? --Bultro (talk) 12:25, 28 June 2013 (UTC)Reply

This function can by placed in any module (like I did in Module:HenkvD):
function p.NumberOfClaims(frame) 
   entity = mw.wikibase.getEntity()
   if not entity then return nil end
   if not entity.claims then return nil end
   local count = 0
   for _ in pairs(entity.claims) do count = count + 1 end
   return count
end
HenkvD (talk) 18:59, 30 June 2013 (UTC)Reply
Ok that returns the number of different properties. Sorry, i meant the number of different values a specified property has, for example Q16287 and property=P47 would return "8" --Bultro (talk) 15:56, 26 July 2013 (UTC)Reply
You can do similar for entity.claims.p47, see Province of Turin using NumberOfClaimsPerProperty in Module:HenkvD"
function p.NumberOfClaimsPerProperty(frame) 
   property=string.lower(frame.args[1])
   entity = mw.wikibase.getEntity()
   if not entity then return nil end
   if not entity.claims then return nil end
   if not entity.claims[property] then return nil end
   local count = 0
   for _ in pairs(entity.claims[property]) do count = count + 1 end
   return count
end
HenkvD (talk) 18:48, 31 July 2013 (UTC)Reply

Support to coordinates edit

Is it possible to add support for geocoordinates property? Different wikis started to add this on they own, but it would be helpful to have centralised way to call it. --Reaperman (talk) 18:34, 25 August 2013 (UTC)Reply

I have begun Module:GlobeCoordinate that is used as a library for supporting geoccordinates. For an example of th output, see Paris. Tpt (talk) 18:53, 7 September 2013 (UTC)Reply
Return to "Wikidata" page.