Project

General

Profile

Bug #486 » eml-constraintR.xsd

David Blankman, 05/15/2002 02:30 PM

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