1
+ namespace org.accordproject.cicero.dom
2
+
3
+ import org.accordproject.cicero.contract.AccordParty from https://models.accordproject.org/cicero/contract.cto
4
+
5
+ /**
6
+ * Describes the structure of the natural language and automated clauses for
7
+ * contract and clause templates.
8
+ *
9
+ * Scoping
10
+ * =======
11
+ *
12
+ * The @scope annotation is used to tag elements that can only be used in
13
+ * clause templates, contract templates or used in both.
14
+ *
15
+ * Elements tagged with the ContractTemplate scope may appear in the DOM tree
16
+ * under a root ContractTemplate.
17
+ *
18
+ * Elements tagged with the ClauseTemplate scope may appear in the DOM tree
19
+ * under the root ClauseTemplate.
20
+ *
21
+ * Elements tagged with both ContractTemplate and ClauseTemplate may appear
22
+ in the DOM tree for either a ContractTemplate or ClauseTemplate.
23
+ */
24
+
25
+ /**
26
+ * DOM metadata
27
+ */
28
+ concept Metadata {
29
+ o String version default="1.0" // version of the DOM
30
+ o String locale default="en-US" // Default locale. IETF Language Tag specification (BCP 47)
31
+ }
32
+
33
+ /**
34
+ * An abstract base type
35
+ */
36
+ abstract asset Element identified by id {
37
+ o String id
38
+ }
39
+
40
+ /**
41
+ * Root type for contract templates
42
+ */
43
+ asset ContractTemplate extends Element {
44
+ o Metadata metadata
45
+ o Section content optional
46
+ }
47
+
48
+ /**
49
+ * Root type for clause templates
50
+ */
51
+ @scope(ContractTemplate)
52
+ asset ClauseTemplate extends Element {
53
+ o Metadata metadata
54
+ o Section content optional
55
+ }
56
+
57
+ /**
58
+ * A block of (unparameterized) natural language text in a template
59
+ */
60
+ @scope(ContractTemplate, ClauseTemplate)
61
+ asset Text extends Element {
62
+ o String content
63
+ o String locale optional // if not specified inherits the locale of the owning clause or contract
64
+ }
65
+
66
+ /**
67
+ * A parameter in a template. The parameter has a name and optionally a fully-qualified type name
68
+ * and a description. If the type name is present then the type MUST NOT be present in the template model
69
+ * for the contract or clause and will be dyanmically added. If the type is not present then the template
70
+ * model MUST HAVE a property with the name.
71
+ */
72
+ @scope(ContractTemplate, ClauseTemplate)
73
+ asset Parameter extends Element {
74
+ o String name // the name of the parameter
75
+ o String description optional
76
+ o String type optional // the type of the parameter if defined inline. If not specified the parameter must be in the template model.
77
+ o BooleanExpression constraint optional // An expression to constrain the parameter.
78
+ }
79
+
80
+ /**
81
+ * An element that must be one of a set of options.
82
+ */
83
+ @scope(ContractTemplate, ClauseTemplate)
84
+ asset Choice extends Element {
85
+ o Element[] options
86
+ o Boolean required
87
+ }
88
+
89
+ /**
90
+ * An element that must be included if a predicate is true
91
+ */
92
+ @scope(ContractTemplate, ClauseTemplate)
93
+ asset Conditional extends Element {
94
+ o Element element
95
+ o BooleanExpression predicate
96
+ }
97
+
98
+ /**
99
+ * A reference to a clause via a URI. The URI scheme is opaque to the specification
100
+ * but can include external clauses with URIs like ap://
[email protected] #8fd9219cf577fe121cdd05d7b0c340fbe0755dc8aec3c6ff818d3b4e5d5a863f
101
+ * or internal clauses with URIs like internal://MyContractSpecificClause
102
+ */
103
+ @scope(ContractTemplate)
104
+ abstract asset Clause extends Element {
105
+ o String templateUri
106
+ }
107
+
108
+ /**
109
+ * A concept that captures the description and reference to a signing party to the contract
110
+ */
111
+ @scope(ContractTemplate)
112
+ concept SigningParty {
113
+ o Text description
114
+ --> AccordParty party
115
+ }
116
+
117
+ /**
118
+ * A set of signing parties for a contract
119
+ */
120
+ @scope(ContractTemplate)
121
+ asset Signatures extends Element {
122
+ o SigningParty[] parties
123
+ }
124
+
125
+ /**
126
+ * A link to an element in the contract.
127
+ */
128
+ @scope(ContractTemplate, ClauseTemplate)
129
+ asset Link extends Element {
130
+ --> Element reference
131
+ }
132
+
133
+ /**
134
+ * A section of a contract or clause. A section has a heading
135
+ * and an optional set of child elements. A section can optionally include
136
+ * a page break.
137
+ */
138
+ @scope(ContractTemplate, ClauseTemplate)
139
+ asset Section extends Element {
140
+ o Text heading
141
+ o Element[] children optional
142
+ o Boolean pageBreak default=false
143
+ }
144
+
145
+ /**
146
+ * List styles to support both ordered (numbered) lists, unordered (bullet) lists
147
+ * and lists displayed on a single line
148
+ */
149
+ enum ListStyle {
150
+ o ORDERED // numbers
151
+ o UNORDERED // bullets
152
+ o SINGLE_LINE // a separated list on a single line
153
+ }
154
+
155
+ /**
156
+ * A list is a section that numbers or bullets its child elements
157
+ */
158
+ @scope(ContractTemplate, ClauseTemplate)
159
+ asset List extends Section {
160
+ o ListStyle style
161
+ o String separator optional
162
+ }
163
+
164
+ /**
165
+ * Logic can be inlined in contracts or clauses
166
+ */
167
+ abstract asset Script extends Element {
168
+ o String language default="ERGO"
169
+ o String version
170
+ o String code
171
+ }
172
+
173
+ /**
174
+ * Logic declarations (constants, functions) can be included in a contract to perform basic calculations
175
+ */
176
+ @scope(ContractTemplate)
177
+ asset Declarations extends Script {
178
+ }
179
+
180
+ /**
181
+ * Expressions can be included to construct part of the output contract or check constraints on parameters
182
+ */
183
+ abstract asset Expression extends Script {
184
+ }
185
+
186
+
187
+ /**
188
+ * An expression to that returns an element
189
+ */
190
+ @scope(ContractTemplate, ClauseTemplate)
191
+ asset ElementExpression extends Expression{
192
+ }
193
+
194
+ /**
195
+ * An expression that returns true or false
196
+ */
197
+ asset BooleanExpression extends Expression{
198
+ }
0 commit comments