mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Wikibase: Return 'property' not 'item' if wikidata page is Property:
This commit is contained in:
parent
fc55d0e2f9
commit
6e39f9979d
@ -22,8 +22,10 @@ class Scrib_lib_wikibase_srl {
|
||||
int base_adj = legacy_style ? 0 : 1;
|
||||
List_adp rv = List_adp_.New();
|
||||
if (header_enabled) {
|
||||
rv.Add(Keyval_.new_("id", wdoc.Qid()));
|
||||
rv.Add(Keyval_.new_("type", Wbase_claim_entity_type_.Itm__item.Key_str()));
|
||||
byte[] qid = wdoc.Qid();
|
||||
boolean doc_is_qid = Bry_.Has_at_bgn(qid, Byte_ascii.Ltr_q) || Bry_.Has_at_bgn(qid, Byte_ascii.Ltr_Q);
|
||||
rv.Add(Keyval_.new_("id", qid));
|
||||
rv.Add(Keyval_.new_("type", doc_is_qid ? Wbase_claim_entity_type_.Itm__item.Key_str() : Wbase_claim_entity_type_.Itm__property.Key_str())); // type should be "property"; PAGE:ru.w:Викитека:Проект:Викиданные DATE:2016-11-23
|
||||
rv.Add(Keyval_.new_("schemaVersion", base_adj + 1)); // NOTE: needed by mw.wikibase.lua
|
||||
}
|
||||
Srl_root(rv, Wdata_doc_parser_v2.Str_labels , Srl_langtexts (Wdata_dict_langtext.Itm__language.Key_str(), Wdata_dict_langtext.Itm__value.Key_str(), wdoc.Label_list()));
|
||||
|
@ -368,6 +368,26 @@ public class Scrib_lib_wikibase_srl_tst {
|
||||
Gftest.Eq__str("timezone", keyval.Key());
|
||||
Gftest.Eq__int(0, (int)keyval.Val()); // fails when keyval.Val() is String; DATE:2016-10-28
|
||||
}
|
||||
@Test public void Type_is_property() { // PURPOSE: type should be "property"; PAGE:ru.w:Викитека:Проект:Викиданные DATE:2016-11-23
|
||||
fxt.Init_header_enabled_y_();
|
||||
fxt.Wdata_fxt().doc_("Property:P1", fxt.Wdata_fxt().Make_claim_string(123, "abc"));
|
||||
fxt.Test
|
||||
( "id:'Property:P1'"
|
||||
, "type:'property'"
|
||||
, "schemaVersion:'2'"
|
||||
, ""
|
||||
);
|
||||
}
|
||||
@Test public void Type_is_item() { // PURPOSE: type should be "item"; PAGE:ru.w:Викитека:Проект:Викиданные DATE:2016-11-23
|
||||
fxt.Init_header_enabled_y_();
|
||||
fxt.Wdata_fxt().doc_("Q2", fxt.Wdata_fxt().Make_claim_string(123, "abc"));
|
||||
fxt.Test
|
||||
( "id:'Q2'"
|
||||
, "type:'item'"
|
||||
, "schemaVersion:'2'"
|
||||
, ""
|
||||
);
|
||||
}
|
||||
}
|
||||
class Scrib_lib_wikibase_srl_fxt {
|
||||
private Wdata_doc_bldr wdoc_bldr;
|
||||
|
@ -76,7 +76,7 @@ public class Scrib_lib_wikibase_tst {
|
||||
fxt.Test_scrib_proc_str_ary(lib, Scrib_lib_wikibase.Invk_getEntity, Object_.Ary("p2", false), String_.Concat_lines_nl_skip_last
|
||||
( "1="
|
||||
, " id=Property:p2" // only difference from above
|
||||
, " type=item"
|
||||
, " type=property" // also, type should be "property"; PAGE:ru.w:Викитека:Проект:Викиданные DATE:2016-11-23
|
||||
, " schemaVersion=2"
|
||||
, " labels="
|
||||
, " en="
|
||||
|
Loading…
Reference in New Issue
Block a user