1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2025-06-02 07:24:19 +00:00

Wikibase: Add 'datatype' property to 'Property:' pages

This commit is contained in:
gnosygnu 2017-03-27 10:04:10 -04:00
parent 7e476fde06
commit f8f8fa3c3b
3 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,12 @@ class Scrib_lib_wikibase_srl {
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
// for Property pages, add a "datatype" property PAGE:ru.w:Маргарян,_Андраник_Наапетович; wd:Property:P18; DATE:2017-03-27
if (!doc_is_qid) {
String pid_name = String_.new_u8(Bry_.Mid(qid, Wdata_wiki_mgr.Ns_property_name_bry.length + 1));// +1 for ":" in "Property:"
rv.Add(Keyval_.new_("datatype", prop_mgr.Get_or_null(pid_name)));
}
}
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()));
Srl_root(rv, Wdata_doc_parser_v2.Str_descriptions , Srl_langtexts (Wdata_dict_langtext.Itm__language.Key_str(), Wdata_dict_langtext.Itm__value.Key_str(), wdoc.Descr_list()));

View File

@ -387,12 +387,14 @@ public class Scrib_lib_wikibase_srl_tst {
);
}
@Test public void Type_is_property() { // PURPOSE: type should be "property"; PAGE:ru.w:Викитека:Проект:Викиданные DATE:2016-11-23
fxt.Wdata_fxt().Wdata_mgr().Prop_mgr().Loader_(Wbase_prop_mgr_loader_.New_mock(Keyval_.new_("P1", "commonsMedia")));
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'"
, "datatype:'commonsMedia'"
, ""
);
}

View File

@ -76,6 +76,7 @@ public class Scrib_lib_wikibase_tst {
, " id=Property:p2" // only difference from above
, " type=property" // also, type should be "property"; PAGE:ru.w:Викитека:Проект:Викиданные DATE:2016-11-23
, " schemaVersion=2"
, " datatype=<<NULL>>"
, " labels="
, " en="
, " language=en"