1 $group
2 $
3 var sect = {
4 title: 'The "wfschema" schema'
5 };
6 section( §)
7 p The
8 high-code( wfschema )
9 + schema, implemented by the ${}
10 to-plugin( wizzi-core )
11 + plugin, is the meta model of a Wizzi Schema.
12 \b It models a Wizzi Schema with the same semantic with which
13 \b a Wizzi Schema models a Wizzi Model DOM.
14 div
15 + In short:
16 ul
17 li A Wizzi Schema describes a model in terms of element types,
18 \b with attributes, and relations between elements.
19 \b Elements can extend super elements. Relations, that
20 \b do not have attributes, can be of kind parent-children (one-to-many, the default)
21 \b or parent-singlechild (one-to-one).
22 li Elements are described in a flat list. Relations hierarchy and
23 \b element derivations are inferred from definitions.
24 li The root element can be declared using the element attribute 'isRoot'. If
25 \b not declared the root element is the first of the list.
26 li Elements and attributes may have an optional tag attribute that defines a
27 \b name alias shorter or with an easier mnemonic.
28 high-code( wfschema )
29 + examples:
30 ul
31 li 'e' for 'element'
32 li 'a' for 'attribute'
33 li 'r' for 'relation'
34 li Node names of ${}
35 to-docs( mTree )
36 + nodes simply map to an element or attribute tag (or name,
37 \b if a tag is not declared).
38 div
39 + The wfschema elements are
40 ul
41 li wfschema
42 li exportTo
43 li require
44 li element
45 li attribute, string, boolean, integer, float, date
46 li relation
47 li restrict, enum, minLength, maxLength, minValue, maxValue, regexp
48 li method, function
49 li parameter
50 . doc-title-2
51 + wfschema element
52 p The root element of a
53 high-code( wfschema )
54 ittf-panel
55 ittf
56 e wfschema `name`
57 r require/s
58 r exportTo/s
59 r element/s
60 . doc-title-2
61 + exportTo element
62 p An exportTo element causes the insertion in the Wizzi Model classes
63 \b of the prototype functions for exporting the tree data structure of the model in
64 \b the requested format
65 ul
66 li toJson()
67 li toXml()
68 p The entire Wizzi Model can be exported calling this methods on the root element.
69 ittf-panel
70 ittf
71 ...
72 e export-to [json|xml]
73 . doc-title-2
74 + require element
75 p A Wizzi Model DOM can contain user defined methods and functions,
76 \b that could need to import objects from other modules. This element
77 \b allow to insert require statements in the generated Wizzi Model DOM module.
78 ittf-panel
79 ittf
80 e require `import-name`
81 string declareVar `name`
82 tag declare-var
83 optional
84 default `import-name`
85 string invoke `invoke-string`
86 optional
87 string kind [module]
88 # At now we have only one kind, and this attribute is superflous.
89 # Other kinds could be added in the future.
90 optional
91 default module
92 p The generated statement is built in this way:
93 ittf-panel
94 ittf
95 var `declareVar` = require('`import-name`')[`invoke`]
96 p Example
97 ittf-panel
98 ittf
99 ...
100 require wizzi-utils
101 declare-var verify
102 invoke .verify
103 generates:
104 var verify = require('wizzi-utils').verify
105 . doc-title-2
106 + Element element
107 p Describes an element type of the schema.
108 ittf-panel
109 ittf
110 e element `name` [: `super-element-name`]
111 tag e
112 string super `super-element-name`
113 string tag `tag`
114 string xmlTag `tag`
115 tag xml-tag
116 boolean isAbstract
117 tag is-abstract
118 default-when-declared true
119 boolean isRoot
120 tag is-root
121 default-when-declared true
122 boolean nameIsRequired
123 tag name-is-required
124 default-when-declared true
125 boolean addToChildren
126 tag add-to-children
127 default-when-declared true
128 r attribute/s
129 r relation/s
130 r method/s
131 . doc-title-2
132 + Relation element
133 ittf-panel
134 ittf
135 e relation `related-element-name`[-`plural-suffix-a`]/`plural-suffix-b`
136 # Examples
137 # r column/s (element: column, collection: columns)
138 # r propert-y/ies (element: property, collection: properties)
139 tag r
140 boolean oneToOne
141 tag one-to-one
142 default-when-declared true
143 boolean noGet
144 tag no-get
145 default-when-declared true
146 p Example:
147 ittf-panel
148 ittf
149 ...
150 e table : dbitem
151 r column/s
152 r propert-y/ies
153 r displayLayout
154 one-to-one
155 p related-element-name plus the eventual plural-suffix-a must give the name of an
156 \b element defined in the schema (that is the related element); in the
157 \b example: column, property, displayLayout.
158 . doc-title-2
159 + attribute element
160 p Describes an attribute of an element
161 ittf-panel
162 ittf
163 e attribute `name`
164 tag a
165 string tag `tag`
166 string xmlTag `tag`
167 tag xml-tag
168 string type [string|integer|float|boolean|date]
169 default string
170 string default `default-value`
171 string defaultWhenDeclared `default-value`
172 tag default-when-declared
173 boolean isDatatype
174 tag is-datatype
175 default-when-declared true
176 boolean isRequired
177 tag is-required
178 default-when-declared true
179 r restrict/s
180 . doc-title-2
181 + string element
182 ittf-panel
183 ittf
184 e string `attribut-name` : attribute
185 . doc-title-2
186 + boolean element
187 ittf-panel
188 ittf
189 e boolean `attribut-name` : attribute
190 . doc-title-2
191 + integer element
192 ittf-panel
193 ittf
194 e integer `attribut-name` : attribute
195 . doc-title-2
196 + float element
197 ittf-panel
198 ittf
199 e float `attribut-name` : attribute
200 . doc-title-2
201 + date element
202 ittf-panel
203 ittf
204 e date `attribut-name` : attribute
205 . doc-title-2
206 + restrict element
207 ittf-panel
208 ittf
209 e restrict
210 is-abstract
211 . doc-title-2
212 + enum element
213 ittf-panel
214 ittf
215 e enum `enum-value` : restrict
216 . doc-title-2
217 + maxLength element
218 ittf-panel
219 ittf
220 e maxLength `value` : restrict
221 tag max-length
222 . doc-title-2
223 + minLength element
224 ittf-panel
225 ittf
226 e minLength `value` : restrict
227 tag min-length
228 . doc-title-2
229 + maxValue element
230 ittf-panel
231 ittf
232 e maxValue `value` : restrict
233 tag max-value
234 . doc-title-2
235 + minValue element
236 ittf-panel
237 ittf
238 e minValue `value` : restrict
239 tag min-value
240 . doc-title-2
241 + regexp element
242 ittf-panel
243 ittf
244 e regexp `value` : restrict
245 . doc-title-2
246 + method element
247 p Declares a method that will be added to the element class.
248 \b A method can access and manipulate the entire
249 \b Wizzi Model instance, having access to the
250 high-code( this.wzRoot )
251 + method of the
252 high-code( {schema-name}Base )
253 + class.
254 ittf-panel
255 ittf
256 e method `name`
257 tag m
258 r param/s
259 r statement/s
260 . doc-title-2
261 + param element
262 ittf-panel
263 ittf
264 e param `name`
265 . doc-title-2
266 + statement element
267 p The statement element uses a subset of the schema
268 high-code( js )
269 + implemented by the plugin
270 to-plugin( wizzi-js )
271 + .
272 . doc-title-2
273 + function element
274 p Declares a method that will be added to the module
275 \b and will be a private function for methods of the model instances.
276 ittf-panel
277 ittf
278 e function `name`
279 tag m
280 r param/s
281 r statement/s