1
|
<?php
|
2
|
|
3
|
$primitiveTypes = array(
|
4
|
'DEFCATEGORIE' => 'models.CharField(max_length=255',
|
5
|
'decimalLatitudeDataType' => 'models.FloatField(', #'xs:double [-90,90]',
|
6
|
'DecimalLatitude' => 'models.FloatField(', #xs:double [-90,90]',
|
7
|
'decimalLongitudeDataType' => 'models.FloatField(', #xs:double [-180,180]',
|
8
|
'DecimalLongitude' => 'models.FloatField(', #xs:double [-180,180]',
|
9
|
'spatialFitDataType' => 'models.FloatField(', #xs:double (0 or >1 or undefined)',
|
10
|
'FootprintSpatialFit' => 'models.FloatField(', #xs:double (0 or >1 or undefined)',
|
11
|
'GeodeticDatum' => 'models.CharField(max_length=255',
|
12
|
'VerbatimCoordinates' => 'models.CharField(max_length=255',
|
13
|
'VerbatimLatitude' => 'models.CharField(max_length=255',
|
14
|
'VerbatimLongitude' => 'models.CharField(max_length=255',
|
15
|
'VerbatimCoordinateSystem' => 'models.CharField(max_length=255',
|
16
|
'GeoreferenceProtocol' => 'models.CharField(max_length=255',
|
17
|
'GeoreferenceSources' => 'models.CharField(max_length=255',
|
18
|
'GeoreferenceVerificationStatus' => 'models.CharField(max_length=255',
|
19
|
'GeoreferenceRemarks' => 'models.CharField(max_length=255',
|
20
|
'FootprintWKT' => 'models.CharField(max_length=255',
|
21
|
'CoordinateUncertaintyInMeters' => 'models.PositiveIntegerField(', #'positiveInteger',
|
22
|
'PointRadiusSpatialFit' => 'models.FloatField(', #'xs:double (0 or >1 or undefined)',
|
23
|
'PERCENT' => 'models.FloatField(', #'xsd:decimal [0,100]',
|
24
|
'RoleType' => 'models.CharField(max_length=255',
|
25
|
'TaxonomicRankEnum' => 'models.CharField(max_length=255',
|
26
|
'TINYINT' => 'models.FloatField(', #'xsd:decimal [-128,128]',
|
27
|
'yearDate' => 'models.DateField(', #'xs:gYear xs:date (union of)',
|
28
|
'anyType' => 'models.TextField(', #'xsd:anyType',
|
29
|
'InlineType' => 'models.TextField(', #'xs:anyType',
|
30
|
'date' => 'models.DateField(', #'xsd:date',
|
31
|
'anyURI' => 'models.CharField(max_length=255', #'xs:anyURI',
|
32
|
'boolean' => 'models.NullBooleanField(',
|
33
|
'token' => 'models.CharField(max_length=255',
|
34
|
'language' => 'models.CharField(max_length=255',
|
35
|
'decimal' => 'models.FloatField(', #'xsd:decimal',
|
36
|
'gYear' => 'models.DateField(', #'xsd:gYear',
|
37
|
'string' => 'models.CharField(max_length=255',
|
38
|
'permission' => 'models.CharField(max_length=255',
|
39
|
'positiveInteger' => 'models.PositiveIntegerField(', #'xs:positiveInteger',
|
40
|
'time' => 'models.TimeField(', #'xs:time',
|
41
|
'double' => 'models.FloatField(', #'xs:double',
|
42
|
'integer' => 'models.IntegerField(', #'xs:integer',
|
43
|
'Name' => 'models.CharField(max_length=255', #'xs:Name',
|
44
|
'NMTOKEN' => 'models.CharField(max_length=255', #'xs:NMTOKEN',
|
45
|
'DateTimeISO' => 'models.CharField(max_length=255',
|
46
|
'dayOfYearDataType' => 'models.IntegerField(', #'xs:integer',
|
47
|
'DescriptorType' => 'models.CharField(max_length=255',
|
48
|
'FunctionType' => 'models.CharField(max_length=255',
|
49
|
'GRingType' => 'models.TextField(', #'xs:anyType',
|
50
|
'IDType' => 'models.CharField(max_length=255',
|
51
|
'KeyTypeCode' => 'models.CharField(max_length=255',
|
52
|
'MEDIUMINT' => 'models.FloatField(', #'xs:decimal',
|
53
|
'NomenclaturalCodesEnum' => 'models.CharField(max_length=255', #'xsd:Name',
|
54
|
'NomenclaturalTypeStatusOfUnitsEnum' => 'models.CharField(max_length=255', #'xsd:Name',
|
55
|
'positiveDouble' => 'models.FloatField(', #'xs:double',
|
56
|
'probabilityType' => 'models.FloatField(', #'xs:double',
|
57
|
'ScopeType' => 'models.CharField(max_length=255',
|
58
|
'SMALLINT' => 'models.FloatField(', #'xs:decimal',
|
59
|
'STRATUMINDEX' => 'models.CharField(max_length=255',
|
60
|
'SystemType' => 'models.CharField(max_length=255',
|
61
|
'TaxonomicRankAboveSuperfamilyEnum' => 'models.CharField(max_length=255', #'xsd:Name',
|
62
|
'TaxonomicRankBelowSubspeciesEnum' => 'models.CharField(max_length=255', #'xsd:Name',
|
63
|
'TaxonomicRankCultivatedPlants' => 'models.CharField(max_length=255', #'xsd:Name',
|
64
|
'TaxonomicRankFamilyGroupEnum' => 'models.CharField(max_length=255', #'xsd:Name',
|
65
|
'TaxonomicRankFamilySubdivisionEnum' => 'models.CharField(max_length=255', #'xsd:Name',
|
66
|
'TaxonomicRankGenusGroupEnum' => 'models.CharField(max_length=255', #'xsd:Name',
|
67
|
'TaxonomicRankGenusSubdivisionEnum' => 'models.CharField(max_length=255', #'xsd:Name',
|
68
|
'TaxonomicRankSpeciesGroupEnum' => 'models.CharField(max_length=255', #'xsd:Name',
|
69
|
);
|
70
|
|
71
|
$ignoreTypes = array(
|
72
|
"description" => true,
|
73
|
"example" => true,
|
74
|
"moduleDescription" => true,
|
75
|
"moduleDocs" => true,
|
76
|
"moduleName" => true,
|
77
|
"recommendedUsage" => true,
|
78
|
"standAlone" => true,
|
79
|
"summary" => true,
|
80
|
"tooltip" => true,
|
81
|
"annotation" => true,
|
82
|
"appinfo" => true,
|
83
|
"documentation" => true,
|
84
|
"import" => true,
|
85
|
"include" => true,
|
86
|
"schema" => true,
|
87
|
"AdditionalAbbreviations" => true,
|
88
|
"BacteriaStatus" => true,
|
89
|
"BioCodeStatus" => true,
|
90
|
"BotanyStatus" => true,
|
91
|
"li" => true,
|
92
|
"p" => true,
|
93
|
"para" => true,
|
94
|
"PreferredAbbreviation" => true,
|
95
|
"section" => true,
|
96
|
"Specification" => true,
|
97
|
"SuffixAlgae" => true,
|
98
|
"SuffixAnimalia" => true,
|
99
|
"SuffixBacteriae" => true,
|
100
|
"SuffixFungi" => true,
|
101
|
"SuffixFungi" => true,
|
102
|
"SuffixPlantae" => true,
|
103
|
"title" => true,
|
104
|
"ul" => true,
|
105
|
"#text" => true,
|
106
|
"#comment" => true,
|
107
|
"ZoologyStatus" => true
|
108
|
);
|
109
|
|
110
|
|
111
|
$knownAttributes = array(
|
112
|
"minOccurs" => True,
|
113
|
"maxOccurs" => True,
|
114
|
"default" => True,
|
115
|
"use" => True,
|
116
|
"mixed" => True,
|
117
|
"name" => True,
|
118
|
"type" => True,
|
119
|
"namespace" => True,
|
120
|
"ref" => True,
|
121
|
"nillable" => True,
|
122
|
|
123
|
"base" => True,
|
124
|
#not sure about what to do with these, probably nothing
|
125
|
"processContents" => True
|
126
|
);
|
127
|
|
128
|
$geoSpatialTypes = array(
|
129
|
"GRingPointType" => array(
|
130
|
'colDef' => 'gRingPoint = models.PointField(null=True,blank=True)',
|
131
|
'importDef' =>
|
132
|
" if self.gRingLatitude != None and self.gRingLongitude != None:\n".
|
133
|
" self.gRingPoint = Point(float(self.gRingLatitude),float(self.gRingLongitude))"
|
134
|
),
|
135
|
"geospatialType" => array(
|
136
|
'colDef' => 'decimalPoint = models.PointField(null=True,blank=True)',
|
137
|
'importDef' =>
|
138
|
" if self.geospatialType_DecimalLatitude != None and self.geospatialType_DecimalLongitude != None:\n".
|
139
|
" self.decimalPoint = Point(float(self.geospatialType_DecimalLatitude),float(self.geospatialType_DecimalLongitude))"
|
140
|
)
|
141
|
);
|
142
|
|
143
|
$manyToManyRelationships = array(
|
144
|
'AccessType' => array( 'AccessRule' => true ),
|
145
|
'ParagraphType' => array( 'ListType' => true,
|
146
|
'SubSuperScriptType' => true ),
|
147
|
'listitem' => array( 'ListType' => true ),
|
148
|
'SubSuperScriptType' => array( 'SubSuperScriptType' => true ),
|
149
|
'ScientificName' => array( 'NomenclaturalNoteType' => true ),
|
150
|
'ResourceGroup' => array( 'ResponsibleParty' => true )
|
151
|
);
|
152
|
|
153
|
$indexableCols = array(
|
154
|
"attributeID" => True,
|
155
|
"attr_id" => True,
|
156
|
"citationID" => True,
|
157
|
"contributorID" => True,
|
158
|
"coverTypeAttributeID" => True,
|
159
|
"individualOrganismID" => True,
|
160
|
"methodID" => True,
|
161
|
"partyID" => True,
|
162
|
"plotObservationID" => True,
|
163
|
"plotUniqueIdentifierID" => True,
|
164
|
"protocolID" => True,
|
165
|
"qualityAssessmentMethodID" => True,
|
166
|
"referenceCitationID" => True,
|
167
|
"relatedItemID" => True,
|
168
|
"relatedPlotID" => True,
|
169
|
"stratumID" => True,
|
170
|
"stratumObservationID" => True,
|
171
|
"taxonConceptID" => True,
|
172
|
"taxonNameID" => True,
|
173
|
"taxonNameUsageConceptID" => True,
|
174
|
"vegetationComponentAttributeID" => True,
|
175
|
"plotUniqueIdentifier" => True,
|
176
|
"plotUniqueIdentifierID" => True
|
177
|
);
|
178
|
|
179
|
//Unfortunately Django doesn't support composite keys which is what would be necessary to add these
|
180
|
//FK constraints. This is because multiple vegx instances will have the same ids for the same nodes
|
181
|
//(e.g. many VegX documents will have AttributeType nodes with the same id attribute. This is
|
182
|
//somewhat by design). We would need to link by attr_id AND entryInfo. Another option would be to
|
183
|
//store and manage all possible values (attributes, methods, citations, etc.) in BIEN.
|
184
|
$nativeVegXPointers = array(
|
185
|
/*
|
186
|
"attributeID" => array(
|
187
|
'def' => "models.ForeignKey('AttributeType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
188
|
'to_field' => 'attr_id',
|
189
|
'fk_type' => 'AttributeType'
|
190
|
),
|
191
|
"citationID" => array(
|
192
|
'def' => "models.ForeignKey('CitationType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
193
|
'to_field' => 'attr_id',
|
194
|
'fk_type' => 'CitationType'
|
195
|
),
|
196
|
// Not sure "contributorID" => "models.ForeignKey('ResponsibleParty', to_field='',null=True, blank=True, db_index=True) #internal key",
|
197
|
"coverTypeAttributeID" => array(
|
198
|
'def' => "models.ForeignKey('AttributeType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
199
|
'to_field' => 'attr_id',
|
200
|
'fk_type' => 'AttributeType'
|
201
|
),
|
202
|
"individualOrganismID" => array(
|
203
|
'def' => "models.ForeignKey('IndividualOrganismType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
204
|
'to_field' => 'attr_id',
|
205
|
'fk_type' => 'IndividualOrganismType'
|
206
|
),
|
207
|
"methodID" => array(
|
208
|
'def' => "models.ForeignKey('MethodType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
209
|
'to_field' => 'attr_id',
|
210
|
'fk_type' => 'MethodType'
|
211
|
),
|
212
|
"partyID" => array(
|
213
|
'def' => "models.ForeignKey('ResponsibleParty', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
214
|
'to_field' => 'attr_id',
|
215
|
'fk_type' => 'ResponsibleParty'
|
216
|
),
|
217
|
"plotObservationID" => array(
|
218
|
'def' => "models.ForeignKey('ObservationType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
219
|
'to_field' => 'attr_id',
|
220
|
'fk_type' => 'ObservationType'
|
221
|
),
|
222
|
"plotUniqueIdentifierID" => array(
|
223
|
'def' => "models.ForeignKey('PlotType', to_field='plotUniqueIdentifier',null=True, blank=True, db_index=True) #internal key",
|
224
|
'to_field' => 'plotUniqueIdentifier',
|
225
|
'fk_type' => 'PlotType'
|
226
|
),
|
227
|
"protocolID" => array(
|
228
|
'def' => "models.ForeignKey('ProtocolType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
229
|
'to_field' => 'attr_id',
|
230
|
'fk_type' => 'ProtocolType'
|
231
|
),
|
232
|
"qualityAssessmentMethodID" => array(
|
233
|
'def' => "models.ForeignKey('MethodType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
234
|
'to_field' => 'attr_id',
|
235
|
'fk_type' => 'MethodType'
|
236
|
),
|
237
|
"referenceCitationID" => array(
|
238
|
'def' => "models.ForeignKey('CitationType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
239
|
'to_field' => 'attr_id',
|
240
|
'fk_type' => 'CitationType'
|
241
|
),
|
242
|
// too general, appears to be used to reference *any* other item in the xml document "relatedItemID" => "models.ForeignKey('', to_field='',null=True, blank=True, db_index=True) #internal key",
|
243
|
// not very useful, this pointer doesn't seem to add any info not already in schema "relatedPlotID" => "models.ForeignKey('', to_field='',null=True, blank=True, db_index=True) #internal key",
|
244
|
"stratumID" => array(
|
245
|
'def' => "models.ForeignKey('StratumType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
246
|
'to_field' => 'attr_id',
|
247
|
'fk_type' => 'StratumType'
|
248
|
),
|
249
|
"stratumObservationID" => array(
|
250
|
'def' => "models.ForeignKey('StratumObservationType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
251
|
'to_field' => 'attr_id',
|
252
|
'fk_type' => 'StratumObservationType'
|
253
|
),
|
254
|
"taxonConceptID" => array(
|
255
|
'def' => "models.ForeignKey('TaxonConceptType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
256
|
'to_field' => 'attr_id',
|
257
|
'fk_type' => 'TaxonConceptType'
|
258
|
),
|
259
|
"taxonNameID" => array(
|
260
|
'def' => "models.ForeignKey('ScientificName', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
261
|
'to_field' => 'attr_id',
|
262
|
'fk_type' => 'ScientificName'
|
263
|
),
|
264
|
"taxonNameUsageConceptID" => array(
|
265
|
'def' => "models.ForeignKey('TaxonNameUsageType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
266
|
'to_field' => 'attr_id',
|
267
|
'fk_type' => 'TaxonNameUsageType'
|
268
|
),
|
269
|
"vegetationComponentAttributeID" => array(
|
270
|
'def' => "models.ForeignKey('AttributeType', to_field='attr_id',null=True, blank=True, db_index=True) #internal key",
|
271
|
'to_field' => 'attr_id',
|
272
|
'fk_type' => 'AttributeType'
|
273
|
)
|
274
|
*/
|
275
|
);
|
276
|
|
277
|
$tableRenames = array(
|
278
|
"taxonNamesLC" => "taxonNames",
|
279
|
"taxonConceptsLC" => "taxonConcepts",
|
280
|
"temporalCoverageLC" => "temporalCoverage",
|
281
|
"taxonomicCoverageLC" => "taxonomicCoverage",
|
282
|
"taxonRelationshipAssertionMapList" => "taxonRelationshipAssertions",
|
283
|
"taxonRelationshipAssertionMap" => "taxonRelationshipAssertion"
|
284
|
|
285
|
);
|
286
|
?>
|