Project

General

Profile

Bug #486 » eml-constraint.xsd

David Blankman, 05/24/2002 11:07 AM

 
1
<?xml version="1.0"?>
2
<xs:schema targetNamespace="eml:constraint-2.0.0beta8" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:doc="eml:documentation-2.0.0beta8" xmlns="eml:constraint-2.0.0beta8">
3
  <xs:import namespace="eml:documentation-2.0.0beta8" schemaLocation="eml-documentation.xsd"/>
4
  <xs:annotation>
5
    <xs:documentation>
6
       '$RCSfile: eml-constraint.xsd,v $'
7
       Copyright: 2000 Regents of the University of California and the
8
                  National Center for Ecological Analysis and Synthesis
9
     For Details: http://knb.ecoinformatics.org/
10
  
11
        '$Author: berkley $'
12
          '$Date: 2002/04/21 22:45:30 $'
13
      '$Revision: 1.15 $'
14
    
15
    This program is free software; you can redistribute it and/or modify
16
    it under the terms of the GNU General Public License as published by
17
    the Free Software Foundation; either version 2 of the License, or
18
    (at your option) any later version.
19
  
20
    This program is distributed in the hope that it will be useful,
21
    but WITHOUT ANY WARRANTY; without even the implied warranty of
22
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
    GNU General Public License for more details.
24
  
25
    You should have received a copy of the GNU General Public License
26
    along with this program; if not, write to the Free Software
27
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
    </xs:documentation>
29
    <xs:appinfo>
30
      <doc:moduleName>eml-constraint</doc:moduleName>
31
      <doc:moduleDescription>
32
        This schema defines the integrity constraints between entities 
33
        (e.g., data tables) as would be maintained in a relational database. 
34
        These constraints include
35
        primary key constraints, foreign key constraints, unique key
36
        constraints, check constraints, and not null constraints, 
37
        among potential others.
38
      </doc:moduleDescription>
39
    </xs:appinfo>
40
  </xs:annotation>
41
  <xs:element name="constraint">
42
    <xs:annotation>
43
      <xs:appinfo>
44
        <doc:tooltip>
45
          Relational integrity constraint descriptors
46
        </doc:tooltip>
47
        <doc:summary>
48
          Describes the relational integrity constraints of a relational 
49
          database.
50
        </doc:summary>
51
        <doc:description>
52
          Describes the relational integrity constraints of a relational 
53
          database.  This includes primary keys, foreign keys, unique keys, etc.
54
          When an eml-constraint module is created, it should be linked into
55
          a dataset using the "triple" element, and all of the entities that
56
          are referenced in the constraints should be accessible within that 
57
          same package.
58
        </doc:description>
59
        <doc:example/>
60
        <doc:lineage>
61
           New in EML 2.0
62
        </doc:lineage>
63
      </xs:appinfo>
64
    </xs:annotation>
65
    <xs:complexType>
66
      <xs:sequence>
67
        <xs:element name="identifier"/>
68
        <xs:element name="ConstraintBase" type="ConstraintBase"/>
69
      </xs:sequence>
70
    </xs:complexType>
71
  </xs:element>
72
  <xs:complexType name="ConstraintDefinitionBase">
73
    <xs:sequence>
74
      <xs:annotation>
75
        <xs:appinfo>
76
          <doc:tooltip>
77
              Name of the constraint
78
            </doc:tooltip>
79
          <doc:summary>
80
              A meaningfull name of the constraint.
81
            </doc:summary>
82
          <doc:description>
83
              The constraint name represents a human readible and meaningful name for the constraint.
84
            </doc:description>
85
          <doc:example>
86
             PrimaryKey_birdSurvey 
87
            </doc:example>
88
          <doc:lineage>
89
              New in EML 2.0.0.
90
            </doc:lineage>
91
        </xs:appinfo>
92
      </xs:annotation>
93
      <xs:element name="constraintName" type="xs:string"/>
94
      <xs:element name="constraintDescription" minOccurs="0">
95
        <xs:annotation>
96
          <xs:appinfo>
97
            <doc:tooltip>
98
              Description  of the constraint
99
            </doc:tooltip>
100
            <doc:summary>
101
             Descibes the purpose of the constraint.
102
            </doc:summary>
103
            <doc:description>
104
              The constraint description element describes the nature of the 
105
              constraint. It might be a description of a check condition, or a
106
              statement about the composition of a primary key or the nature 
107
              of the relationship between two database tables or two ascii files.
108
             
109
            </doc:description>
110
            <doc:example>
111
             1.Must be greater than 0 but less than 100 
112
             2. "The primary key of the table BIRD_SURVEY is composed of
113
              two attributes:speciesCode and observationDate 
114
             3. The species name associated with the species code in survey.txt
115
              can be found in the file speciesList.txt
116
            </doc:example>
117
            <doc:lineage>
118
              New in EML 2.0.0.
119
            </doc:lineage>
120
          </xs:appinfo>
121
        </xs:annotation>
122
      </xs:element>
123
      <xs:element name="entityID" type="xs:string">
124
        <xs:annotation>
125
          <xs:appinfo>
126
            <doc:tooltip>Constrained Entity</doc:tooltip>
127
            <doc:summary>
128
                      Entity to which this constraint applies
129
                    </doc:summary>
130
            <doc:description>
131
                       Entity to which this constraint applies.  This should be
132
                       an identifer that matches one of the "identifier" 
133
                       elements for an entity that is linked into the package
134
                       with a triple.  The constraint document itself should be
135
                       linked into the package as a member.
136
                    </doc:description>
137
            <doc:example>
138
                       knb.78.3
139
                    </doc:example>
140
            <doc:lineage>
141
                      New in EML 2.0.0
142
                    </doc:lineage>
143
          </xs:appinfo>
144
        </xs:annotation>
145
      </xs:element>
146
    </xs:sequence>
147
  </xs:complexType>
148
  <xs:complexType name="ConstraintBase">
149
    <xs:choice>
150
      <xs:element name="primaryKey">
151
        <xs:complexType>
152
          <xs:complexContent>
153
            <xs:extension base="ConstraintDefinitionBase">
154
              <xs:sequence>
155
                <xs:element name="key" minOccurs="0">
156
                  <xs:annotation>
157
                    <xs:appinfo>
158
                      <doc:tooltip>Key</doc:tooltip>
159
                      <doc:summary>
160
                      The set of attributes to which this constraint applies.
161
                    </doc:summary>
162
                      <doc:description>
163
                      The set of attributes to which this constraint applies.  
164
                      For a primary key or a unique key, the set of attributes
165
                      must be identifying.  For a foreign key, the set of
166
                      attributes must match an identifying key in the referenced
167
                      entity.  For a not null constraint, the key indicates the
168
                      attribute which should not be null.
169
                    </doc:description>
170
                      <doc:example/>
171
                      <doc:lineage>New in EML 2.0</doc:lineage>
172
                    </xs:appinfo>
173
                  </xs:annotation>
174
                  <xs:complexType>
175
                    <xs:sequence>
176
                      <xs:element name="attributeName" type="xs:string" maxOccurs="unbounded">
177
                        <xs:annotation>
178
                          <xs:appinfo>
179
                            <doc:tooltip>Attribute Name</doc:tooltip>
180
                            <doc:summary>
181
                      Name of an attribute found in the identified entity
182
                      </doc:summary>
183
                            <doc:description>
184
                      Name of an attribute that can be found in the identified
185
                      entity.  This name will be unique within an entity and
186
                      specifies that the attribute participates in the key that
187
                      is being defined.
188
                      </doc:description>
189
                            <doc:example/>
190
                            <doc:lineage>New in EML 2.0</doc:lineage>
191
                          </xs:appinfo>
192
                        </xs:annotation>
193
                      </xs:element>
194
                    </xs:sequence>
195
                  </xs:complexType>
196
                </xs:element>
197
              </xs:sequence>
198
            </xs:extension>
199
          </xs:complexContent>
200
        </xs:complexType>
201
      </xs:element>
202
      <xs:element name="uniqueKey">
203
        <xs:complexType>
204
          <xs:complexContent>
205
            <xs:extension base="ConstraintDefinitionBase">
206
              <xs:sequence>
207
                <xs:element name="key" minOccurs="0">
208
                  <xs:annotation>
209
                    <xs:appinfo>
210
                      <doc:tooltip>Key</doc:tooltip>
211
                      <doc:summary>
212
                      The set of attributes to which this constraint applies.
213
                    </doc:summary>
214
                      <doc:description>
215
                      The set of attributes to which this constraint applies.  
216
                      For a primary key or a unique key, the set of attributes must be 
217
                      identifying.  For a foreign key, the set of attributes must match 
218
                      an identifying key in the referenced entity.  For a not null 
219
                      constraint, the key indicates the attribute which should not 
220
                      be null.
221
                    </doc:description>
222
                      <doc:example/>
223
                      <doc:lineage>New in EML 2.0</doc:lineage>
224
                    </xs:appinfo>
225
                  </xs:annotation>
226
                  <xs:complexType>
227
                    <xs:sequence>
228
                      <xs:element name="attributeName" type="xs:string" maxOccurs="unbounded">
229
                        <xs:annotation>
230
                          <xs:appinfo>
231
                            <doc:tooltip>Attribute Name</doc:tooltip>
232
                            <doc:summary>
233
                      Name of an attribute found in the identified entity
234
                      </doc:summary>
235
                            <doc:description>
236
                      Name of an attribute that can be found in the identified
237
                      entity.  This name will be unique within an entity and
238
                      specifies that the attribute participates in the key that
239
                      is being defined.
240
                      </doc:description>
241
                            <doc:example/>
242
                            <doc:lineage>New in EML 2.0</doc:lineage>
243
                          </xs:appinfo>
244
                        </xs:annotation>
245
                      </xs:element>
246
                    </xs:sequence>
247
                  </xs:complexType>
248
                </xs:element>
249
              </xs:sequence>
250
            </xs:extension>
251
          </xs:complexContent>
252
        </xs:complexType>
253
      </xs:element>
254
      <xs:element name="checkConstraint">
255
        <xs:complexType>
256
          <xs:complexContent>
257
            <xs:extension base="ConstraintDefinitionBase">
258
              <xs:sequence>
259
                <xs:element name="checkCondition" type="xs:string">
260
                  <xs:annotation>
261
                    <xs:appinfo>
262
                      <doc:tooltip>Check Condition</doc:tooltip>
263
                      <doc:summary>
264
                      An SQL statement or other language implementation of
265
                      the condition for a check constraint.
266
                    </doc:summary>
267
                      <doc:description>
268
                      A SQL statement or other language implementation of 
269
                      the condition for a check constraint.  
270
                      Generally this provides a means for constraining the 
271
                      values within  and among entities.
272
                    </doc:description>
273
                      <doc:example><![CDATA[(year > 1900 and year < 1990)]]></doc:example>
274
                      <doc:lineage>New in EML 2.0</doc:lineage>
275
                    </xs:appinfo>
276
                  </xs:annotation>
277
                </xs:element>
278
              </xs:sequence>
279
            </xs:extension>
280
          </xs:complexContent>
281
        </xs:complexType>
282
      </xs:element>
283
      <xs:element name="foreignKey">
284
        <xs:complexType>
285
          <xs:complexContent>
286
            <xs:extension base="ConstraintDefinitionBase">
287
              <xs:sequence>
288
                <xs:element name="key">
289
                  <xs:annotation>
290
                    <xs:appinfo>
291
                      <doc:tooltip>Key</doc:tooltip>
292
                      <doc:summary>
293
                      The set of attributes to which this constraint applies.
294
                    </doc:summary>
295
                      <doc:description>
296
                      The set of attributes to which this constraint applies.  
297
                      For a primary key or a unique key, the set of attributes must be 
298
                      identifying.  For a foreign key, the set of attributes must match 
299
                      an identifying key in the referenced entity.  For a not null 
300
                      constraint, the key indicates the attribute which should not 
301
                      be null.
302
                    </doc:description>
303
                      <doc:example/>
304
                      <doc:lineage>New in EML 2.0</doc:lineage>
305
                    </xs:appinfo>
306
                  </xs:annotation>
307
                  <xs:complexType>
308
                    <xs:sequence>
309
                      <xs:element name="attributeName" type="xs:string" maxOccurs="unbounded">
310
                        <xs:annotation>
311
                          <xs:appinfo>
312
                            <doc:tooltip>Attribute Name</doc:tooltip>
313
                            <doc:summary>
314
                      Name of an attribute found in the identified entity
315
                      </doc:summary>
316
                            <doc:description>
317
                      Name of an attribute that can be found in the identified
318
                      entity.  This name will be unique within an entity and
319
                      specifies that the attribute participates in the key that
320
                      is being defined.
321
                      </doc:description>
322
                            <doc:example/>
323
                            <doc:lineage>New in EML 2.0</doc:lineage>
324
                          </xs:appinfo>
325
                        </xs:annotation>
326
                      </xs:element>
327
                    </xs:sequence>
328
                  </xs:complexType>
329
                </xs:element>
330
                <xs:element name="referencedEntityId" type="xs:string">
331
                  <xs:annotation>
332
                    <xs:appinfo>
333
                      <doc:tooltip>Referenced Entity ID</doc:tooltip>
334
                      <doc:summary>
335
                      The id of the parent-entity in a foreign key constraint.
336
                    </doc:summary>
337
                      <doc:description>
338
                       This field contains the id of the entity to which a foreign key 
339
                       refers, otherwise known as the parent-entity or parent-table.
340
                       This should be an identifer that matches one of the "identifier" 
341
                       elements for an entity that is linked into the package
342
                       with a triple.  The constraint document itself should be
343
                       linked into the package as a member.
344
                    </doc:description>
345
                      <doc:example>
346
                      knb.79.4 
347
                    </doc:example>
348
                      <doc:lineage>
349
                      New in EML 2.0
350
                    </doc:lineage>
351
                    </xs:appinfo>
352
                  </xs:annotation>
353
                </xs:element>
354
                <xs:element name="referencedKey">
355
                  <xs:annotation>
356
                    <xs:appinfo>
357
                      <doc:tooltip>Key</doc:tooltip>
358
                      <doc:summary>
359
                      The set of attributes to which a foreign key constraint refers.
360
                    </doc:summary>
361
                      <doc:description>
362
                      The set of attributes to which a foreign key constraint refers.  
363
                      If the key refers to the primary key in the referenced entity, 
364
                      then the "referencedKey" is optional.  For a foreign key, the 
365
                      set of attributes must match an identifying key in the 
366
                      referenced entity.
367
                    </doc:description>
368
                      <doc:example/>
369
                      <doc:lineage>New in EML 2.0</doc:lineage>
370
                    </xs:appinfo>
371
                  </xs:annotation>
372
                  <xs:complexType>
373
                    <xs:sequence>
374
                      <xs:element name="attributeName" type="xs:string" maxOccurs="unbounded">
375
                        <xs:annotation>
376
                          <xs:appinfo>
377
                            <doc:tooltip>Attribute Name</doc:tooltip>
378
                            <doc:summary>
379
                      Name of an attribute found in the identified entity
380
                      </doc:summary>
381
                            <doc:description>
382
                      Name of an attribute that can be found in the identified
383
                      entity.  This name will be unique within an entity and
384
                      specifies that the attribute participates in the key that
385
                      is being defined.
386
                      </doc:description>
387
                            <doc:example/>
388
                            <doc:lineage>New in EML 2.0</doc:lineage>
389
                          </xs:appinfo>
390
                        </xs:annotation>
391
                      </xs:element>
392
                    </xs:sequence>
393
                  </xs:complexType>
394
                </xs:element>
395
                <xs:element name="relationshipType" minOccurs="0">
396
                  <xs:annotation>
397
                    <xs:documentation>
398
                      <doc:tooltip>Relationship type: Identifying or non-identifying</doc:tooltip>
399
                      <doc:summary>Relationship type: Identifying or non-identifying</doc:summary>
400
                      <doc:description>Identifying relationships propagate the the parent entity's 
401
		      primary key to the child's primary key. Non-identifying relationships propagate the 
402
		      parent's primary key as a non-key attribute of the child entity. 
403
		      </doc:description>
404
                      <doc:example/>
405
                      <doc:lineage>New in EML 2.0</doc:lineage>
406
                    </xs:documentation>
407
                  </xs:annotation>
408
                  <xs:simpleType>
409
                    <xs:restriction base="xs:string">
410
                      <xs:enumeration value="identifying"/>
411
                      <xs:enumeration value="non-identifying"/>
412
                    </xs:restriction>
413
                  </xs:simpleType>
414
                </xs:element>
415
                <xs:element name="cardinality" minOccurs="0">
416
                  <xs:annotation>
417
                    <xs:documentation>
418
                      <doc:tooltip>Cardinality of the relationship between two entities. </doc:tooltip>
419
                      <doc:summary>Cardinality of the relationship between a parent entity and
420
		                   a child entity.
421
		      </doc:summary>
422
                      <doc:description>Cardinality is a statement of the relationship between 
423
		      parent and child entities. Cardinality is expressed as the ratio of 
424
		      related parent and child entities. Cardinality 1 to N is a specific 
425
		      form of cardinalty in which zero or one parent records are related 
426
		      to a specified number of child records. The cardinality ratio for the 
427
		      parent entity depends on whether the "existence" is mandatory (one or more) 
428
		      or optional (zero to ...).                 
429
		      </doc:description>
430
                      <doc:example> One to many, One to 10, Zero or One to Many</doc:example>
431
                      <doc:lineage>New in EML 2.0</doc:lineage>
432
                    </xs:documentation>
433
                  </xs:annotation>
434
                  <xs:complexType>
435
                    <xs:sequence>
436
                      <xs:element name="parentOccurances">
437
                        <xs:annotation>
438
                          <xs:documentation>
439
                            <doc:tooltip>Parent portion of a 1 to exactly N cardinality </doc:tooltip>
440
                            <doc:summary>Parent portion of a 1 to exactly N cardinality. 
441
			    May have a value of either 0 or 1.</doc:summary>
442
                            <doc:description> >Parent portion of a 1 to exactly N cardinality. 
443
			    May have a value of either 0 or 1. 
444
			    Value of 0 implies that the "existence" of a child record is optional. 
445
			    Value of 1 implies that the "existence" of a child record is mandatory.     
446
			    </doc:description>
447
                            <doc:example> One to 10, Zero or One to Many</doc:example>
448
                            <doc:lineage>New in EML 2.0</doc:lineage>
449
                          </xs:documentation>
450
                        </xs:annotation>
451
                        <xs:simpleType>
452
                          <xs:restriction base="xs:integer">
453
                            <xs:enumeration value="0"/>
454
                            <xs:enumeration value="1"/>
455
                          </xs:restriction>
456
                        </xs:simpleType>
457
                      </xs:element>
458
                      <xs:element name="childOccurances" type="CardinalityChildOccurancesType">
459
                        <xs:annotation>
460
                          <xs:documentation>
461
                            <doc:tooltip>Child portion of the cardinality expression </doc:tooltip>
462
                            <doc:summary>Child portion of a cardinality expression 
463
		     Allowed values are positive integers including zero
464
		    or the string value "many".</doc:summary>
465
                            <doc:description> >Child portion of a cardinality expression 
466
			 Allowed values are positive integers including zero
467
		         or the string value "many"</doc:description>
468
                            <doc:example> 2, 15, many </doc:example>
469
                            <doc:lineage>New in EML 2.0</doc:lineage>
470
                          </xs:documentation>
471
                        </xs:annotation>
472
                      </xs:element>
473
                    </xs:sequence>
474
                  </xs:complexType>
475
                </xs:element>
476
              </xs:sequence>
477
            </xs:extension>
478
          </xs:complexContent>
479
        </xs:complexType>
480
      </xs:element>
481
    </xs:choice>
482
  </xs:complexType>
483
  <xs:simpleType name="CardinalityChildOccurancesType">
484
    <xs:annotation>
485
      <xs:documentation>
486
        <doc:tooltip>Child portion of a cardinality expression </doc:tooltip>
487
        <doc:summary>Child portion of a cardinality expression 
488
		     Allowed values are positive integers including zero
489
		    or the string value "many".</doc:summary>
490
        <doc:description>Child portion of a cardinality expression 
491
			 Allowed values are positive integers including zero
492
		         or the string value "many" </doc:description>
493
        <doc:example>0,1, 2, 15,many
494
</doc:example>
495
        <doc:lineage>New in EML 2.0</doc:lineage>
496
      </xs:documentation>
497
    </xs:annotation>
498
    <xs:union memberTypes="xs:integer">
499
      <xs:simpleType>
500
        <xs:restriction base="xs:string">
501
          <xs:enumeration value="many"/>
502
        </xs:restriction>
503
      </xs:simpleType>
504
    </xs:union>
505
  </xs:simpleType>
506
</xs:schema>
(2-2/2)