Repository navigation
Expand file tree
/
Copy pathtemplate.example.jsonc
More file actions
75 lines (63 loc) · 3.13 KB
/
Copy pathtemplate.example.jsonc
File metadata and controls
75 lines (63 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// ============================================================
// usefulQueries — Template Format Reference
// ============================================================
// Annotated skeletons only. The full guide, including how to choose the
// scope and how to write SPARQL that runs on WDQS and QLever, is
// TEMPLATE_GUIDE.md. Real templates are plain JSON: no comments.
//
// Place query templates in: templates/queries/<name>.json
// Place link templates in: templates/links/<name>.json
// ============================================================
// ── QUERY TEMPLATE ──────────────────────────────────────────
{
// Identifier, usually the file name. Documentation only.
"id": "myQueryId",
// An item where the button appears AND the query returns rows. Required.
"example": "Q1726",
// Where the button is attached:
// "entity" → next to the item title, on every item
// "property" → next to the property label; for queries that use ALL of
// the property's values together, or none of them
// "value" → next to each statement value; for queries whose result
// depends on the clicked value ({valueQid}), or — with
// valueId — to show the button only for certain values
"scope": "value",
// Properties that trigger the button. Always an array.
// Required for "property"/"value", forbidden for "entity".
"propertyId": ["P19"],
// "value" scope only: QIDs the value must equal. Omit or null = any value.
"valueId": null,
// The SPARQL query, one line per array entry. Placeholders:
// {itemQid} QID of the current item (all scopes)
// {itemLabel} label of the current item (all scopes)
// {userLanguage} user's interface language code (all scopes)
// {propertyPid} PID the button sits on ("property" and "value")
// {valueQid} the clicked value as a SPARQL term ("value" only):
// Q1726 for items (write wd:{valueQid}), "91E23" with
// quotes for strings/external IDs
// {valueLabel} readable form of the value ("value" only)
// {valueLat} / {valueLon} — coordinates of a P625 value ("value" only)
"template": [
"SELECT ?person ?personLabel WHERE {",
" ?person wdt:P19 wd:{valueQid}.",
" SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],en\". }",
"}",
"LIMIT 100"
],
// Button label.
"emoji": "👶",
// Tooltip and popup heading. Same placeholders as the template.
"title": "People born in {valueLabel}"
}
// ── LINK TEMPLATE ────────────────────────────────────────────
{
"id": "myLinkId",
"example": "Q9682",
// Same scope / propertyId / valueId rules as query templates.
"scope": "property",
"propertyId": ["P22", "P25"],
// Absolute http(s) URL, opened in a new tab. Same placeholders as above.
"urlTemplate": "https://entitree.com/{userLanguage}/family_tree/{itemQid}",
"emoji": "🌳",
"title": "Family tree on Entitree"
}