github.com/gemaraproj/gemara@v1.3.0

lexicon.cue raw

 1// SPDX-License-Identifier: Apache-2.0
 2
 3// Schema lifecycle: experimental | stable | deprecated
 4@status("experimental")
 5package gemara
 6
 7@go(gemara)
 8
 9// Lexicon is a controlled vocabulary or glossary artifact referenced by Metadata.lexicon
10#Lexicon: {
11	// title describes the purpose of this lexicon at a glance
12	title: string
13
14	// metadata provides detailed data about this document
15	metadata: #Metadata @go(Metadata)
16	metadata: type: "Lexicon"
17
18	// terms is one or more defined entries for linking and rendering
19	terms: [#LexiconTerm, ...#LexiconTerm] @go(Terms)
20
21	_uniqueTermIds: {for i, t in terms {(t.id): i}}
22}
23
24// LexiconTerm is a single definition within a lexicon
25#LexiconTerm: {
26	// id allows this entry to be referenced for anchors and tooling
27	id: string
28
29	// title is the canonical name of the defined concept
30	title: string
31
32	// definition explains the meaning of the term
33	definition: string
34
35	// synonyms lists alternative labels that should resolve to this term for linking
36	synonyms?: [string, ...string] @go(Synonyms)
37
38	// references cites external authorities supporting the definition
39	references?: [#LexiconReference, ...#LexiconReference] @go(References)
40}
41
42// LexiconReference cites a source supporting a lexicon definition
43#LexiconReference: {
44	// citation identifies the source material in prose
45	citation: string
46
47	// url points to supporting material when available
48	url?: =~"^(https?|file)://[^\\s]+$"
49}