Wikipedia:Lua/Modul/WikidataScheme/Gadget
Vorlagenprogrammierung | Diskussionen | Lua | Unterseiten | |||
Modul | Deutsch | English
|
Modul: | Dokumentation |
This page describes how an interactive JavaScript gadget might help on creation or maintenance of Wikidata items utilizing a WikidataScheme specification.
- A WikidataScheme specification which has agreed upon and provides a lot of hints and codes may be exploited to generate a gadget interface on the fly.
- All P-numbers of properties are known. They tell expected type like string, number, item, URL, date or whatever. Even constraints are known and may be applied to input fields.
- All Q-numbers of frequently used items are known. They may be used to create multi-selection combobox lists to feed the properties, or by elements which may be moved into a container via drag&drop.
- If suggested items and properties and qualifieres do not cover the current task further fields and entries may be created. Search support is expected in the same way as on NewItem page.
- Naturally all available texts shall be displayed in user language or at least a close fallback.
- When all fields have been satisfied, the entire set shall be published at once.
- Definition needs to be grabbed as JSON from advertised page. A specific selector has to be provided there, e.g.
class="WikidataScheme-JSON"
andid=Q2865819
. - The gadget may be executed at home context of the user, but will save results at Wikidata. This needs some robust implementation and fallback handlers, but should work with SUL accounts.
- Note that JSON text elements may contain limited Wikitext and HTML markup. That is to be expanded, and whitelist is applied to sanitize for security reasons.
Example
[Quelltext bearbeiten]{ "@generated": "2024-11-05T22:46:54+01:00",
"@format": "WikidataScheme 2019-12-16",
"caption": "Q2865819",
"claims": [
{ "subject": "P31",
"state": "required",
"values": [
{
"q": "Q5"
}
]
},
{ "subject": "P21",
"state": "required",
"values": [
{
"qlist": [ "Q6581072",
"Q6581097",
true ]
}
]
},
{ "subject": "P734",
"state": "required"
},
{ "subject": "P735",
"state": "suggested"
},
{ "subject": "P1787",
"state": "optional"
},
{ "subject": "P1477",
"state": "optional"
},
{ "subject": "P569",
"state": "suggested"
},
{ "subject": "P19",
"state": "suggested"
},
{ "subject": "P570",
"state": "suggested"
},
{ "subject": "P20",
"state": "suggested"
},
{ "subject": "P106",
"state": "required",
"values": [
{
"qlist": [ "Q2865819",
"Q2259451",
"Q10800557",
"Q177220",
true ]
}
]
},
{ "subject": "P412",
"state": "required",
"values": [
{
"qlist": [ "Q30903",
"Q186506",
"Q37137",
"Q223166",
"Q27914",
"Q31687",
"Q27911",
"Q193935",
true ]
}
]
},
{ "subject": "P136",
"state": "suggested",
"values": [
{
"qlist": [ "Q1344",
"Q170384",
"Q2743",
true ]
}
]
},
{ "subject": "P1303",
"state": "required",
"values": [
{
"qlist": [ "Q17172850",
"Q5994",
true ]
}
]
}
]
}