[Wikidata-bugs] [Maniphest] [Commented On] T185557: Create the easy function mw.wikibase.property('P21', 'Q8023', 'en')

2018-02-13 Thread Rical
Rical added a comment.
I duplicated some versions for tests mainly in :

https://fr.wikipedia.org/wiki/Module:Central-s-fr
https://vi.wikipedia.org/wiki/Mô đun:Central-s-vi
https://hu.wikipedia.org/wiki/Modul:Central-w-hu

And this old special test :
https://fr.wikipedia.org/wiki/Module:Tests
https://fr.wikisource.org/wiki/Module:TestsTASK DETAILhttps://phabricator.wikimedia.org/T185557EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: RicalCc: Lea_Lacroix_WMDE, Lydia_Pintscher, hoo, thiemowmde, Uzume, Aklapper, Rical, Lahi, Gq86, GoranSMilovanovic, Soteriaspace, Jayprakash12345, JakeTheDeveloper, QZanden, Zoranzoki21, LawExplorer, Wikidata-bugs, aude, TheDJ, Mbch331___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T185557: Create the easy function mw.wikibase.property('P21', 'Q8023', 'en')

2018-02-13 Thread Rical
Rical added a comment.
Each call of datas.property(pp) defines one property in the pp table.
The calling process contains a table to define all eventual properties.

p.args_known = { -- Table of the definitions of all known arguments at module level. 
-- All arguments have a keyword identical to the registration name, except synonyms.
["country"]		= { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "country", ["prop"] = "P27", },
["countryRANK"]	= { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "country", ["prop"] = "P27", ["RANK"] = "RANK_NORMAL", },
["birthyear"]	= { ["typ"] = "dat", ["need"] = 2, ["keyword"] = "birthyear", ["prop"] = "P569", ["format"] = "year", },
["deathyear"]	= { ["typ"] = "dat", ["need"] = 2, ["keyword"] = "deathyear", ["prop"] = "P570", ["format"] = "year", },
["lastname"]	= { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "lastname", ["prop"] = "P734", },
["lastname2"]	= { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "lastname", ["prop"] = "P734", ["syn"] = 2, },
["firstname"]	= { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "firstname", ["prop"] = "P735", },
["firstname2"]	= { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "firstname", ["prop"] = "P735", ["syn"] = 2, },
["title"]		= { ["typ"] = "dat", ["need"] = 2, ["keyword"] = "label", ["prop"] = "P735", ["syn"] = 2, },
["personlang"]	= { ["typ"] = "dat", ["need"] = 2, ["keyword"] = "personlang", ["prop"] = "P1412", },
["QITEM"]		= { ["typ"] = "dat", ["need"] = 2, ["keyword"] = "QITEM", ["prop"] = "Q16222597", },
["label"]		= { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "label", ["prop"] = "label", },
["sitelink"]	= { ["typ"] = "dat", ["need"] = 0, ["keyword"] = "sitelink", ["prop"] = "sitelink", },
["description"]	= { ["typ"] = "dat", ["need"] = 2, ["keyword"] = "description", ["prop"] = "description", },
}

I have used this structure for years and have change it when I need or when new mw.wikibase functions have appeared.TASK DETAILhttps://phabricator.wikimedia.org/T185557EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: RicalCc: Lydia_Pintscher, hoo, thiemowmde, Uzume, Aklapper, Rical, Lahi, Gq86, GoranSMilovanovic, Soteriaspace, Jayprakash12345, JakeTheDeveloper, QZanden, Zoranzoki21, LawExplorer, Wikidata-bugs, aude, TheDJ, Mbch331___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T185557: Create the easy function mw.wikibase.property('P21', 'Q8023', 'en')

2018-02-13 Thread thiemowmde
thiemowmde added a comment.
This code example is quite unfortunate. It works around all performance optimizations the Wikidata team implemented in the past weeks and months. Is this from a Lua module actually used somewhere, and if so, can you please provide a link?

Thanks for updating this tasks description. Unfortunately I still don't understand the idea behind the majority of what you are suggesting. For example, what is mw.wikibase.property( 'P21' ) supposed to return? What should be returned when all the method gets is a Q-ID? Whats the difference to the existing mw.wikibase.getEntityObject( 'Q34743' )? How would you distinguish between the pseudo-property "label" and a property that's actually called "label"? What is "Q", and how do you distinguish this from https://www.wikidata.org/wiki/Q9950?

F13706389: solid-principles-4-728.jpg

What are the use cases you have in mind? I really think we need to go back multiple steps, away from specific suggestions, and collect your use cases first. Can you please provide links to specific templates and explain the features they need?TASK DETAILhttps://phabricator.wikimedia.org/T185557EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: thiemowmdeCc: Lydia_Pintscher, hoo, thiemowmde, Uzume, Aklapper, Rical, Lahi, Gq86, GoranSMilovanovic, Soteriaspace, Jayprakash12345, JakeTheDeveloper, QZanden, Zoranzoki21, LawExplorer, Wikidata-bugs, aude, TheDJ, Mbch331___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T185557: Create the easy function mw.wikibase.property('P21', 'Q8023', 'en')

2018-02-13 Thread Rical
Rical added a comment.
For some weeks in Module:Central, this function use:

function datas.property(pp) -- Get datas from mw.wikibase for one property of the page.
datas.QITEM  = mw.wikibase.getEntityIdForCurrentPage() -- like "Q42"
datas.item   = mw.wikibase.getEntity(QITEM)
pp.label = datas.item:getLabel.QITEM)
pp.sitelink  = datas.item:getSitelink()
pp.labelwithlang = datas.item:getLabelWithLang()
pp.description   = mw.wikibase.description.QITEM) 
pp.labelbylang   = mw.wikibase.getLabelByLang(QITEM)
pp.labelcontent  = mw.wikibase.getLabelByLang(, langs.content_lan, QITEM)
pp.labelpage = mw.wikibase.getLabelByLang(, langs.page_lan, QITEM)
pp.labeluser = mw.wikibase.getLabelByLang(, langs.user_lan, QITEM)
pp.val   = datas.item:formatPropertyValues( pp.prop ) -- like "P123"
 ...
return pp
endTASK DETAILhttps://phabricator.wikimedia.org/T185557EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: RicalCc: Lydia_Pintscher, hoo, thiemowmde, Uzume, Aklapper, Rical, Lahi, Gq86, GoranSMilovanovic, Soteriaspace, Jayprakash12345, JakeTheDeveloper, QZanden, Zoranzoki21, LawExplorer, Wikidata-bugs, aude, TheDJ, Mbch331___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T185557: Create the easy function mw.wikibase.property('P21', 'Q8023', 'en')

2018-02-09 Thread Uzume
Uzume added a comment.
I have no issue with discussion and I believe this an adequate forum for such a discussion. My point was your requests are significantly lacking (and need discussion and focus) before they can be considered for possible implementation.

We already have many of the facilities you mention, for example, getBestStatements(eid, pid) to obtain the best statements (by rank). Also if you need something more than that we have many Scribunto Lua libraries to simplify such things.

FYI: I would not want to return nil when where is a stated "no value" as that is inherently different than the lack of a claim.TASK DETAILhttps://phabricator.wikimedia.org/T185557EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: UzumeCc: Uzume, Aklapper, Rical, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, Wikidata-bugs, aude, Mbch331___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T185557: Create the easy function mw.wikibase.property('P21', 'Q8023', 'en')

2018-02-08 Thread Uzume
Uzume added a comment.
I agree. This request is poorly specified. For one, labels, descriptions, and sitelinks are not properties. Also how should these property values be handled? There are many property data types where the data is not necessarily a single scalar value. Also property claims can have unknown or no value in addition to a value. This ignores what to do when there are multiple property claims for the same property (or any comment about ranks) and is unclear how qualifiers or references should or should not be handled by this interface (although the second line in the description of this task quotes a qualifier access).

I also disagree with the perception that traversals of statements, claims, qualifiers, references, or snaks are somehow heavy and/or hazardous. This is semi-structured data and as such it is nontrivial to traverse without a semi-structured query language (e.g., SPARQL, XPath, etc.). We already have large Lua convenience libraries for processing these data. Short of adding some sort of query language to the Wikibase client Scribunto interface, I do not see this as something that is missing (unless I am somehow misunderstanding the request).TASK DETAILhttps://phabricator.wikimedia.org/T185557EMAIL PREFERENCEShttps://phabricator.wikimedia.org/settings/panel/emailpreferences/To: UzumeCc: Uzume, Aklapper, Rical, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, Wikidata-bugs, aude, Mbch331___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs