Last modified: 2014-06-06 10:44:00 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T51805, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 49805 - Allow mw.wikibase.getEntity and getProperty to access arbitrary Wikidata items
Allow mw.wikibase.getEntity and getProperty to access arbitrary Wikidata items
Status: RESOLVED DUPLICATE of bug 47930
Product: MediaWiki extensions
Classification: Unclassified
WikidataClient (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Wikidata bugs
:
Depends on: 47288
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-19 10:52 UTC by Rical
Modified: 2014-06-06 10:44 UTC (History)
14 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Rical 2013-06-19 10:52:40 UTC
I hope mw.wikibase.getEntity("Q535") and mw.wikibase.getProperty("p20")
* Even exactly mw.wikibase.getProperty("p20", "Q535") which return a string or nil,
* and where the element code is not necessary inside a page-element,
* and where it permits to document the module or the templates elsewhere out of their spaces, and to build genealogies or species classifications.

other : Now Lua modules work in fr.wikisource, but mw.wikibase.getEntity() do not works. Thanks in advance. I am Rical in wikis.
Comment 1 Rical 2013-06-19 11:00:06 UTC
Sorry : hopes to document the modules or the templates in any namespaces. My present works is Module:Auteur in test2.wikipedia and fr.wikisource
Comment 2 Andre Klapper 2013-06-19 23:22:09 UTC
Sorry, I have problems to understand "I hope mw.wikibase.getEntity("Q535") and mw.wikibase.getProperty("p20")". How can you hope a function?

What exactly is the request here? What is the current outcome, and what is the expected outcome?
Comment 3 Brad Jorsch 2013-06-20 00:06:25 UTC
Rical: The mw.wikibase library is provided by Wikidata. There doesn't seem to be anything here that is specific to Scribunto. Why did you reassign it?
Comment 4 Rical 2013-06-20 10:36:06 UTC
In the module or template Auteur/doc I must show examples, but a module page is not an element, then wikidata give nothing to mw.wikibase.getEntity(), and mw.wikibase.getEntity("Q535") do not works.

Also in wikidata:Victor Hugo the country property give 142, but in Lua, I cannot ask mw.wikibase.getEntity("Q142").

Then I hope that mw.wikibase.getEntity("Q535") works for any element.

Get a property by Lua is very hard by present Lua, because in many cases the result is a script error. Go to see what I wrote in 
http://test2.wikipedia.org/wiki/Module:Auteur
to read some properties from one element
in the function m.wikidata, at least and really many more that :
  local entity = mw.wikibase.getEntity( )
  local dat = entity.claims
  wd.image = dat.p18[0].mainsnak.datavalue.value
  wd.country = dat.p27[0].mainsnak.datavalue.value["numeric-id"]

Reading entity.claims.p18[0] (and others) does not work if one writes entity.claims["p18"][0]
then I can't do a loop from a list of properties to query.

Then I hope that mw.wikibase.getProperty("p20") works for any property.
or entity.getProperty("p20")
which return nil or .value or .value["numeric-id"]

When getEntity("Q535") and getProperty("p20") already exist, we must thinks about users that want make généalogies or biologic classifications.
They probably will like mw.wikibase.getProperty("p20", "Q535") which return a string or
nil, and where the element is optional.

Sorry for "Scribunto", I don't known where to include a Lua bug.
Comment 5 bennylin 2013-09-23 18:24:30 UTC
From my experience, you get script error if the item doesn't have label in your language and/or the article doesn't exist for that language edition. Therefore it's impossible to generate a red link from current mw.wikibase. It's an error that should be caught by the code.
Comment 6 Rical 2013-09-23 20:36:18 UTC
2 changes and 1 option ?

My tests are in 2 pages which use the same module :
https://test2.wikipedia.org/wiki/Victor_Hugo
which give : entity = Q535 , sitelink = Victor Hugo
and
https://test2.wikipedia.org/wiki/Module:Auteur
which give : getEntity=ERREUR

In my mind, there are 2 changes to do :
* Never return script error, then return nil if the page/query or the property don't exists.
* Return the property if it exists.
* Perhaps the script error masks some other usefull return.

An option ?

* Perhaps, in some cases, a third parameter could ask a type for the returned value, for date format... And a type/format could be returned as a second value.
Comment 7 Lydia Pintscher 2013-11-05 11:59:42 UTC

*** This bug has been marked as a duplicate of bug 47930 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links