-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
eml-constraint.xsd
588 lines (562 loc) · 27.2 KB
/
eml-constraint.xsd
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="eml://ecoinformatics.org/constraint-2.2.0"
xmlns:res="eml://ecoinformatics.org/resource-2.2.0"
xmlns:doc="eml://ecoinformatics.org/documentation-2.2.0"
targetNamespace="eml://ecoinformatics.org/constraint-2.2.0">
<xs:import namespace="eml://ecoinformatics.org/documentation-2.2.0"
schemaLocation="eml-documentation.xsd"/>
<xs:import namespace="eml://ecoinformatics.org/resource-2.2.0"
schemaLocation="eml-resource.xsd"/>
<xs:annotation>
<xs:documentation>
'$RCSfile: eml-constraint.xsd,v $'
Copyright: 1997-2002 Regents of the University of California,
University of New Mexico, and
Arizona State University
Sponsors: National Center for Ecological Analysis and Synthesis and
Partnership for Interdisciplinary Studies of Coastal Oceans,
University of California Santa Barbara
Long-Term Ecological Research Network Office,
University of New Mexico
Center for Environmental Studies, Arizona State University
Other funding: National Science Foundation (see README for details)
The David and Lucile Packard Foundation
For Details: http://knb.ecoinformatics.org/
'$Author: obrien $'
'$Date: 2009-02-25 23:51:54 $'
'$Revision: 1.53 $'
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</xs:documentation>
<xs:appinfo>
<doc:moduleDocs>
<doc:moduleName>eml-constraint</doc:moduleName>
<doc:moduleDescription>
<section xmlns="">
<title>
The eml-constraint module - Relationships among and within
dataset entities
</title>
<para>
The eml-constraint schema defines the integrity constraints
between entities (e.g., data tables) as they would be maintained in
a relational management system. These constraints include primary
key constraints, foreign key constraints, unique key constraints,
check constraints, and not null constraints, among potential others.
</para>
</section>
</doc:moduleDescription>
<doc:recommendedUsage>All datasets where there are logical constraints
between entities</doc:recommendedUsage>
<doc:standAlone>no</doc:standAlone>
</doc:moduleDocs>
</xs:appinfo>
</xs:annotation>
<xs:complexType name="ConstraintType">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Relational integrity constraint descriptors</doc:tooltip>
<doc:summary>Describes the relational integrity constraints of a
relational database.</doc:summary>
<doc:description>The ConstraintType type describes the relational
integrity constraints of a relational database. This includes primary
keys, foreign keys, unique keys, etc. When an eml-constraint module is
created, it should be linked into a dataset using the "triple" element,
and all of the entities that are referenced in the constraints should be
accessible within that same package.</doc:description>
</xs:appinfo>
</xs:annotation>
<xs:choice>
<xs:element name="primaryKey">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Primary Key</doc:tooltip>
<doc:summary>The primary key in the entity</doc:summary>
<doc:description>The primaryKey element declares the primary key in
the entity to which the defined constraint
pertains.</doc:description>
<doc:example>date</doc:example>
<doc:example>site</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:group ref="ConstraintBaseGroup"/>
<xs:element name="key">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Key</doc:tooltip>
<doc:summary>The set of attributes to which this constraint
applies.</doc:summary>
<doc:description>The key element defines the set of attributes
to which this constraint applies. For a primary key or a
unique key, the set of attributes must be identifying. For a
foreign key, the set of attributes must match an identifying
key in the referenced entity. For a 'not null' constraint, the
key indicates the attribute which should not be
null.</doc:description>
<doc:example>site</doc:example>
<doc:example>plot</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="attributeReference" type="res:NonEmptyStringType" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Attribute Reference</doc:tooltip>
<doc:summary>The identifier of an attribute found
in the identified entity</doc:summary>
<doc:description>The attributeReference element is the
identifier of an attribute that can be found in the
identified entity. This id will be unique within an
entity and specifies that the attribute participates
in the key that is being defined.</doc:description>
<doc:example>site</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="uniqueKey">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Unique Key</doc:tooltip>
<doc:summary>A unique key in the entity</doc:summary>
<doc:description>The uniqueKey element represents a unique key
within the referenced entity. This is different from a primary key
in that it does not form any implicit foreign key relationships to
other entities, however it is required to be unique within the
entity.</doc:description>
<doc:example>date</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:group ref="ConstraintBaseGroup"/>
<xs:element name="key">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Key</doc:tooltip>
<doc:summary>The set of attributes to which this constraint
applies.</doc:summary>
<doc:description>The key element defines the set of attributes
to which this constraint applies. For a primary key or a
unique key, the set of attributes must be identifying. For a
foreign key, the set of attributes must match an identifying
key in the referenced entity. For a 'not null' constraint, the
key indicates the attribute which should not be
null.</doc:description>
<doc:example>date, site, plot</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="attributeReference" type="res:NonEmptyStringType" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Attribute Reference</doc:tooltip>
<doc:summary>The identifier of an attribute found
in the identified entity</doc:summary>
<doc:description>The attributeReference element is the
identifier of an attribute that can be found in the
identified entity. This id will be unique within an
entity and specifies that the attribute participates
in the key that is being defined.</doc:description>
<doc:example>site</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="checkConstraint">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Check Constraint</doc:tooltip>
<doc:summary>A constraint which checks a conditional clause
within an entity.</doc:summary>
<doc:description>The checkConstraint element defines a constraint
which checks a conditional clause within an
entity.</doc:description>
<doc:example>if site>1 then plot>10</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:group ref="ConstraintBaseGroup"/>
<xs:element name="checkCondition" type="res:NonEmptyStringType">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Check Condition</doc:tooltip>
<doc:summary>An SQL statement or other language
implementation of the condition for a check
constraint.</doc:summary>
<doc:description>The checkCondition element defines an SQL
statement or other language implementation of the condition
for a check constraint. Generally this provides a means for
constraining the values within and among
entities.</doc:description>
<doc:example>(year > 1900 and year <
1990)</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="language" type="xs:string" use="optional">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Language</doc:tooltip>
<doc:summary>The language that the is used to express or
implement the check constraint.</doc:summary>
<doc:description>The language element declares the language
that is used to implement the check constraint. This is
typically the name and version of a programming language such as
Java, C, Perl, Basic, or other. Sometime it is the name and
version of a scriptable analysis system such as SAS, Matlab, R,
or SPlus.
</doc:description>
<doc:example>Perl 5.6.1</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="foreignKey">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Foreign Key</doc:tooltip>
<doc:summary>A foreign key relationship among entities</doc:summary>
<doc:description>The foreignKey element defines a foreign key
relationship among entities which relates this entity to another's
primary key.
</doc:description>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:group ref="ForeignKeyGroup"/>
</xs:complexType>
</xs:element>
<xs:element name="joinCondition">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Join Condition</doc:tooltip>
<doc:summary>A non primary/foreign key join</doc:summary>
<doc:description>The joinCondition element describes any join of two
tables that is not done with a primary/foreign key
relationship.</doc:description>
<doc:example>JOIN code</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:group ref="ForeignKeyGroup"/>
<xs:element name="referencedKey">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Key</doc:tooltip>
<doc:summary>The set of attributes to which a foreign key
constraint refers.</doc:summary>
<doc:description>The referencedKey element defines set of
attributes to which a foreign key constraint refers. If the
key refers to the primary key in the referenced entity, then
the "referencedKey" is optional. For a foreign key, the set
of attributes must match an identifying key in the referenced
entity.</doc:description>
<doc:example>site, plot</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="attributeReference" type="res:NonEmptyStringType" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Attribute Reference</doc:tooltip>
<doc:summary>The identifier of an attribute found
in the identified entity</doc:summary>
<doc:description>The attributeReference element is the
identifier of an attribute that can be found in the
identified entity. This id will be unique within an
entity and specifies that the attribute participates
in the key that is being defined.</doc:description>
<doc:example>site</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="notNullConstraint">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Not Null Constraint</doc:tooltip>
<doc:summary>A constraint that indicates that no null values
should be present for an attribute.</doc:summary>
<doc:description>The notNullConstraint element defines a constraint
that indicates that no null values should be present for an
attribute in this entity.</doc:description>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:group ref="ConstraintBaseGroup"/>
<xs:element name="key">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Key</doc:tooltip>
<doc:summary>The set of attributes to which this constraint
applies.</doc:summary>
<doc:description>The key element defines the set of attributes
to which this constraint applies. For a primary key or a
unique key, the set of attributes must be identifying. For a
foreign key, the set of attributes must match an identifying
key in the referenced entity. For a 'not null' constraint, the
key indicates the attribute which should not be
null.</doc:description>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="attributeReference" type="res:NonEmptyStringType" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Attribute Reference</doc:tooltip>
<doc:summary>The identifier of an attribute found
in the identified entity</doc:summary>
<doc:description>The attributeReference element is the
identifier of an attribute that can be found in the
identified entity. This id will be unique within an
entity and specifies that the attribute participates
in the key that is being defined.</doc:description>
<doc:example>site</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attribute name="id" type="res:IDType" use="optional"/>
<xs:attribute name="system" type="res:SystemType" use="optional"/>
<xs:attribute name="scope" type="res:ScopeType" use="optional" default="document"/>
</xs:complexType>
<xs:simpleType name="CardinalityChildOccurancesType">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Child portion of a cardinality expression</doc:tooltip>
<doc:summary>Child portion of a cardinality expression Allowed values
are positive integers including zero or the string value
"many".</doc:summary>
<doc:description>The CardinalityChildOccurancesType element defines the
child portion of a cardinality expression. Allowed values are positive
integers including zero or the string value "many".</doc:description>
<doc:example>0,1, 2, 15,many</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:union memberTypes="xs:integer">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="many"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:group name="ConstraintBaseGroup">
<xs:sequence>
<xs:element name="constraintName" type="res:NonEmptyStringType">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Name of the constraint</doc:tooltip>
<doc:summary>A meaningfull name of the constraint.</doc:summary>
<doc:description>The constraintName element is a name which
represents a human readable and meaningful name for the
constraint.</doc:description>
<doc:example>PrimaryKey_birdSurvey</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="constraintDescription" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Description of the constraint</doc:tooltip>
<doc:summary>Descibes the purpose of the constraint.</doc:summary>
<doc:description>The constraintDescription element describes the
nature of the constraint. It might be a description of a check
condition, or a statement about the composition of a primary key or
the nature of the relationship between two database tables or two
ascii files.</doc:description>
<doc:example>1.Must be greater than 0 but less than 100 2. "The
primary key of the table BIRD_SURVEY is composed of two
attributes:speciesCode and observationDate 3. The species name
associated with the species code in survey.txt can be found in the
file speciesList.txt</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:group>
<xs:group name="ForeignKeyGroup">
<xs:sequence>
<xs:group ref="ConstraintBaseGroup"/>
<xs:element name="key">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Key</doc:tooltip>
<doc:summary>The set of attributes to which this constraint
applies.</doc:summary>
<doc:description>The key element defines the set of attributes to
which this constraint applies. For a primary key or a unique key,
the set of attributes must be identifying. For a foreign key, the
set of attributes must match an identifying key in the referenced
entity. For a 'not null' constraint, the key indicates the attribute
which should not be null.</doc:description>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="attributeReference" type="res:NonEmptyStringType" maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Attribute Reference</doc:tooltip>
<doc:summary>The identifier of an attribute found
in the identified entity</doc:summary>
<doc:description>The attributeReference element is the
identifier of an attribute that can be found in the
identified entity. This id will be unique within an
entity and specifies that the attribute participates
in the key that is being defined.</doc:description>
<doc:example>site</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="entityReference" type="res:NonEmptyStringType">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Referenced Entity ID</doc:tooltip>
<doc:summary>The id of the parent-entity in a foreign key
constraint.</doc:summary>
<doc:description>The entityReference element contains the id of the
entity to which a foreign key refers, otherwise known as the
parent-entity or parent-table. This should be an identifier that
matches one of the "identifier" elements for an
entity.</doc:description>
<doc:example>knb.79.4</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="relationshipType" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Relationship type: Identifying or
non-identifying</doc:tooltip>
<doc:summary>Relationship type: Identifying or
non-identifying</doc:summary>
<doc:description>The relationshipType element defines identifying
relationships that propagate from the parent entity's primary key to
the child's primary key. Non-identifying relationships propagate the
parent's primary key as a non-key attribute of the child
entity.</doc:description>
<doc:example>relationshipType code</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="identifying"/>
<xs:enumeration value="non-identifying"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="cardinality" minOccurs="0">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Cardinality of the relationship between two
entities.</doc:tooltip>
<doc:summary>Cardinality of the relationship between a parent
entity and a child entity.</doc:summary>
<doc:description>The cardinality element represents a statement of
the relationship between parent and child entities. Cardinality is
expressed as the ratio of related parent and child
entities. Cardinality 1 to N is a specific form of cardinality in
which zero or one parent records are related to a specified number
of child records. The cardinality ratio for the parent entity
depends on whether the "existence" is mandatory (one or more) or
optional (zero to ...).</doc:description>
<doc:example>One to many</doc:example>
<doc:example>One to 10</doc:example>
<doc:example>Zero or One to Many</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="parentOccurences">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Parent portion of a 1 to exactly N
cardinality</doc:tooltip>
<doc:summary>Parent portion of a 1 to exactly N cardinality.
May have a value of either 0 or 1.</doc:summary>
<doc:description>The parentOccurences element describes the
Parent portion of a 1 to exactly N cardinality. May have a
value of either 0 or 1. Value of 0 implies that the
"existence" of a child record is optional. Value of 1 implies
that the "existence" of a child record is
mandatory.</doc:description>
<doc:example>One to 10, Zero or One to Many</doc:example>
</xs:appinfo>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:enumeration value="0"/>
<xs:enumeration value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="childOccurences" type="CardinalityChildOccurancesType">
<xs:annotation>
<xs:appinfo>
<doc:tooltip>Child portion of the cardinality
expression</doc:tooltip>
<doc:summary>Child portion of a cardinality expression
Allowed values are positive integers including zero or the
string value "many".</doc:summary>
<doc:description>The childOccurences element describes the
child portion of a cardinality expression Allowed values are
positive integers including zero or the string value
"many"</doc:description>
<doc:example>2, 15, many</doc:example>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:group>
</xs:schema>