@@ -1,6 +1,6 @@
/*
/*
XOWA: the XOWA Offline Wiki Application
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012-2017 gnosygnu@gmail.com
Copyright (C) 2012-202 1 gnosygnu@gmail.com
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
or alternatively under the terms of the Apache License Version 2.0.
or alternatively under the terms of the Apache License Version 2.0.
@@ -13,338 +13,357 @@ The terms of each license can be found in the source code repository:
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
*/
package gplx.xowa.xtns.scribunto.libs.wikibases ; import gplx.* ; import gplx.xowa.* ; import gplx.xowa.xtns.* ; import gplx.xowa.xtns.scribunto.* ; import gplx.xowa.xtns.scribunto.libs.* ;
package gplx.xowa.xtns.scribunto.libs.wikibases ;
import org.junit.* ; import gplx.xowa.xtns.wbases.* ; import gplx.xowa.xtns.wbases.core.* ; import gplx.xowa.xtns.wbases.claims.* ; import gplx.xowa.xtns.wbases.claims.itms.* ;
import gplx.xowa.xtns.wbases.claims.enums.* ;
import gplx.Bool_ ;
public class Basic__tst {
import gplx.Bry_ ;
private final Scrib_invoke_func_fxt fxt = new Scrib_invoke_func_fxt ( ) ; private Scrib_lib lib ;
import gplx.Keyval ;
private final Wdata_wiki_mgr_fxt wdata_fxt = new Wdata_wiki_mgr_fxt ( ) ;
import gplx.Keyval_ ;
@Bef ore public void init ( ) {
imp ort gplx.List_adp_ ;
fxt . Clear_for_lib ( " en.wikipedia.org " , " zh-hans " ) ;
import gplx.Object_ ;
lib = fxt . Core ( ) . Lib_wikibase ( ) . Init ( ) ;
import gplx.String_ ;
wdata_fxt . Init ( fxt . Parser_fxt ( ) , false ) ;
import gplx.xowa.xtns.scribunto.Scrib_core ;
wdata_fxt . Init_lang_fallbacks ( " zh-hant " , " zh-hk " ) ;
import gplx.xowa.xtns.scribunto.Scrib_invoke_func_fxt ;
}
import gplx.xowa.xtns.scribunto.Scrib_lib ;
@Tes t public void IsValidEntityId ( ) {
impor t gplx.xowa.xtns.scribunto.libs.Scrib_lib_wikibase ;
IsValidEntityIdCheck ( Bool_ . Y , " P1 " ) ;
import gplx.xowa.xtns.scribunto.libs.Scrib_lib_wikibase_srl ;
IsValidEntityIdCheck ( Bool_ . Y , " P123 " ) ;
import gplx.xowa.xtns.wbases.Wdata_doc ;
IsValidEntityIdCheck ( Bool_ . Y , " Q1 " ) ;
import gplx.xowa.xtns.wbases.Wdata_wiki_mgr_fxt ;
IsValidEntityIdCheck ( Bool_ . Y , " Q123 " ) ;
import gplx.xowa.xtns.wbases.claims.enums.Wbase_claim_value_type_ ;
IsValidEntityIdCheck ( Bool_ . Y , " A:B:Q123 " ) ;
import gplx.xowa.xtns.wbases.claims.itms.Wbase_claim_base ;
import gplx.xowa.xtns.wbases.claims.itms.Wbase_claim_string ;
IsValidEntityIdCheck ( Bool_ . N , " p1 " ) ;
import org.junit.Before ;
IsValidEntityIdCheck ( Bool_ . N , " q1 " ) ;
import org.junit.Test ;
IsValidEntityIdCheck ( Bool_ . N , " P " ) ;
IsValidEntityIdCheck ( Bool_ . N , " P1A " ) ;
public class Basic__tst {
IsValidEntityIdCheck ( Bool_ . N , " P01 " ) ;
private final Scrib_invoke_func_fxt fxt = new Scrib_invoke_func_fxt ( ) ; private Scrib_lib lib ;
}
private final Wdata_wiki_mgr_fxt wdata_fxt = new Wdata_wiki_mgr_fxt ( ) ;
private void IsValidEntityIdCheck ( boolean expd , String val ) {
@Before public void init ( ) {
fxt . Test_scrib_proc_bool ( lib , Scrib_lib_wikibase . Invk_isValidEntityId , Object_ . Ary ( val ) , expd ) ;
fxt . Clear_for_lib ( " en.wikipedia.org " , " zh-hans " ) ;
}
lib = fxt . Core ( ) . Lib_wikibase ( ) . Init ( ) ;
@Test public void EntityExists ( ) {
wdata_fxt . Init ( fxt . Parser_fxt ( ) , false ) ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " en " , " b " ) . Xto_wdoc ( ) ) ;
wdata_fxt . Init_lang_fallbacks ( " zh-hant " , " zh-hk " ) ;
fxt . Test_scrib_proc_bool ( lib , Scrib_lib_wikibase . Invk_entityExists , Object_ . Ary ( " q2 " ) , true ) ;
}
fxt . Test_scrib_proc_bool ( lib , Scrib_lib_wikibase . Invk_entityExists , Object_ . Ary ( " Q1 " ) , false ) ;
@Test public void IsValidEntityId ( ) {
}
IsValidEntityIdCheck ( Bool_ . Y , " P1 " ) ;
@Test public void GetEntityId ( ) {
IsValidEntityIdCheck ( Bool_ . Y , " P123 " ) ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc ( " Q2 " )
IsValidEntityIdCheck ( Bool_ . Y , " Q1 " ) ;
. Add_sitelink ( " enwiki " , " Earth " )
IsValidEntityIdCheck ( Bool_ . Y , " Q123 " ) ;
) ;
IsValidEntityIdCheck ( Bool_ . Y , " A:B:Q123 " ) ;
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getEntityId , Object_ . Ary ( " Earth " ) , " Q2 " ) ;
IsValidEntityIdCheck ( Bool_ . N , " p1 " ) ;
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getEntityId , Object_ . Ary ( " missing_page " ) , null ) ;
IsValidEntityIdCheck ( Bool_ . N , " q1 " ) ;
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getEntityId , Object_ . Ary ( " " ) , null ) ; // PAGE:en.w:Water_treader DATE:2018-07-01
IsValidEntityIdCheck ( Bool_ . N , " P " ) ;
}
IsValidEntityIdCheck ( Bool_ . N , " P1A " ) ;
@Test public void GetReferencedEntityId ( ) {
IsValidEntityIdCheck ( Bool_ . N , " P01 " ) ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " Q1 " ) . Xto_wdoc ( ) ) ;
}
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " Q2 " ) . Add_claims ( wdata_fxt . Make_claim_entity_qid ( 1 , 1 ) ) . Xto_wdoc ( ) ) ;
private void IsValidEntityIdCheck ( boolean expd , String val ) {
wdata_ fxt. Init__docs__add ( wdata_fxt . Wd oc_bldr ( " Q3 " ) . Add_claims ( wdata_fxt . Make_claim_entity_qid ( 1 , 2 ) ) . Xto_wdoc ( ) ) ;
fxt . Test_scrib_pr oc_bool ( lib , Scrib_lib_wikibase . Invk_isValidEntityId , Object_ . Ary ( val ) , expd ) ;
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getReferencedEntityId , Object_ . Ary ( " Q3 " , " P1 " , NewToIds ( " Q1 " ) ) , " Q1 " ) ;
}
}
@Test public void EntityExists ( ) {
private static Keyval [ ] NewToIds ( String . . . toIds ) {
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " en " , " b " ) . Xto_wdoc ( ) ) ;
int len = toIds . length ;
fxt . Test_scrib_proc_bool ( lib , Scrib_lib_wikibase . Invk_entityExists , Object_ . Ary ( " q2 " ) , true ) ;
Keyval [ ] rv = new Keyval [ len ] ;
fxt . Test_scrib_proc_bool ( lib , Scrib_lib_wikibase . Invk_entityExists , Object_ . Ary ( " Q1 " ) , false ) ;
for ( int i = 0 ; i < len ; i + + )
}
rv [ i ] = Keyval_ . int_ ( i , toIds [ i ] ) ;
@Test public void GetEntityId ( ) {
return rv ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc ( " Q2 " )
}
. Add_sitelink ( " enwiki " , " Earth " )
@Test public void GetLabel__cur ( ) { // do not get fallback
) ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " zh-hans " , " s " ) . Add_label ( " zh-hant " , " t " ) . Xto_wdoc ( ) ) ;
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getLabel , Object_ . Ary ( " q2 " ) , String_ . Concat_lines_nl_skip_last ( " 1=s " , " 2=zh-hans " ) ) ;
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getEntityId , Object_ . Ary ( " Earth " ) , " Q2 " ) ;
}
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getEntityId , Object_ . Ary ( " missing_page " ) , null ) ;
@Test public void GetLabel__fallback_1 ( ) { // get 1st fallback
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getEntityId , Object_ . Ary ( " " ) , null ) ; // PAGE:en.w:Water_treader DATE:2018-07-01
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " zh-hant " , " t " ) . Add_label ( " zh-hk " , " h " ) . Xto_wdoc ( ) ) ;
}
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getLabel , Object_ . Ary ( " q2 " ) , String_ . Concat_lines_nl_skip_last ( " 1=t " , " 2=zh-hant " ) ) ;
@Test public void GetReferencedEntityId ( ) {
}
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " Q1 " ) . Xto_wdoc ( ) ) ;
@Test public void GetLabel__fallback_2 ( ) { // get 2nd fallback
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " Q2 " ) . Add_claims ( wdata_fxt . Make_claim_entity_qid ( 1 , 1 ) ) . Xto_wdoc ( ) ) ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " zh-hk " , " hk " ) . Xto_wdoc ( ) ) ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " Q3 " ) . Add_c laims ( wdata_fxt . Make_claim_entity_qid ( 1 , 2 ) ) . Xto_wdoc ( ) ) ;
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getLabel , Object_ . Ary ( " q2 " ) , String_ . Concat_lines_nl_skip_last ( " 1=hk " , " 2=zh-hk " ) ) ;
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getReferencedEntityId , Object_ . Ary ( " Q3 " , " P1 " , NewToIds ( " Q 1" ) ) , " Q1 " ) ;
}
}
@Test publ ic void GetLabel__fallback_en ( ) { // get en
private stat ic Keyval [ ] NewToIds ( String . . . toIds ) {
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " en " , " lbl_en " ) . Xto_wdoc ( ) ) ;
int len = toIds . length ;
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getLabel , Object_ . Ary ( " q2 " ) , String_ . Concat_lines_nl_skip_last ( " 1=lbl_en " , " 2=en " ) ) ;
Keyval [ ] rv = new Keyval [ len ] ;
}
for ( int i = 0 ; i < len ; i + + )
@Test public void GetDescr ( ) {
rv [ i ] = Keyval_ . int_ ( i , toIds [ i ] ) ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_description ( " zh-hans " , " s " ) . Add_description ( " zh-hant " , " t " ) . Xto_wdoc ( ) ) ;
return rv ;
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getDescription , Object_ . Ary ( " q2 " ) , " s " ) ;
}
}
@Test public void GetLabel__cur ( ) { // do not get fallback
@Test public void GetSlink ( ) {
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " zh-hans " , " s " ) . Add_label ( " zh-hant " , " t " ) . Xto_wdoc ( ) ) ;
wdata_ fxt. Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_sitelink ( " enwiki " , " a " ) . Xto_wdoc ( ) ) ;
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getLabel , Object_ . Ary ( " q2 " ) , String_ . Concat_lines_nl_skip_last ( " 1=s " , " 2=zh-hans " ) ) ;
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getSiteLinkPageName , Object_ . Ary ( " q2 " ) , " a " ) ;
}
}
@Test public void GetLabel__fallback_1 ( ) { // get 1st fallback
@Test public void GetEntity ( ) {
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " zh-hant " , " t " ) . Add_label ( " zh-hk " , " h " ) . Xto_wdoc ( ) ) ;
wdata_ fxt. Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " en " , " b " ) . Xto_wdoc ( ) ) ;
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getLabel , Object_ . Ary ( " q2 " ) , String_ . Concat_lines_nl_skip_last ( " 1=t " , " 2=zh-hant " ) ) ;
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getEntity , Object_ . Ary ( " q2 " , false ) , String_ . Concat_lines_nl_skip_last
}
( " 1= "
@Test public void GetLabel__fallback_2 ( ) { // get 2nd fallback
, " id=q2 "
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " zh-hk " , " hk " ) . Xto_wdoc ( ) ) ;
, " type=item "
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getLabel , Object_ . Ary ( " q2 " ) , String_ . Concat_lines_nl_skip_last ( " 1=hk " , " 2=zh-hk " ) ) ;
, " schemaVersion=2 "
}
, " labels= "
@Test public void GetLabel__fallback_en ( ) { // get en
, " en= "
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " en " , " lbl_ en" ) . Xto_wdoc ( ) ) ;
, " language=en "
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getLabel , Object_ . Ary ( " q2 " ) , String_ . Concat_lines_nl_skip_last ( " 1=lbl_en " , " 2=en " ) ) ;
, " value=b "
}
) ) ;
@Test public void GetDescr ( ) {
}
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_description ( " zh-hans " , " s " ) . Add_description ( " zh-hant " , " t " ) . Xto_wdoc ( ) ) ;
@Test public void GetEntity_property ( ) { // PURPOSE: getEntity should be able to convert "p2" to "Property:P2"; EX:es.w:Arnold_Gesell; DATE:2014-02-18
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getDescription , Object_ . Ary ( " q2 " ) , " s " ) ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " Property:p2 " ) . Add_label ( " en " , " b " ) . Xto_wdoc ( ) ) ;
}
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getEntity , Object_ . Ary ( " p2 " , false ) , String_ . Concat_lines_nl_skip_last
@Test public void GetSlink ( ) {
( " 1= "
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_sitelink ( " enwiki " , " a " ) . Xto_wdoc ( ) ) ;
, " id=Property:p2 " // only difference from above
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getSiteLinkPageName , Object_ . Ary ( " q2 " ) , " a " ) ;
, " type=property " // also, type should be "property"; PAGE:ru.w:Викитека:Проект:Викиданные DATE:2016-11-23
}
, " schemaVersion=2 "
@Test public void GetEntity ( ) {
, " datatype=<<NULL>> "
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " en " , " b " ) . Xto_wdoc ( ) ) ;
, " labels= "
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getEntity , Object_ . Ary ( " q2 " , false ) , String_ . Concat_lines_nl_skip_last
, " en ="
( " 1 ="
, " language=en "
, " id=q2 "
, " value=b "
, " type=item "
) ) ;
, " schemaVersion=2 "
}
, " labels= "
@Test public void GetEntity_ws ( ) { // PURPOSE: trim, b/c some pages will literally pass in "Property:P5\n"; PAGE:de.w:Mailand– Sanremo_2016 ISSUE#:363; DATE:2019-02-12
, " en= "
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " en " , " b " ) . Xto_wdoc ( ) ) ;
, " language=en "
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getEntity , Object_ . Ary ( " q2 \ n \ t " , false ) , String_ . Concat_lines_nl_skip_last
, " value=b "
( " 1= "
) ) ;
, " id=q2 "
}
, " type=item "
@Test public void GetEntity_property ( ) { // PURPOSE: getEntity should be able to convert "p2" to "Property:P2"; EX:es.w:Arnold_Gesell; DATE:2014-02-18
, " schemaVersion=2 "
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " Property:p2 " ) . Add_label ( " en " , " b " ) . Xto_wdoc ( ) ) ;
, " labels= "
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getEntity , Object_ . Ary ( " p2 " , false ) , String_ . Concat_lines_nl_skip_last
, " en ="
( " 1 ="
, " language=en "
, " id=Property:p2 " // only difference from above
, " value=b "
, " type=property " // also, type should be "property"; PAGE:ru.w:Викитека:Проект:Викиданные DATE:2016-11-23
) ) ;
, " schemaVersion=2 "
}
, " datatype=<<NULL>> "
// @Test public void GetEntity__missing() { // PURPOSE: missing entity should return empty kv array; PAGE:de.w:Critérium_International_2016 DATE:2017-12-30
, " labels= "
// fxt.Test_scrib_proc_str_ary(lib, Scrib_lib_wikibase.Invk_getEntity, Object_.Ary("q2", false), String_.Concat_lines_nl_skip_last
, " en= "
// ( "1=" // not " "
, " language=en "
// ));
, " value=b "
// }
) ) ;
@Test public void RenderSnaks ( ) {
}
Keyval [ ] args = Wbase_snak_utl_ . Get_snaks_as_ary ( wdata_fxt , wdata_fxt . Make_claim_monolingual ( 3 , " en " , " P3_en " ) , wdata_fxt . Make_claim_monolingual ( 3 , " de " , " P3_de " ) ) ;
@Test public void GetEntity_ws ( ) { // PURPOSE: trim, b/c some pages will literally pass in "Property:P5\n"; PAGE:de.w:Mailand– Sanremo_2016 ISSUE#:363; DATE:2019-02-12
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnaks , args , " P3_en, P3_de " ) ;
wdata_ fxt. Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_label ( " en " , " b " ) . Xto_wdoc ( ) ) ;
}
fxt . Test_scrib_proc_str_ary ( lib , Scrib_lib_wikibase . Invk_getEntity , Object_ . Ary ( " q2 \ n \ t " , false ) , String_ . Concat_lines_nl_skip_last
@Test public void RenderSnaks_pid ( ) { // PURPOSE: handle RenderSnaks like {"P10":[{"property":"P20"}]}; ISSUE#:666; DATE:2020-03-01
( " 1= "
Keyval [ ] args = Wbase_snak_utl_ . Get_snaks_as_nde ( wdata_fxt , " P123 " , wdata_fxt . Make_claim_monolingual ( 3 , " en " , " P3_en " ) , wdata_fxt . Make_claim_monolingual ( 3 , " de " , " P3_de " ) ) ;
, " id=q2 "
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnaks , args , " P3_en, P3_de " ) ;
, " type=item "
}
, " schemaVersion=2 "
@Test public void RenderSnak__entity ( ) {
, " labels= "
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " Q3 " ) . Add_label ( " en " , " test_label " ) . Xto_wdoc ( ) ) ;
, " en= "
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_entity_qid ( 2 , 3 ) ) ;
, " language=en "
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " test_label " ) ;
, " value=b "
}
) ) ;
@Test public void RenderSnak__str ( ) {
}
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_string ( 3 , " test_str " ) ) ;
// @Test public void GetEntity__missing() { // PURPOSE: missing entity should return empty kv array; PAGE:de.w:Critérium_International_2016 DATE:2017-12-30
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " test_str " ) ;
// fxt.Test_scrib_proc_str_ary(lib, Scrib_lib_wikibase.Invk_getEntity, Object_.Ary("q2", false), String_.Concat_lines_nl_skip_last
}
// ( "1=" // not ""
@Test public void RenderSnak__quantity ( ) {
// ));
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_quantity ( 3 , " 123 " , " 1 " , " 125 " , " 121 " ) ) ; // NOTE: entity-less units output "1"; EX:wd:Q493409 DATE:2016-11-08
// }
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " 123±2 " ) ;
@Test public void RenderSnaks ( ) {
}
Keyval [ ] args = Wbase_snak_utl_ . Get_snaks_as_ary ( wdata_fxt , wdata_fxt . Make_claim_monolingual ( 3 , " en " , " P3_en " ) , wdata_fxt . Make_claim_monolingual ( 3 , " de " , " P3_de " ) ) ;
@Test public void RenderSnak__quantity__null_bounds ( ) { // PURPOSE: handle null lbound / ubound; PAGE:wd.q:183 DATE:2016-12-03
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnaks , args , " P3_en, P3_de " ) ;
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_quantity ( 3 , " 123 " , " 1 " , null , null ) ) ;
}
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " 123 " ) ;
@Test public void RenderSnaks_pid ( ) { // PURPOSE: handle RenderSnaks like {"P10":[{"property":"P20"}]}; ISSUE#:666; DATE:2020-03-01
}
Keyval [ ] args = Wbase_snak_utl_ . Get_snaks_as_nde ( wdata_fxt , " P123 " , wdata_fxt . Make_claim_monolingual ( 3 , " en " , " P3_en " ) , wdata_fxt . Make_claim_monolingual ( 3 , " de " , " P3_de " ) ) ;
@Test public void RenderSnak__time ( ) {
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnaks , args , " P3_en, P3_de " ) ;
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_time ( 3 , " 2012-01-02 03:04:05 " ) ) ;
}
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " 30405 2 Jan 2012 " ) ; // NOTE: format is missing ":" b/c test does not init messages for html_wtr; DATE:2015-08-03
@Test public void RenderSnak__entity ( ) {
}
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " Q3 " ) . Add_label ( " en " , " test_label " ) . Xto_wdoc ( ) ) ;
@Test public void RenderSnak__geo ( ) {
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_entity_qid ( 2 , 3 ) ) ;
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_geo ( 3 , " 3.4 " , " 1.2 " ) ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " test_label " ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " 1°12'0"N, 3°24'0"E (<a href='/wiki/Q2'>http://www.wikidata.org/entity/Q2</a>) " ) ;
}
}
@Test public void RenderSnak__str ( ) {
@Test public void RenderSnak__monolingual ( ) {
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_string ( 3 , " test_str " ) ) ;
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_monolingual ( 3 , " en " , " abc_en " ) ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " test_str " ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " abc_en " ) ;
}
}
@Test public void RenderSnak__quantity ( ) {
@Test public void RenderSnak__no_value ( ) {
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_quantity ( 3 , " 123 " , " 1 " , " 125 " , " 121 " ) ) ; // NOTE: entity-less units output "1"; EX:wd:Q493409 DATE:2016-11-08
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , new Wbase_claim_string ( 3 , Wbase_claim_value_type_ . Tid__novalue , null ) ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " 123±2 " ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " " ) ;
}
}
@Test public void RenderSnak__quantity__null_bounds ( ) { // PURPOSE: handle null lbound / ubound; PAGE:wd.q:183 DATE:2016-12-03
@Test public void RenderSnak__data_value_is_null ( ) {
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_quantity ( 3 , " 123 " , " 1 " , null , null ) ) ;
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , new Wbase_claim_string ( 3 , Wbase_claim_value_type_ . Tid__somevalue , null ) ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " 123 " ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " " ) ;
}
}
@Test public void RenderSnak__time ( ) {
@Test public void RenderSnak__data_value_is_null1 ( ) {
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_time ( 3 , " 2012-01-02 03:04:05 " ) ) ;
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , new Wbase_claim_string ( 3 , Wbase_claim_value_type_ . Tid__somevalue , null ) ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " 30405 2 Jan 2012 " ) ; // NOTE: format is missing ":" b/c test does not init messages for html_wtr; DATE:2015-08-03
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " " ) ;
}
}
@Test public void RenderSnak__geo ( ) {
@Test public void FormatValues ( ) {
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_geo ( 3 , " 3.4 " , " 1.2 " ) ) ;
Keyval [ ] args = Wbase_snak_utl_ . Get_snaks_as_ary ( wdata_fxt , wdata_fxt . Make_claim_monolingual ( 3 , " en " , " P3_en " ) , wdata_fxt . Make_claim_monolingual ( 3 , " de " , " P3_de " ) ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " 1°12'0"N, 3°24'0"E (<a href='/wiki/Q2'>http://www.wikidata.org/entity/Q2</a>) " ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_formatValues , args , " P3_en, P3_de " ) ;
}
}
@Test public void RenderSnak__monolingual ( ) {
@Test public void FormatValue__str ( ) {
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_monolingual ( 3 , " en " , " abc_en " ) ) ;
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_string ( 3 , " test_str " ) ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " abc_en " ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_formatValue , args , " test_str " ) ;
}
}
@Test public void RenderSnak__no_value ( ) {
@Test public void GetEntityUrl ( ) {
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , new Wbase_claim_string ( 3 , Wbase_claim_value_type_ . Tid__novalue , null ) ) ;
fxt . Test_scrib _proc_str ( lib , Scrib_lib_wikibase . Invk_getEntityUrl , Object_ . Ary ( " Q2 " ) , " https://www.wikidata.org/wiki/Special:EntityPage/Q2 " ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " " ) ;
}
}
@Test public void GetSetting ( ) {
@Test public void RenderSnak__data_value_is_null ( ) {
fxt . Test_scrib_proc_obj ( lib , Scrib_lib_wikibase . Invk_getSetting , Object_ . Ary ( " allowArbitraryDataAccess " ) , true ) ; // PAGE:en.w:Beccles DATE:2018-06-27
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , new Wbase_claim_string ( 3 , Wbase_claim_value_type_ . Tid__somevalue , null ) ) ;
}
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " " ) ;
@Test public void GetSetting__siteGlobalID ( ) {
}
fxt . Test_scrib_proc_obj ( lib , Scrib_lib_wikibase . Invk_getSetting , Object_ . Ary ( " siteGlobalID " ) , " enwiki " ) ;
@Test public void RenderSnak__data_value_is_null1 ( ) {
}
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , new Wbase_claim_string ( 3 , Wbase_claim_value_type_ . Tid__somevalue , null ) ) ;
@Test public void IncrementStatsKey ( ) {
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_renderSnak , args , " " ) ;
fxt . Test_scrib_proc_obj ( lib , Scrib_lib_wikibase . Invk_incrementStatsKey , Object_ . Ary ( " wikibase.client.scribunto.wikibase.getEntityIdForCurrentPage.call " ) , null ) ;
}
}
@Test public void FormatValues ( ) {
@Test public void GetEntityModuleName ( ) {
Keyval [ ] args = Wbase_snak_utl_ . Get_snaks_as_ary ( wdata_fxt , wdata_fxt . Make_claim_monolingual ( 3 , " en " , " P3_en " ) , wdata_fxt . Make_claim_monolingual ( 3 , " de " , " P3_de " ) ) ;
fxt . Test_scrib _proc_obj ( lib , Scrib_lib_wikibase . Invk_getEntityModuleName , Object_ . Ary ( " Q123 " ) , " mw.wikibase.entity " ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_formatValues , args , " P3_en, P3_de " ) ;
}
}
@Test public void GetSiteLinkPageName ( ) {
@Test public void FormatValue__str ( ) {
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_sitel ink ( " enwiki " , " T est_page " ) . Xto_wdoc ( ) ) ;
Keyval [ ] args = Wbase_snak_utl_ . Get_snak ( wdata_fxt , wdata_fxt . Make_claim_str ing ( 3 , " t est_str " ) ) ;
fxt . Test_scrib _proc_str ( lib , Scrib_lib_wikibase . Invk_getSiteLinkPageName , Object_ . Ary ( " q2 " ) , " T est_page " ) ;
fxt . Test__proc__kvps__flat ( lib , Scrib_lib_wikibase . Invk_formatValue , args , " t est_str " ) ;
}
}
@Test public void GetSiteLinkPageName_wiki ( ) { // ISSUE#:665; PAGE:commons.wikimedia.org/wiki/Category:Paddy_Ashdown; DATE:2020-02-19
@Test public void GetEntityUrl ( ) {
wdata_ fxt. Init_xwikis_add ( " frwiki " ) ;
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getEntityUrl , Object_ . Ary ( " Q2 " ) , " https://www.wikidata.org/wiki/Special:EntityPage/Q2 " ) ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " )
}
. Add_sitelink ( " enwiki " , " q2_enwiki " )
@Test public void GetSetting ( ) {
. Add_sitelink ( " frwiki " , " q2_frwiki " )
fxt . Test_scrib_proc_obj ( lib , Scrib_lib_wikibase . Invk_getSetting , Object_ . Ary ( " allowArbitraryDataAccess " ) , true ) ; // PAGE:en.w:Beccles DATE:2018-06-27
. Xto_wdoc ( ) ) ;
}
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getSiteLinkPageName , Object_ . Ary ( " q2 " , " frwiki " ) , " q2_frwiki " ) ; // fails if q2_enwiki
@Test public void GetSetting__siteGlobalID ( ) {
}
fxt . Test_scrib_proc_obj ( lib , Scrib_lib_wikibase . Invk_getSetting , Object_ . Ary ( " siteGlobalID " ) , " enwiki " ) ;
}
}
class Wbase_snak_utl_ {
@Test public void IncrementStatsKey ( ) {
public static Keyval [ ] Get_snaks_as_ary ( Wdata_wiki_mgr_fxt wdata_fxt , W base_ claim_base . . . ary ) {
fxt . Test_scrib_proc_obj ( lib , Scrib_lib_wikibase . Invk_incrementStatsKey , Object_ . Ary ( " wiki base. client.scribunto.wikibase.getEntityIdForCurrentPage.call " ) , null ) ;
Keyval [ ] rv = Get_snaks_ary ( wdata_fxt , ary ) ;
}
return To_scrib_args ( rv ) ; // EX: ["1":["1":{"property":"P1"},"2":{"property":"P2"}]]
@Test public void GetEntityModuleName ( ) {
}
fxt . Test_scrib_proc_obj ( lib , Scrib_lib_wikibase . Invk_getEntityModuleName , Object_ . Ary ( " Q123 " ) , " mw.wikibase.entity " ) ;
public static Keyval [ ] Get_snaks_as_nde ( Wdata_wiki_mgr_fxt wdata_fxt , String pid , Wbase_claim_base . . . ary ) {
}
Keyval [ ] rv = Get_snaks_ary ( wdata_fxt , ary ) ;
@Test public void GetSiteLinkPageName ( ) {
Keyval kv = Keyval_ . new_ ( pid , rv ) ; // EX: "P1":[{"property":"P2"}]
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_sitelink ( " enwiki " , " Test_page " ) . Xto_wdoc ( ) ) ;
return To_scrib_args ( Keyval _. Ary ( kv ) ) ; // EX:["1":[{"P1":[{"property":"P11"}]]} // FOOTNOTE:references.snaks
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getSiteLinkPageName , Object _. Ary ( " q2 " ) , " Test_page " ) ;
}
}
private stat ic Keyval [ ] To_scrib_args ( Object arg ) {
@Test publ ic void GetSiteLinkPageName_wiki ( ) { // ISSUE#:665; PAGE:commons.wikimedia.org/wiki/Category:Paddy_Ashdown; DATE:2020-02-19
Keyval [ ] rv = new Keyval [ 1 ] ;
wdata_fxt . Init_xwikis_add ( " frwiki " ) ;
rv [ 0 ] = Keyval_ . int_ ( 0 + Scrib_core . Base_1 , arg ) ;
wdata_fxt . Init__docs__add ( wdata_fxt . Wdoc_bldr ( " q2 " )
return rv ;
. Add_sitelink ( " enwiki " , " q2_enwiki " )
}
. Add_sitelink ( " frwiki " , " q2_frwiki " )
private static Keyval [ ] Get_snaks_ary ( Wdata_wiki_mgr_fxt wdata_fxt , Wbase_claim_base . . . ary ) {
. Xto_wdoc ( ) ) ;
// use wdoc_bldr to create claims
fxt . Test_scrib_proc_str ( lib , Scrib_lib_wikibase . Invk_getSiteLinkPageName , Object_ . Ary ( " q2 " , " frwiki " ) , " q2_frwiki " ) ; // fails if q2_enwiki
Wdata_doc wdoc = wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_claims ( ary ) . Xto_wdoc ( ) ;
}
}
// extract snaks from claims;
class Wbase_snak_utl_ {
return Get_snaks ( wdata_fxt , wdoc ) ;
public static Keyval [ ] Get_snaks_as_ary ( Wdata_wiki_mgr_fxt wdata_fxt , Wbase_claim_base . . . ary ) {
}
Keyval [ ] rv = Get_snaks_ary ( wdata_fxt , ary ) ;
public static Keyval [ ] Get_snak ( Wdata_wiki_mgr_fxt wdata_fxt , Wbase_claim_base itm ) {
return To_scrib_args ( rv ) ; // EX: ["1":["1":{"property":"P1"},"2":{"property":"P2"}]]
Wdata_doc wdoc = wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_claims ( itm ) . Xto_wdoc ( ) ;
}
Keyval [ ] snak_props = Get_subs_by_path ( Get_snaks ( wdata_fxt , wdoc ) , 0 ) ;
public static Keyval [ ] Get_snaks_as_nde ( Wdata_wiki_mgr_fxt wdata_fxt , String pid , Wbase_claim_base . . . ary ) {
return Keyval_ . Ary ( Keyval_ . int_ ( 1 , snak_props ) ) ;
Keyval [ ] rv = Get_snaks_ary ( wdata_fxt , ary ) ;
}
Keyval kv = Keyval_ . new_ ( pid , rv ) ; // EX: "P1":[{"property":"P2"}]
private static Keyval [ ] Get_snaks ( Wdata_wiki_mgr_fxt wdata_fxt , Wdata_doc wdoc ) {
return To_scrib_args ( Keyval_ . Ary ( kv ) ) ; // EX:["1":[{"P1":[{"property":"P11"}]]} // FOOTNOTE:references.snaks
Keyval [ ] wdoc_root = Scrib_lib_wikibase_srl . Srl ( wdata_fxt . Wdata_mgr ( ) . Prop_mgr ( ) , wdoc , false , false , Bry_ . new_u8 ( " Test_page " ) ) ;
}
Keyval [ ] snaks = Get_subs_by_path ( wdoc_root , 0 , 0 ) ;
private static Keyval [ ] To_scrib_args ( Object arg ) {
int snaks_len = snaks . length ;
Keyval [ ] rv = new Keyval [ 1 ] ;
Keyval [ ] rv = new Keyval [ snaks_len ] ;
rv [ 0 ] = Keyval_ . int_ ( 0 + Scrib_core . Base_1 , arg ) ;
for ( int i = 0 ; i < snaks_len ; + + i ) {
return rv ;
rv [ i ] = Keyval_ . int_ ( i + List_adp_ . Base1 , Get_subs_by_path ( snaks , i , 1 ) ) ;
}
}
private static Keyval [ ] Get_snaks_ary ( Wdata_wiki_mgr_fxt wdata_fxt , Wbase_claim_base . . . ary ) {
return rv ;
// use wdoc_bldr to create claims
}
Wdata_doc wdoc = wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_claims ( ary ) . Xto_wdoc ( ) ;
private static Keyval [ ] Get_subs_by_path ( Keyval [ ] root , int . . . levels ) {
int len = levels . length ;
// extract snaks from claims ;
Keyval [ ] rv = root ;
return Get_snaks ( wdata_fxt , wdoc ) ;
for ( int i = 0 ; i < len ; + + i ) {
}
int idx = levels [ i ] ;
public static Keyval [ ] Get_snak ( Wdata_wiki_mgr_fxt wdata_fxt , Wbase_claim_base itm ) {
rv = ( Keyval [ ] ) rv [ idx ] . Val ( ) ;
Wdata_doc wdoc = wdata_fxt . Wdoc_bldr ( " q2 " ) . Add_claims ( itm ) . Xto_wdoc ( ) ;
}
Keyval [ ] snak_props = Get_subs_by_path ( Get_snaks ( wdata_fxt , wdoc ) , 0 ) ;
return rv ;
return Keyval_ . Ary ( Keyval_ . int_ ( 1 , snak_props ) ) ;
}
}
}
private static Keyval [ ] Get_snaks ( Wdata_wiki_mgr_fxt wdata_fxt , Wdata_doc wdoc ) {
/*
Keyval [ ] wdoc_root = Scrib_lib_wikibase_srl . Srl ( wdata_fxt . Wdata_mgr ( ) . Prop_mgr ( ) , wdoc , false , false , Bry_ . new_u8 ( " Test_page " ) ) ;
==FOOTNOTE:references.snaks==
Keyval [ ] snaks = Get_subs_by_path ( wdoc_root , 0 , 0 ) ;
Explaining this snippet:
int snaks_len = snaks . length ;
Keyval [ ] rv = new Keyval [ snaks_len ] ;
<pre>
for ( int i = 0 ; i < snaks_len ; + + i ) {
return To_scrib_args(Keyval_.Ary(kv)); // EX:["1":[{"P1":[{"property":"P11"}]]}
rv [ i ] = Keyval_ . int_ ( i + List_adp_ . Base1 , Get_subs_by_path ( snaks , i , 1 ) ) ;
</pre>
}
return rv ;
* This occurs as a result of https://ja.wikipedia.org/wiki/Sed_(コンピュータ)
}
* It has an Infobox which will eventually call this https://ja.wikipedia.org/wiki/Module:WikidataIB
private static Keyval [ ] Get_subs_by_path ( Keyval [ ] root , int . . . levels ) {
int len = levels . length ;
<pre>
Keyval [ ] rv = root ;
local sourced = function(claim)
for ( int i = 0 ; i < len ; + + i ) {
if claim.references then
int idx = levels [ i ] ;
for kr, vr in pairs(claim.references) do
rv = ( Keyval [ ] ) rv [ idx ] . Val ( ) ;
local ref = mw.wikibase.renderSnaks(vr.snaks)
}
if not ref:find("Wikipedia") then
return rv ;
return true
}
end
}
end
/*
end
==FOOTNOTE:references.snaks==
end
Explaining this snippet:
<pre>
<pre>
Checking then with https:/www.wikidata.org/wiki/Property:P3966
return To_scrib_args(Keyval_.Ary(kv)); // EX:["1":[{"P1":[{"property":"P11"}]]}
<pre>
</ pre>
, "references":
[
* This occurs as a result of https://ja.wikipedia.org/wiki/Sed_(コンピュータ)
{ "hash":"fa278ebfc458360e5aed63d5058cca83c46134f1"
* It has an Infobox which will eventually call this https://ja.wikipedia.org/wiki/Module:WikidataIB
, "snaks":
{ "P143":
<pre>
[
local sourced = function(claim)
{ "snaktype":"value"
if claim.references then
, "property":"P143"
for kr, vr in pairs(claim.references) do
, "hash":"e4f6d9441d0600513c4533c672b5ab472dc73694"
local ref = mw.wikibase.renderSnaks(vr.snaks)
, "datavalue":
if not ref:find("Wikipedia") then
{ "value":
return true
{ "entity-type":"item"
end
, "numeric-id":328
end
, "id":"Q328"
end
}
end
, "type":"wikibase-entityid"
<pre>
}
}
Checking then with https:/www.wikidata.org/wiki/Property:P3966
]
<pre>
}
, "references":
, "snaks-order":
[
[ "P143 "
{ "hash":"fa278ebfc458360e5aed63d5058cca83c46134f1 "
]
, "snaks":
}
{ "P143":
]
[
}
{ "snaktype":"value"
</pre>
, "property":"P143"
, "hash":"e4f6d9441d0600513c4533c672b5ab472dc73694"
That means claims.references.snaks is this
, "datavalue":
<pre>
{ "value":
{ "P143":
{ "entity-type":"item"
[
, "numeric-id":328
{ "snaktype":"value "
, "id":"Q328 "
, "property":"P143"
}
, "hash":"e4f6d9441d0600513c4533c672b5ab472dc73694 "
, "type":"wikibase-entityid "
, "datavalue":
}
{ "value":
}
{ "entity-type":"item"
]
, "numeric-id":328
}
, "id":"Q328"
, "snaks-order":
}
[ "P143"
, "type":"wikibase-entityid"
]
}
}
}
]
]
}
}
</pre>
</pre>
That means claims.references.snaks is this
Now, going back to "To_scrib_args(Keyval_.Ary(kv))"
<pre>
* "kv" represents "P1":[{"property":"P11"}
{ "P143":
* "kv" gets wrapped in Keyval_.Ary b/c SnakDeserialization will deserialize into key/val pairs; '{"P1":[{"property":"P11"}]}' '["P1":[["property":"P11"]]]'
[
* "To_scrib_args()" will put the entire thing as '["1":...]'
{ "snaktype":"value"
, "property":"P143"
, "hash":"e4f6d9441d0600513c4533c672b5ab472dc73694"
, "datavalue":
{ "value":
{ "entity-type":"item"
, "numeric-id":328
, "id":"Q328"
}
, "type":"wikibase-entityid"
}
}
]
}
</pre>
Now, going back to "To_scrib_args(Keyval_.Ary(kv))"
* "kv" represents "P1":[{"property":"P11"}
* "kv" gets wrapped in Keyval_.Ary b/c SnakDeserialization will deserialize into key/val pairs; '{"P1":[{"property":"P11"}]}' '["P1":[["property":"P11"]]]'
* "To_scrib_args()" will put the entire thing as '["1":...]'
*/
*/