Wikipedia:Lua/Modul/WikidataScheme/Gadget
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
{ "@generated": "2026-08-12T17:45:04+02: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 ]
}
]
}
]
}
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.