Revision 7780
Added by Aaron Marcuse-Kubitza almost 12 years ago
schemas/VegX/run.py | ||
---|---|---|
1 |
|
|
2 |
#There are 223 defined entities. |
|
3 |
import string |
|
4 |
import xml.dom.minidom |
|
5 |
from random import choice |
|
6 |
from django.contrib.gis.geos import * |
|
7 |
from django.contrib.gis.db import models |
|
8 |
|
|
9 |
def getRandom(length=8, chars=string.letters + string.digits): |
|
10 |
return ''.join([choice(chars) for i in range(length)]) |
|
11 |
|
|
12 |
def getRandomString(): |
|
13 |
return getRandom(45) |
|
14 |
|
|
15 |
def getRandomText(): |
|
16 |
return getRandom(450) |
|
17 |
|
|
18 |
def getRandomInt(): |
|
19 |
return int(getRandom(4,string.digits)) |
|
20 |
|
|
21 |
def getRandomFloat(): |
|
22 |
return float(getRandom(4,string.digits)) |
|
23 |
|
|
24 |
def getRandomBool(): |
|
25 |
return choice(['true','false']) |
|
26 |
|
|
27 |
#Not actually random, but not worth the time |
|
28 |
def getRandomDate(): |
|
29 |
return '2007-07-16' |
|
30 |
|
|
31 |
def getRandomTime(): |
|
32 |
return '08:30:00' |
|
33 |
|
|
34 |
class EntryInfo(models.Model): |
|
35 |
creationDate = models.DateTimeField(auto_now_add=True) |
|
36 |
lastUpdatedDate = models.DateTimeField(auto_now=True) |
|
37 |
dataSource = models.CharField(max_length=255, db_index=True) |
|
38 |
|
|
39 |
class taxonNames(models.Model): |
|
40 |
entryInfo = models.ForeignKey('EntryInfo') |
|
41 |
|
|
42 |
def exportVegX(self,myNode,doc): |
|
43 |
for childRef in self.ScientificName_taxonNames_id.all(): |
|
44 |
newEl = doc.createElement('taxonName') |
|
45 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
46 |
|
|
47 |
return myNode |
|
48 |
|
|
49 |
def importVegX(self,node,info): |
|
50 |
self.entryInfo = info |
|
51 |
self.save() |
|
52 |
#members & relationships |
|
53 |
for child in node.childNodes: |
|
54 |
cName = child.nodeName |
|
55 |
#These are the elements that refer to this one |
|
56 |
if cName == 'taxonName': |
|
57 |
newEl = ScientificName().retrieveOrNew(child) |
|
58 |
newEl.taxonNames_id = self |
|
59 |
newEl.importVegX(child,info) |
|
60 |
|
|
61 |
self.save() |
|
62 |
|
|
63 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
64 |
if 'ScientificName' not in usedObjectsStack: |
|
65 |
usedObjectsStack.append('ScientificName') |
|
66 |
|
|
67 |
newEl = doc.createElement('taxonName') |
|
68 |
childRef = ScientificName() |
|
69 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
70 |
usedObjectsStack.pop() |
|
71 |
|
|
72 |
return myNode |
|
73 |
|
|
74 |
def retrieveOrNew(self,node): |
|
75 |
return taxonNames() |
|
76 |
|
|
77 |
|
|
78 |
class Meta: |
|
79 |
db_table = u'v_taxonnames_lc' |
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
class taxonConcepts(models.Model): |
|
84 |
entryInfo = models.ForeignKey('EntryInfo') |
|
85 |
|
|
86 |
def exportVegX(self,myNode,doc): |
|
87 |
for childRef in self.TaxonConceptType_taxonConcepts_id.all(): |
|
88 |
newEl = doc.createElement('taxonConcept') |
|
89 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
90 |
|
|
91 |
return myNode |
|
92 |
|
|
93 |
def importVegX(self,node,info): |
|
94 |
self.entryInfo = info |
|
95 |
self.save() |
|
96 |
#members & relationships |
|
97 |
for child in node.childNodes: |
|
98 |
cName = child.nodeName |
|
99 |
#These are the elements that refer to this one |
|
100 |
if cName == 'taxonConcept': |
|
101 |
newEl = TaxonConceptType().retrieveOrNew(child) |
|
102 |
newEl.taxonConcepts_id = self |
|
103 |
newEl.importVegX(child,info) |
|
104 |
|
|
105 |
self.save() |
|
106 |
|
|
107 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
108 |
if 'TaxonConceptType' not in usedObjectsStack: |
|
109 |
usedObjectsStack.append('TaxonConceptType') |
|
110 |
|
|
111 |
newEl = doc.createElement('taxonConcept') |
|
112 |
childRef = TaxonConceptType() |
|
113 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
114 |
usedObjectsStack.pop() |
|
115 |
|
|
116 |
return myNode |
|
117 |
|
|
118 |
def retrieveOrNew(self,node): |
|
119 |
return taxonConcepts() |
|
120 |
|
|
121 |
|
|
122 |
class Meta: |
|
123 |
db_table = u'v_taxonconcepts_lc' |
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
class TaxonNames(models.Model): |
|
128 |
entryInfo = models.ForeignKey('EntryInfo') |
|
129 |
|
|
130 |
def exportVegX(self,myNode,doc): |
|
131 |
for childRef in self.ScientificName_TaxonNames_id.all(): |
|
132 |
newEl = doc.createElement('TaxonName') |
|
133 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
134 |
|
|
135 |
return myNode |
|
136 |
|
|
137 |
def importVegX(self,node,info): |
|
138 |
self.entryInfo = info |
|
139 |
self.save() |
|
140 |
#members & relationships |
|
141 |
for child in node.childNodes: |
|
142 |
cName = child.nodeName |
|
143 |
#These are the elements that refer to this one |
|
144 |
if cName == 'TaxonName': |
|
145 |
newEl = ScientificName().retrieveOrNew(child) |
|
146 |
newEl.TaxonNames_id = self |
|
147 |
newEl.importVegX(child,info) |
|
148 |
|
|
149 |
self.save() |
|
150 |
|
|
151 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
152 |
if 'ScientificName' not in usedObjectsStack: |
|
153 |
usedObjectsStack.append('ScientificName') |
|
154 |
|
|
155 |
newEl = doc.createElement('TaxonName') |
|
156 |
childRef = ScientificName() |
|
157 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
158 |
usedObjectsStack.pop() |
|
159 |
|
|
160 |
return myNode |
|
161 |
|
|
162 |
def retrieveOrNew(self,node): |
|
163 |
return TaxonNames() |
|
164 |
|
|
165 |
|
|
166 |
class Meta: |
|
167 |
db_table = u'v_taxonnames_uc' |
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
class TaxonConcepts(models.Model): |
|
172 |
entryInfo = models.ForeignKey('EntryInfo') |
|
173 |
|
|
174 |
def exportVegX(self,myNode,doc): |
|
175 |
for childRef in self.TaxonConceptType_TaxonConcepts_id.all(): |
|
176 |
newEl = doc.createElement('TaxonConcept') |
|
177 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
178 |
|
|
179 |
return myNode |
|
180 |
|
|
181 |
def importVegX(self,node,info): |
|
182 |
self.entryInfo = info |
|
183 |
self.save() |
|
184 |
#members & relationships |
|
185 |
for child in node.childNodes: |
|
186 |
cName = child.nodeName |
|
187 |
#These are the elements that refer to this one |
|
188 |
if cName == 'TaxonConcept': |
|
189 |
newEl = TaxonConceptType().retrieveOrNew(child) |
|
190 |
newEl.TaxonConcepts_id = self |
|
191 |
newEl.importVegX(child,info) |
|
192 |
|
|
193 |
self.save() |
|
194 |
|
|
195 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
196 |
if 'TaxonConceptType' not in usedObjectsStack: |
|
197 |
usedObjectsStack.append('TaxonConceptType') |
|
198 |
|
|
199 |
newEl = doc.createElement('TaxonConcept') |
|
200 |
childRef = TaxonConceptType() |
|
201 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
202 |
usedObjectsStack.pop() |
|
203 |
|
|
204 |
return myNode |
|
205 |
|
|
206 |
def retrieveOrNew(self,node): |
|
207 |
return TaxonConcepts() |
|
208 |
|
|
209 |
|
|
210 |
class Meta: |
|
211 |
db_table = u'v_taxonconcepts_uc' |
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
class eml_access(models.Model): |
|
216 |
entryInfo = models.ForeignKey('EntryInfo') |
|
217 |
access = models.ForeignKey('AccessType', related_name='eml_access_access', null=True, blank=True) #Complex one2Many |
|
218 |
|
|
219 |
def exportVegX(self,myNode,doc): |
|
220 |
if self.access != None: |
|
221 |
newEl = doc.createElement('access') |
|
222 |
myNode.appendChild(self.access.exportVegX(newEl,doc)) |
|
223 |
|
|
224 |
return myNode |
|
225 |
|
|
226 |
def importVegX(self,node,info): |
|
227 |
self.entryInfo = info |
|
228 |
self.save() |
|
229 |
#members & relationships |
|
230 |
for child in node.childNodes: |
|
231 |
cName = child.nodeName |
|
232 |
if cName == 'access': |
|
233 |
newEl = AccessType().retrieveOrNew(child) |
|
234 |
newEl.importVegX(child,info) |
|
235 |
self.access = newEl |
|
236 |
|
|
237 |
self.save() |
|
238 |
|
|
239 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
240 |
if 'AccessType' not in usedObjectsStack: |
|
241 |
usedObjectsStack.append('AccessType') |
|
242 |
newEl = doc.createElement('access') |
|
243 |
newElObj = AccessType() |
|
244 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
245 |
usedObjectsStack.pop() |
|
246 |
|
|
247 |
return myNode |
|
248 |
|
|
249 |
def retrieveOrNew(self,node): |
|
250 |
return eml_access() |
|
251 |
|
|
252 |
|
|
253 |
class AccessType(models.Model): |
|
254 |
entryInfo = models.ForeignKey('EntryInfo') |
|
255 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', related_name='AccessType_ReferencesGroup', null=True, blank=True) #Complex one2Many |
|
256 |
allow = models.ManyToManyField('AccessRule',related_name='AccessType_allow') |
|
257 |
deny = models.ManyToManyField('AccessRule',related_name='AccessType_deny') |
|
258 |
attr_id = models.CharField(max_length=255, null=True, blank=True, db_index=True) |
|
259 |
attr_system = models.CharField(max_length=255, null=True, blank=True) |
|
260 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document') |
|
261 |
attr_order = models.CharField(max_length=255, null=True, blank=True, default = 'allowFirst') |
|
262 |
attr_authSystem = models.CharField(max_length=255) |
|
263 |
|
|
264 |
def exportVegX(self,myNode,doc): |
|
265 |
if self.attr_id != None: |
|
266 |
newAttr = doc.createAttribute('id') |
|
267 |
newAttr.value = str(self.attr_id) |
|
268 |
myNode.setAttributeNode(newAttr) |
|
269 |
|
|
270 |
if self.attr_system != None: |
|
271 |
newAttr = doc.createAttribute('system') |
|
272 |
newAttr.value = str(self.attr_system) |
|
273 |
myNode.setAttributeNode(newAttr) |
|
274 |
|
|
275 |
if self.attr_scope != None: |
|
276 |
newAttr = doc.createAttribute('scope') |
|
277 |
newAttr.value = str(self.attr_scope) |
|
278 |
myNode.setAttributeNode(newAttr) |
|
279 |
|
|
280 |
if self.attr_order != None: |
|
281 |
newAttr = doc.createAttribute('order') |
|
282 |
newAttr.value = str(self.attr_order) |
|
283 |
myNode.setAttributeNode(newAttr) |
|
284 |
|
|
285 |
if self.attr_authSystem != None: |
|
286 |
newAttr = doc.createAttribute('authSystem') |
|
287 |
newAttr.value = str(self.attr_authSystem) |
|
288 |
myNode.setAttributeNode(newAttr) |
|
289 |
|
|
290 |
if self.ReferencesGroup != None: |
|
291 |
newEl = doc.createElement('ReferencesGroup') |
|
292 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc)) |
|
293 |
|
|
294 |
for childRef in self.allow.all(): |
|
295 |
newEl = doc.createElement('allow') |
|
296 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
297 |
|
|
298 |
for childRef in self.deny.all(): |
|
299 |
newEl = doc.createElement('deny') |
|
300 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
301 |
|
|
302 |
return myNode |
|
303 |
|
|
304 |
def importVegX(self,node,info): |
|
305 |
self.entryInfo = info |
|
306 |
self.save() |
|
307 |
#attributes |
|
308 |
for attr in node.attributes.keys(): |
|
309 |
aName = 'attr_' + attr |
|
310 |
aVal = node.attributes[attr].nodeValue |
|
311 |
if aName == 'attr_id': |
|
312 |
self.attr_id = aVal |
|
313 |
elif aName == 'attr_system': |
|
314 |
self.attr_system = aVal |
|
315 |
elif aName == 'attr_scope': |
|
316 |
self.attr_scope = aVal |
|
317 |
elif aName == 'attr_order': |
|
318 |
self.attr_order = aVal |
|
319 |
elif aName == 'attr_authSystem': |
|
320 |
self.attr_authSystem = aVal |
|
321 |
#members & relationships |
|
322 |
for child in node.childNodes: |
|
323 |
cName = child.nodeName |
|
324 |
if cName == 'ReferencesGroup': |
|
325 |
newEl = ReferencesGroup().retrieveOrNew(child) |
|
326 |
newEl.importVegX(child,info) |
|
327 |
self.ReferencesGroup = newEl |
|
328 |
elif cName == 'allow': |
|
329 |
newEl = AccessRule().retrieveOrNew(child) |
|
330 |
newEl.importVegX(child,info) |
|
331 |
self.allow.add(newEl) |
|
332 |
elif cName == 'deny': |
|
333 |
newEl = AccessRule().retrieveOrNew(child) |
|
334 |
newEl.importVegX(child,info) |
|
335 |
self.deny.add(newEl) |
|
336 |
|
|
337 |
self.save() |
|
338 |
|
|
339 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
340 |
newAttr = doc.createAttribute('id') |
|
341 |
newAttr.value = str(getRandomString()) |
|
342 |
myNode.setAttributeNode(newAttr) |
|
343 |
|
|
344 |
newAttr = doc.createAttribute('system') |
|
345 |
newAttr.value = str(getRandomString()) |
|
346 |
myNode.setAttributeNode(newAttr) |
|
347 |
|
|
348 |
newAttr = doc.createAttribute('scope') |
|
349 |
newAttr.value = str(getRandomString()) |
|
350 |
myNode.setAttributeNode(newAttr) |
|
351 |
|
|
352 |
newAttr = doc.createAttribute('order') |
|
353 |
newAttr.value = str(getRandomString()) |
|
354 |
myNode.setAttributeNode(newAttr) |
|
355 |
|
|
356 |
newAttr = doc.createAttribute('authSystem') |
|
357 |
newAttr.value = str(getRandomString()) |
|
358 |
myNode.setAttributeNode(newAttr) |
|
359 |
|
|
360 |
if 'ReferencesGroup' not in usedObjectsStack: |
|
361 |
usedObjectsStack.append('ReferencesGroup') |
|
362 |
newEl = doc.createElement('ReferencesGroup') |
|
363 |
newElObj = ReferencesGroup() |
|
364 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
365 |
usedObjectsStack.pop() |
|
366 |
|
|
367 |
if 'AccessRule' not in usedObjectsStack: |
|
368 |
usedObjectsStack.append('AccessRule') |
|
369 |
newEl = doc.createElement('allow') |
|
370 |
newElObj = AccessRule() |
|
371 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
372 |
usedObjectsStack.pop() |
|
373 |
|
|
374 |
if 'AccessRule' not in usedObjectsStack: |
|
375 |
usedObjectsStack.append('AccessRule') |
|
376 |
newEl = doc.createElement('deny') |
|
377 |
newElObj = AccessRule() |
|
378 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
379 |
usedObjectsStack.pop() |
|
380 |
|
|
381 |
return myNode |
|
382 |
|
|
383 |
def retrieveOrNew(self,node): |
|
384 |
a_id = None |
|
385 |
a_system = None |
|
386 |
a_scope = None |
|
387 |
for attr in node.attributes.keys(): |
|
388 |
aVal = node.attributes[attr].nodeValue |
|
389 |
if attr == 'id': |
|
390 |
a_id = aVal |
|
391 |
elif attr == 'system': |
|
392 |
a_system = aVal |
|
393 |
elif attr == 'scope': |
|
394 |
a_scope = aVal |
|
395 |
if a_id != None: |
|
396 |
q = AccessType.objects.filter(attr_id__exact = a_id) |
|
397 |
if a_system != None: |
|
398 |
q = q.filter(attr_system__exact = a_system) |
|
399 |
if a_scope != None: |
|
400 |
q = q.filter(attr_scope__exact = a_scope) |
|
401 |
if len(q) > 0: |
|
402 |
return q[0] |
|
403 |
else: |
|
404 |
return AccessType() |
|
405 |
else: |
|
406 |
return AccessType() |
|
407 |
|
|
408 |
|
|
409 |
class ReferencesGroup(models.Model): |
|
410 |
entryInfo = models.ForeignKey('EntryInfo') |
|
411 |
references = models.CharField(max_length=255, null=True, blank=True) |
|
412 |
|
|
413 |
def exportVegX(self,myNode,doc): |
|
414 |
if self.references != None: |
|
415 |
newEl = doc.createElement('references') |
|
416 |
newElText = doc.createTextNode(str(self.references)) |
|
417 |
newEl.appendChild(newElText) |
|
418 |
myNode.appendChild(newEl) |
|
419 |
|
|
420 |
return myNode |
|
421 |
|
|
422 |
def importVegX(self,node,info): |
|
423 |
self.entryInfo = info |
|
424 |
self.save() |
|
425 |
#members & relationships |
|
426 |
for child in node.childNodes: |
|
427 |
cName = child.nodeName |
|
428 |
if cName == 'references': |
|
429 |
if(len(child.childNodes) > 0): |
|
430 |
cVal = child.childNodes[0].nodeValue |
|
431 |
self.references = cVal |
|
432 |
|
|
433 |
self.save() |
|
434 |
|
|
435 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
436 |
newEl = doc.createElement('references') |
|
437 |
newElText = doc.createTextNode(str(getRandomString())) |
|
438 |
newEl.appendChild(newElText) |
|
439 |
myNode.appendChild(newEl) |
|
440 |
|
|
441 |
return myNode |
|
442 |
|
|
443 |
def retrieveOrNew(self,node): |
|
444 |
return ReferencesGroup() |
|
445 |
|
|
446 |
|
|
447 |
class AccessRule(models.Model): |
|
448 |
entryInfo = models.ForeignKey('EntryInfo') |
|
449 |
|
|
450 |
def exportVegX(self,myNode,doc): |
|
451 |
for childRef in self.AccessRule_principal_AccessRule_id.all(): |
|
452 |
newEl = doc.createElement('principal') |
|
453 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
454 |
|
|
455 |
for childRef in self.AccessRule_permission_AccessRule_id.all(): |
|
456 |
newEl = doc.createElement('permission') |
|
457 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
458 |
|
|
459 |
return myNode |
|
460 |
|
|
461 |
def importVegX(self,node,info): |
|
462 |
self.entryInfo = info |
|
463 |
self.save() |
|
464 |
#members & relationships |
|
465 |
for child in node.childNodes: |
|
466 |
cName = child.nodeName |
|
467 |
#These are the elements that refer to this one |
|
468 |
if cName == 'principal': |
|
469 |
newEl = AccessRule_principal().retrieveOrNew(child) |
|
470 |
newEl.AccessRule_id = self |
|
471 |
newEl.importVegX(child,info) |
|
472 |
elif cName == 'permission': |
|
473 |
newEl = AccessRule_permission().retrieveOrNew(child) |
|
474 |
newEl.AccessRule_id = self |
|
475 |
newEl.importVegX(child,info) |
|
476 |
|
|
477 |
self.save() |
|
478 |
|
|
479 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
480 |
if 'AccessRule_principal' not in usedObjectsStack: |
|
481 |
usedObjectsStack.append('AccessRule_principal') |
|
482 |
|
|
483 |
newEl = doc.createElement('principal') |
|
484 |
childRef = AccessRule_principal() |
|
485 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
486 |
usedObjectsStack.pop() |
|
487 |
|
|
488 |
if 'AccessRule_permission' not in usedObjectsStack: |
|
489 |
usedObjectsStack.append('AccessRule_permission') |
|
490 |
|
|
491 |
newEl = doc.createElement('permission') |
|
492 |
childRef = AccessRule_permission() |
|
493 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
494 |
usedObjectsStack.pop() |
|
495 |
|
|
496 |
return myNode |
|
497 |
|
|
498 |
def retrieveOrNew(self,node): |
|
499 |
return AccessRule() |
|
500 |
|
|
501 |
|
|
502 |
class AccessRule_principal(models.Model): |
|
503 |
entryInfo = models.ForeignKey('EntryInfo') |
|
504 |
AccessRule_id = models.ForeignKey('AccessRule', related_name='AccessRule_principal_AccessRule_id') |
|
505 |
primitive_type_value = models.CharField(max_length=255, null=True, blank=True) |
|
506 |
|
|
507 |
def exportVegX(self,myNode,doc): |
|
508 |
if self.primitive_type_value != None: |
|
509 |
newElText = doc.createTextNode(self.primitive_type_value) |
|
510 |
myNode.appendChild(newElText) |
|
511 |
|
|
512 |
return myNode |
|
513 |
|
|
514 |
def importVegX(self,node,info): |
|
515 |
self.entryInfo = info |
|
516 |
self.save() |
|
517 |
#members & relationships |
|
518 |
for child in node.childNodes: |
|
519 |
cName = child.nodeName |
|
520 |
if(len(node.childNodes) > 0): |
|
521 |
cVal = node.childNodes[0].nodeValue |
|
522 |
self.primitive_type_value = cVal |
|
523 |
|
|
524 |
self.save() |
|
525 |
|
|
526 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
527 |
newElText = doc.createTextNode(str(getRandomString())) |
|
528 |
myNode.appendChild(newElText) |
|
529 |
|
|
530 |
return myNode |
|
531 |
|
|
532 |
def retrieveOrNew(self,node): |
|
533 |
return AccessRule_principal() |
|
534 |
|
|
535 |
|
|
536 |
class AccessRule_permission(models.Model): |
|
537 |
entryInfo = models.ForeignKey('EntryInfo') |
|
538 |
AccessRule_id = models.ForeignKey('AccessRule', related_name='AccessRule_permission_AccessRule_id') |
|
539 |
primitive_type_value = models.CharField(max_length=255, null=True, blank=True) |
|
540 |
|
|
541 |
def exportVegX(self,myNode,doc): |
|
542 |
if self.primitive_type_value != None: |
|
543 |
newElText = doc.createTextNode(self.primitive_type_value) |
|
544 |
myNode.appendChild(newElText) |
|
545 |
|
|
546 |
return myNode |
|
547 |
|
|
548 |
def importVegX(self,node,info): |
|
549 |
self.entryInfo = info |
|
550 |
self.save() |
|
551 |
#members & relationships |
|
552 |
for child in node.childNodes: |
|
553 |
cName = child.nodeName |
|
554 |
if(len(node.childNodes) > 0): |
|
555 |
cVal = node.childNodes[0].nodeValue |
|
556 |
self.primitive_type_value = cVal |
|
557 |
|
|
558 |
self.save() |
|
559 |
|
|
560 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
561 |
newElText = doc.createTextNode(str(getRandomString())) |
|
562 |
myNode.appendChild(newElText) |
|
563 |
|
|
564 |
return myNode |
|
565 |
|
|
566 |
def retrieveOrNew(self,node): |
|
567 |
return AccessRule_permission() |
|
568 |
|
|
569 |
|
|
570 |
class GeographicCoverage(models.Model): |
|
571 |
entryInfo = models.ForeignKey('EntryInfo') |
|
572 |
Coverage_id = models.ForeignKey('Coverage', related_name='GeographicCoverage_Coverage_id', null=True, blank=True) #Complex one2Many |
|
573 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', related_name='GeographicCoverage_ReferencesGroup', null=True, blank=True) #Complex one2Many |
|
574 |
boundingCoordinates = models.ForeignKey('boundingCoordinates', related_name='GeographicCoverage_boundingCoordinates', null=True, blank=True) #Complex one2Many |
|
575 |
Map_id = models.ForeignKey('Map', related_name='GeographicCoverage_Map_id', null=True, blank=True) #Complex one2Many |
|
576 |
attr_id = models.CharField(max_length=255, null=True, blank=True, db_index=True) |
|
577 |
attr_system = models.CharField(max_length=255, null=True, blank=True) |
|
578 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document') |
|
579 |
geographicDescription = models.CharField(max_length=255, null=True, blank=True) |
|
580 |
|
|
581 |
def exportVegX(self,myNode,doc): |
|
582 |
if self.attr_id != None: |
|
583 |
newAttr = doc.createAttribute('id') |
|
584 |
newAttr.value = str(self.attr_id) |
|
585 |
myNode.setAttributeNode(newAttr) |
|
586 |
|
|
587 |
if self.attr_system != None: |
|
588 |
newAttr = doc.createAttribute('system') |
|
589 |
newAttr.value = str(self.attr_system) |
|
590 |
myNode.setAttributeNode(newAttr) |
|
591 |
|
|
592 |
if self.attr_scope != None: |
|
593 |
newAttr = doc.createAttribute('scope') |
|
594 |
newAttr.value = str(self.attr_scope) |
|
595 |
myNode.setAttributeNode(newAttr) |
|
596 |
|
|
597 |
if self.geographicDescription != None: |
|
598 |
newEl = doc.createElement('geographicDescription') |
|
599 |
newElText = doc.createTextNode(str(self.geographicDescription)) |
|
600 |
newEl.appendChild(newElText) |
|
601 |
myNode.appendChild(newEl) |
|
602 |
|
|
603 |
if self.ReferencesGroup != None: |
|
604 |
newEl = doc.createElement('ReferencesGroup') |
|
605 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc)) |
|
606 |
|
|
607 |
if self.boundingCoordinates != None: |
|
608 |
newEl = doc.createElement('boundingCoordinates') |
|
609 |
myNode.appendChild(self.boundingCoordinates.exportVegX(newEl,doc)) |
|
610 |
|
|
611 |
for childRef in self.datasetGPolygon_GeographicCoverage_id.all(): |
|
612 |
newEl = doc.createElement('datasetGPolygon') |
|
613 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
614 |
|
|
615 |
return myNode |
|
616 |
|
|
617 |
def importVegX(self,node,info): |
|
618 |
self.entryInfo = info |
|
619 |
self.save() |
|
620 |
#attributes |
|
621 |
for attr in node.attributes.keys(): |
|
622 |
aName = 'attr_' + attr |
|
623 |
aVal = node.attributes[attr].nodeValue |
|
624 |
if aName == 'attr_id': |
|
625 |
self.attr_id = aVal |
|
626 |
elif aName == 'attr_system': |
|
627 |
self.attr_system = aVal |
|
628 |
elif aName == 'attr_scope': |
|
629 |
self.attr_scope = aVal |
|
630 |
#members & relationships |
|
631 |
for child in node.childNodes: |
|
632 |
cName = child.nodeName |
|
633 |
if cName == 'geographicDescription': |
|
634 |
if(len(child.childNodes) > 0): |
|
635 |
cVal = child.childNodes[0].nodeValue |
|
636 |
self.geographicDescription = cVal |
|
637 |
elif cName == 'ReferencesGroup': |
|
638 |
newEl = ReferencesGroup().retrieveOrNew(child) |
|
639 |
newEl.importVegX(child,info) |
|
640 |
self.ReferencesGroup = newEl |
|
641 |
elif cName == 'boundingCoordinates': |
|
642 |
newEl = boundingCoordinates().retrieveOrNew(child) |
|
643 |
newEl.importVegX(child,info) |
|
644 |
self.boundingCoordinates = newEl |
|
645 |
#These are the elements that refer to this one |
|
646 |
elif cName == 'datasetGPolygon': |
|
647 |
newEl = datasetGPolygon().retrieveOrNew(child) |
|
648 |
newEl.GeographicCoverage_id = self |
|
649 |
newEl.importVegX(child,info) |
|
650 |
|
|
651 |
self.save() |
|
652 |
|
|
653 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
654 |
newAttr = doc.createAttribute('id') |
|
655 |
newAttr.value = str(getRandomString()) |
|
656 |
myNode.setAttributeNode(newAttr) |
|
657 |
|
|
658 |
newAttr = doc.createAttribute('system') |
|
659 |
newAttr.value = str(getRandomString()) |
|
660 |
myNode.setAttributeNode(newAttr) |
|
661 |
|
|
662 |
newAttr = doc.createAttribute('scope') |
|
663 |
newAttr.value = str(getRandomString()) |
|
664 |
myNode.setAttributeNode(newAttr) |
|
665 |
|
|
666 |
newEl = doc.createElement('geographicDescription') |
|
667 |
newElText = doc.createTextNode(str(getRandomString())) |
|
668 |
newEl.appendChild(newElText) |
|
669 |
myNode.appendChild(newEl) |
|
670 |
|
|
671 |
if 'ReferencesGroup' not in usedObjectsStack: |
|
672 |
usedObjectsStack.append('ReferencesGroup') |
|
673 |
newEl = doc.createElement('ReferencesGroup') |
|
674 |
newElObj = ReferencesGroup() |
|
675 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
676 |
usedObjectsStack.pop() |
|
677 |
|
|
678 |
if 'boundingCoordinates' not in usedObjectsStack: |
|
679 |
usedObjectsStack.append('boundingCoordinates') |
|
680 |
newEl = doc.createElement('boundingCoordinates') |
|
681 |
newElObj = boundingCoordinates() |
|
682 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
683 |
usedObjectsStack.pop() |
|
684 |
|
|
685 |
if 'datasetGPolygon' not in usedObjectsStack: |
|
686 |
usedObjectsStack.append('datasetGPolygon') |
|
687 |
|
|
688 |
newEl = doc.createElement('datasetGPolygon') |
|
689 |
childRef = datasetGPolygon() |
|
690 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
691 |
usedObjectsStack.pop() |
|
692 |
|
|
693 |
return myNode |
|
694 |
|
|
695 |
def retrieveOrNew(self,node): |
|
696 |
a_id = None |
|
697 |
a_system = None |
|
698 |
a_scope = None |
|
699 |
for attr in node.attributes.keys(): |
|
700 |
aVal = node.attributes[attr].nodeValue |
|
701 |
if attr == 'id': |
|
702 |
a_id = aVal |
|
703 |
elif attr == 'system': |
|
704 |
a_system = aVal |
|
705 |
elif attr == 'scope': |
|
706 |
a_scope = aVal |
|
707 |
if a_id != None: |
|
708 |
q = GeographicCoverage.objects.filter(attr_id__exact = a_id) |
|
709 |
if a_system != None: |
|
710 |
q = q.filter(attr_system__exact = a_system) |
|
711 |
if a_scope != None: |
|
712 |
q = q.filter(attr_scope__exact = a_scope) |
|
713 |
if len(q) > 0: |
|
714 |
return q[0] |
|
715 |
else: |
|
716 |
return GeographicCoverage() |
|
717 |
else: |
|
718 |
return GeographicCoverage() |
|
719 |
|
|
720 |
|
|
721 |
class TemporalCoverage(models.Model): |
|
722 |
entryInfo = models.ForeignKey('EntryInfo') |
|
723 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', related_name='TemporalCoverage_ReferencesGroup', null=True, blank=True) #Complex one2Many |
|
724 |
rangeOfDates = models.ForeignKey('rangeOfDates', related_name='TemporalCoverage_rangeOfDates', null=True, blank=True) #Complex one2Many |
|
725 |
attr_id = models.CharField(max_length=255, null=True, blank=True, db_index=True) |
|
726 |
|
|
727 |
def exportVegX(self,myNode,doc): |
|
728 |
if self.attr_id != None: |
|
729 |
newAttr = doc.createAttribute('id') |
|
730 |
newAttr.value = str(self.attr_id) |
|
731 |
myNode.setAttributeNode(newAttr) |
|
732 |
|
|
733 |
if self.ReferencesGroup != None: |
|
734 |
newEl = doc.createElement('ReferencesGroup') |
|
735 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc)) |
|
736 |
|
|
737 |
if self.rangeOfDates != None: |
|
738 |
newEl = doc.createElement('rangeOfDates') |
|
739 |
myNode.appendChild(self.rangeOfDates.exportVegX(newEl,doc)) |
|
740 |
|
|
741 |
for childRef in self.SingleDateTimeType_TemporalCoverage_id.all(): |
|
742 |
newEl = doc.createElement('singleDateTime') |
|
743 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
744 |
|
|
745 |
return myNode |
|
746 |
|
|
747 |
def importVegX(self,node,info): |
|
748 |
self.entryInfo = info |
|
749 |
self.save() |
|
750 |
#attributes |
|
751 |
for attr in node.attributes.keys(): |
|
752 |
aName = 'attr_' + attr |
|
753 |
aVal = node.attributes[attr].nodeValue |
|
754 |
if aName == 'attr_id': |
|
755 |
self.attr_id = aVal |
|
756 |
#members & relationships |
|
757 |
for child in node.childNodes: |
|
758 |
cName = child.nodeName |
|
759 |
if cName == 'ReferencesGroup': |
|
760 |
newEl = ReferencesGroup().retrieveOrNew(child) |
|
761 |
newEl.importVegX(child,info) |
|
762 |
self.ReferencesGroup = newEl |
|
763 |
elif cName == 'rangeOfDates': |
|
764 |
newEl = rangeOfDates().retrieveOrNew(child) |
|
765 |
newEl.importVegX(child,info) |
|
766 |
self.rangeOfDates = newEl |
|
767 |
#These are the elements that refer to this one |
|
768 |
elif cName == 'singleDateTime': |
|
769 |
newEl = SingleDateTimeType().retrieveOrNew(child) |
|
770 |
newEl.TemporalCoverage_id = self |
|
771 |
newEl.importVegX(child,info) |
|
772 |
|
|
773 |
self.save() |
|
774 |
|
|
775 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
776 |
newAttr = doc.createAttribute('id') |
|
777 |
newAttr.value = str(getRandomString()) |
|
778 |
myNode.setAttributeNode(newAttr) |
|
779 |
|
|
780 |
if 'ReferencesGroup' not in usedObjectsStack: |
|
781 |
usedObjectsStack.append('ReferencesGroup') |
|
782 |
newEl = doc.createElement('ReferencesGroup') |
|
783 |
newElObj = ReferencesGroup() |
|
784 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
785 |
usedObjectsStack.pop() |
|
786 |
|
|
787 |
if 'rangeOfDates' not in usedObjectsStack: |
|
788 |
usedObjectsStack.append('rangeOfDates') |
|
789 |
newEl = doc.createElement('rangeOfDates') |
|
790 |
newElObj = rangeOfDates() |
|
791 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
792 |
usedObjectsStack.pop() |
|
793 |
|
|
794 |
if 'SingleDateTimeType' not in usedObjectsStack: |
|
795 |
usedObjectsStack.append('SingleDateTimeType') |
|
796 |
|
|
797 |
newEl = doc.createElement('singleDateTime') |
|
798 |
childRef = SingleDateTimeType() |
|
799 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
800 |
usedObjectsStack.pop() |
|
801 |
|
|
802 |
return myNode |
|
803 |
|
|
804 |
def retrieveOrNew(self,node): |
|
805 |
id_val = None #ad hoc attr |
|
806 |
for attr in node.attributes.keys(): |
|
807 |
aVal = node.attributes[attr].nodeValue |
|
808 |
if attr == 'id': |
|
809 |
id_val = aVal |
|
810 |
|
|
811 |
if id_val != None: |
|
812 |
q = TemporalCoverage.objects.filter(attr_id__exact = id_val) |
|
813 |
if len(q) > 0: |
|
814 |
return q[0] |
|
815 |
else: |
|
816 |
return TemporalCoverage() |
|
817 |
else: |
|
818 |
return TemporalCoverage() |
|
819 |
|
|
820 |
|
|
821 |
class Meta: |
|
822 |
db_table = u'v_temporalcoverage_uc' |
|
823 |
|
|
824 |
|
|
825 |
|
|
826 |
class temporalCoverageLC(models.Model): |
|
827 |
entryInfo = models.ForeignKey('EntryInfo') |
|
828 |
TemporalCoverage_extend = models.ForeignKey('TemporalCoverage', related_name='temporalCoverageLC_TemporalCoverage_extend') #Complex one2Many |
|
829 |
Coverage_id = models.ForeignKey('Coverage', related_name='temporalCoverageLC_Coverage_id', null=True, blank=True) #Complex one2Many |
|
830 |
attr_system = models.CharField(max_length=255, null=True, blank=True) |
|
831 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document') |
|
832 |
|
|
833 |
def exportVegX(self,myNode,doc): |
|
834 |
if self.attr_system != None: |
|
835 |
newAttr = doc.createAttribute('system') |
|
836 |
newAttr.value = str(self.attr_system) |
|
837 |
myNode.setAttributeNode(newAttr) |
|
838 |
|
|
839 |
if self.attr_scope != None: |
|
840 |
newAttr = doc.createAttribute('scope') |
|
841 |
newAttr.value = str(self.attr_scope) |
|
842 |
myNode.setAttributeNode(newAttr) |
|
843 |
|
|
844 |
if self.TemporalCoverage_extend != None: |
|
845 |
myNode = self.TemporalCoverage_extend.exportVegX(myNode,doc) |
|
846 |
|
|
847 |
return myNode |
|
848 |
|
|
849 |
def importVegX(self,node,info): |
|
850 |
self.entryInfo = info |
|
851 |
extendedEl = TemporalCoverage().retrieveOrNew(node) |
|
852 |
extendedEl.importVegX(node,info) |
|
853 |
self.TemporalCoverage_extend = extendedEl |
|
854 |
|
|
855 |
self.save() |
|
856 |
#attributes |
|
857 |
for attr in node.attributes.keys(): |
|
858 |
aName = 'attr_' + attr |
|
859 |
aVal = node.attributes[attr].nodeValue |
|
860 |
if aName == 'attr_system': |
|
861 |
self.attr_system = aVal |
|
862 |
elif aName == 'attr_scope': |
|
863 |
self.attr_scope = aVal |
|
864 |
#members & relationships |
|
865 |
for child in node.childNodes: |
|
866 |
cName = child.nodeName |
|
867 |
|
|
868 |
self.save() |
|
869 |
|
|
870 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
871 |
newAttr = doc.createAttribute('system') |
|
872 |
newAttr.value = str(getRandomString()) |
|
873 |
myNode.setAttributeNode(newAttr) |
|
874 |
|
|
875 |
newAttr = doc.createAttribute('scope') |
|
876 |
newAttr.value = str(getRandomString()) |
|
877 |
myNode.setAttributeNode(newAttr) |
|
878 |
|
|
879 |
if 'TemporalCoverage' not in usedObjectsStack: |
|
880 |
usedObjectsStack.append('TemporalCoverage') |
|
881 |
newElObj = TemporalCoverage() |
|
882 |
myNode = newElObj.exportDummyVegX(myNode,doc,usedObjectsStack) |
|
883 |
usedObjectsStack.pop() |
|
884 |
|
|
885 |
return myNode |
|
886 |
|
|
887 |
def retrieveOrNew(self,node): |
|
888 |
system_val = None |
|
889 |
scope_val = None |
|
890 |
id_val = None #ad hoc attr |
|
891 |
for attr in node.attributes.keys(): |
|
892 |
aVal = node.attributes[attr].nodeValue |
|
893 |
if attr == 'id': |
|
894 |
id_val = aVal |
|
895 |
if attr == 'system': |
|
896 |
system_val = aVal |
|
897 |
if attr == 'scope': |
|
898 |
scope_val = aVal |
|
899 |
|
|
900 |
if id_val != None: |
|
901 |
q = temporalCoverageLC.objects.filter(TemporalCoverage_extend__attr_id__exact = id_val) |
|
902 |
if system_val != None: |
|
903 |
q = q.filter(attr_system__exact = system_val) |
|
904 |
if scope_val != None: |
|
905 |
q = q.filter(attr_scope__exact = scope_val) |
|
906 |
if len(q) > 0: |
|
907 |
return q[0] |
|
908 |
else: |
|
909 |
return temporalCoverageLC() |
|
910 |
else: |
|
911 |
return temporalCoverageLC() |
|
912 |
|
|
913 |
|
|
914 |
class TaxonomicCoverage(models.Model): |
|
915 |
entryInfo = models.ForeignKey('EntryInfo') |
|
916 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', related_name='TaxonomicCoverage_ReferencesGroup', null=True, blank=True) #Complex one2Many |
|
917 |
taxonomicSystem = models.ForeignKey('taxonomicSystem', related_name='TaxonomicCoverage_taxonomicSystem', null=True, blank=True) #Complex one2Many |
|
918 |
attr_id = models.CharField(max_length=255, null=True, blank=True, db_index=True) |
|
919 |
generalTaxonomicCoverage = models.CharField(max_length=255, null=True, blank=True) |
|
920 |
|
|
921 |
def exportVegX(self,myNode,doc): |
|
922 |
if self.attr_id != None: |
|
923 |
newAttr = doc.createAttribute('id') |
|
924 |
newAttr.value = str(self.attr_id) |
|
925 |
myNode.setAttributeNode(newAttr) |
|
926 |
|
|
927 |
if self.generalTaxonomicCoverage != None: |
|
928 |
newEl = doc.createElement('generalTaxonomicCoverage') |
|
929 |
newElText = doc.createTextNode(str(self.generalTaxonomicCoverage)) |
|
930 |
newEl.appendChild(newElText) |
|
931 |
myNode.appendChild(newEl) |
|
932 |
|
|
933 |
if self.ReferencesGroup != None: |
|
934 |
newEl = doc.createElement('ReferencesGroup') |
|
935 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc)) |
|
936 |
|
|
937 |
if self.taxonomicSystem != None: |
|
938 |
newEl = doc.createElement('taxonomicSystem') |
|
939 |
myNode.appendChild(self.taxonomicSystem.exportVegX(newEl,doc)) |
|
940 |
|
|
941 |
for childRef in self.TaxonomicClassificationType_TaxonomicCoverage_id.all(): |
|
942 |
newEl = doc.createElement('taxonomicClassification') |
|
943 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
944 |
|
|
945 |
return myNode |
|
946 |
|
|
947 |
def importVegX(self,node,info): |
|
948 |
self.entryInfo = info |
|
949 |
self.save() |
|
950 |
#attributes |
|
951 |
for attr in node.attributes.keys(): |
|
952 |
aName = 'attr_' + attr |
|
953 |
aVal = node.attributes[attr].nodeValue |
|
954 |
if aName == 'attr_id': |
|
955 |
self.attr_id = aVal |
|
956 |
#members & relationships |
|
957 |
for child in node.childNodes: |
|
958 |
cName = child.nodeName |
|
959 |
if cName == 'generalTaxonomicCoverage': |
|
960 |
if(len(child.childNodes) > 0): |
|
961 |
cVal = child.childNodes[0].nodeValue |
|
962 |
self.generalTaxonomicCoverage = cVal |
|
963 |
elif cName == 'ReferencesGroup': |
|
964 |
newEl = ReferencesGroup().retrieveOrNew(child) |
|
965 |
newEl.importVegX(child,info) |
|
966 |
self.ReferencesGroup = newEl |
|
967 |
elif cName == 'taxonomicSystem': |
|
968 |
newEl = taxonomicSystem().retrieveOrNew(child) |
|
969 |
newEl.importVegX(child,info) |
|
970 |
self.taxonomicSystem = newEl |
|
971 |
#These are the elements that refer to this one |
|
972 |
elif cName == 'taxonomicClassification': |
|
973 |
newEl = TaxonomicClassificationType().retrieveOrNew(child) |
|
974 |
newEl.TaxonomicCoverage_id = self |
|
975 |
newEl.importVegX(child,info) |
|
976 |
|
|
977 |
self.save() |
|
978 |
|
|
979 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
980 |
newAttr = doc.createAttribute('id') |
|
981 |
newAttr.value = str(getRandomString()) |
|
982 |
myNode.setAttributeNode(newAttr) |
|
983 |
|
|
984 |
newEl = doc.createElement('generalTaxonomicCoverage') |
|
985 |
newElText = doc.createTextNode(str(getRandomString())) |
|
986 |
newEl.appendChild(newElText) |
|
987 |
myNode.appendChild(newEl) |
|
988 |
|
|
989 |
if 'ReferencesGroup' not in usedObjectsStack: |
|
990 |
usedObjectsStack.append('ReferencesGroup') |
|
991 |
newEl = doc.createElement('ReferencesGroup') |
|
992 |
newElObj = ReferencesGroup() |
|
993 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
994 |
usedObjectsStack.pop() |
|
995 |
|
|
996 |
if 'taxonomicSystem' not in usedObjectsStack: |
|
997 |
usedObjectsStack.append('taxonomicSystem') |
|
998 |
newEl = doc.createElement('taxonomicSystem') |
|
999 |
newElObj = taxonomicSystem() |
|
1000 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
1001 |
usedObjectsStack.pop() |
|
1002 |
|
|
1003 |
if 'TaxonomicClassificationType' not in usedObjectsStack: |
|
1004 |
usedObjectsStack.append('TaxonomicClassificationType') |
|
1005 |
|
|
1006 |
newEl = doc.createElement('taxonomicClassification') |
|
1007 |
childRef = TaxonomicClassificationType() |
|
1008 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
1009 |
usedObjectsStack.pop() |
|
1010 |
|
|
1011 |
return myNode |
|
1012 |
|
|
1013 |
def retrieveOrNew(self,node): |
|
1014 |
id_val = None #ad hoc attr |
|
1015 |
for attr in node.attributes.keys(): |
|
1016 |
aVal = node.attributes[attr].nodeValue |
|
1017 |
if attr == 'id': |
|
1018 |
id_val = aVal |
|
1019 |
|
|
1020 |
if id_val != None: |
|
1021 |
q = TaxonomicCoverage.objects.filter(attr_id__exact = id_val) |
|
1022 |
if len(q) > 0: |
|
1023 |
return q[0] |
|
1024 |
else: |
|
1025 |
return TaxonomicCoverage() |
|
1026 |
else: |
|
1027 |
return TaxonomicCoverage() |
|
1028 |
|
|
1029 |
|
|
1030 |
class taxonomicCoverageLC(models.Model): |
|
1031 |
entryInfo = models.ForeignKey('EntryInfo') |
|
1032 |
TaxonomicCoverage_extend = models.ForeignKey('TaxonomicCoverage', related_name='taxonomicCoverageLC_TaxonomicCoverage_extend') #Complex one2Many |
|
1033 |
Coverage_id = models.ForeignKey('Coverage', related_name='taxonomicCoverageLC_Coverage_id', null=True, blank=True) #Complex one2Many |
|
1034 |
attr_system = models.CharField(max_length=255, null=True, blank=True) |
|
1035 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document') |
|
1036 |
|
|
1037 |
def exportVegX(self,myNode,doc): |
|
1038 |
if self.attr_system != None: |
|
1039 |
newAttr = doc.createAttribute('system') |
|
1040 |
newAttr.value = str(self.attr_system) |
|
1041 |
myNode.setAttributeNode(newAttr) |
|
1042 |
|
|
1043 |
if self.attr_scope != None: |
|
1044 |
newAttr = doc.createAttribute('scope') |
|
1045 |
newAttr.value = str(self.attr_scope) |
|
1046 |
myNode.setAttributeNode(newAttr) |
|
1047 |
|
|
1048 |
if self.TaxonomicCoverage_extend != None: |
|
1049 |
myNode = self.TaxonomicCoverage_extend.exportVegX(myNode,doc) |
|
1050 |
|
|
1051 |
return myNode |
|
1052 |
|
|
1053 |
def importVegX(self,node,info): |
|
1054 |
self.entryInfo = info |
|
1055 |
extendedEl = TaxonomicCoverage().retrieveOrNew(node) |
|
1056 |
extendedEl.importVegX(node,info) |
|
1057 |
self.TaxonomicCoverage_extend = extendedEl |
|
1058 |
|
|
1059 |
self.save() |
|
1060 |
#attributes |
|
1061 |
for attr in node.attributes.keys(): |
|
1062 |
aName = 'attr_' + attr |
|
1063 |
aVal = node.attributes[attr].nodeValue |
|
1064 |
if aName == 'attr_system': |
|
1065 |
self.attr_system = aVal |
|
1066 |
elif aName == 'attr_scope': |
|
1067 |
self.attr_scope = aVal |
|
1068 |
#members & relationships |
|
1069 |
for child in node.childNodes: |
|
1070 |
cName = child.nodeName |
|
1071 |
|
|
1072 |
self.save() |
|
1073 |
|
|
1074 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
1075 |
newAttr = doc.createAttribute('system') |
|
1076 |
newAttr.value = str(getRandomString()) |
|
1077 |
myNode.setAttributeNode(newAttr) |
|
1078 |
|
|
1079 |
newAttr = doc.createAttribute('scope') |
|
1080 |
newAttr.value = str(getRandomString()) |
|
1081 |
myNode.setAttributeNode(newAttr) |
|
1082 |
|
|
1083 |
if 'TaxonomicCoverage' not in usedObjectsStack: |
|
1084 |
usedObjectsStack.append('TaxonomicCoverage') |
|
1085 |
newElObj = TaxonomicCoverage() |
|
1086 |
myNode = newElObj.exportDummyVegX(myNode,doc,usedObjectsStack) |
|
1087 |
usedObjectsStack.pop() |
|
1088 |
|
|
1089 |
return myNode |
|
1090 |
|
|
1091 |
def retrieveOrNew(self,node): |
|
1092 |
system_val = None |
|
1093 |
scope_val = None |
|
1094 |
id_val = None #ad hoc attr |
|
1095 |
for attr in node.attributes.keys(): |
|
1096 |
aVal = node.attributes[attr].nodeValue |
|
1097 |
if attr == 'id': |
|
1098 |
id_val = aVal |
|
1099 |
if attr == 'system': |
|
1100 |
system_val = aVal |
|
1101 |
if attr == 'scope': |
|
1102 |
scope_val = aVal |
|
1103 |
|
|
1104 |
if id_val != None: |
|
1105 |
q = taxonomicCoverageLC.objects.filter(TaxonomicCoverage_extend__attr_id__exact = id_val) |
|
1106 |
if system_val != None: |
|
1107 |
q = q.filter(attr_system__exact = system_val) |
|
1108 |
if scope_val != None: |
|
1109 |
q = q.filter(attr_scope__exact = scope_val) |
|
1110 |
if len(q) > 0: |
|
1111 |
return q[0] |
|
1112 |
else: |
|
1113 |
return taxonomicCoverageLC() |
|
1114 |
else: |
|
1115 |
return taxonomicCoverageLC() |
|
1116 |
|
|
1117 |
|
|
1118 |
class Coverage(models.Model): |
|
1119 |
entryInfo = models.ForeignKey('EntryInfo') |
|
1120 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', related_name='Coverage_ReferencesGroup', null=True, blank=True) #Complex one2Many |
|
1121 |
studyAreaDescription_id = models.ForeignKey('studyAreaDescription', related_name='Coverage_studyAreaDescription_id', null=True, blank=True) #Complex one2Many |
|
1122 |
attr_id = models.CharField(max_length=255, null=True, blank=True, db_index=True) |
|
1123 |
attr_system = models.CharField(max_length=255, null=True, blank=True) |
|
1124 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document') |
|
1125 |
|
|
1126 |
def exportVegX(self,myNode,doc): |
|
1127 |
if self.attr_id != None: |
|
1128 |
newAttr = doc.createAttribute('id') |
|
1129 |
newAttr.value = str(self.attr_id) |
|
1130 |
myNode.setAttributeNode(newAttr) |
|
1131 |
|
|
1132 |
if self.attr_system != None: |
|
1133 |
newAttr = doc.createAttribute('system') |
|
1134 |
newAttr.value = str(self.attr_system) |
|
1135 |
myNode.setAttributeNode(newAttr) |
|
1136 |
|
|
1137 |
if self.attr_scope != None: |
|
1138 |
newAttr = doc.createAttribute('scope') |
|
1139 |
newAttr.value = str(self.attr_scope) |
|
1140 |
myNode.setAttributeNode(newAttr) |
|
1141 |
|
|
1142 |
if self.ReferencesGroup != None: |
|
1143 |
newEl = doc.createElement('ReferencesGroup') |
|
1144 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc)) |
|
1145 |
|
|
1146 |
for childRef in self.GeographicCoverage_Coverage_id.all(): |
|
1147 |
newEl = doc.createElement('geographicCoverage') |
|
1148 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
1149 |
|
|
1150 |
for childRef in self.temporalCoverageLC_Coverage_id.all(): |
|
1151 |
newEl = doc.createElement('temporalCoverage') |
|
1152 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
1153 |
|
|
1154 |
for childRef in self.taxonomicCoverageLC_Coverage_id.all(): |
|
1155 |
newEl = doc.createElement('taxonomicCoverage') |
|
1156 |
myNode.appendChild(childRef.exportVegX(newEl,doc)) |
|
1157 |
|
|
1158 |
return myNode |
|
1159 |
|
|
1160 |
def importVegX(self,node,info): |
|
1161 |
self.entryInfo = info |
|
1162 |
self.save() |
|
1163 |
#attributes |
|
1164 |
for attr in node.attributes.keys(): |
|
1165 |
aName = 'attr_' + attr |
|
1166 |
aVal = node.attributes[attr].nodeValue |
|
1167 |
if aName == 'attr_id': |
|
1168 |
self.attr_id = aVal |
|
1169 |
elif aName == 'attr_system': |
|
1170 |
self.attr_system = aVal |
|
1171 |
elif aName == 'attr_scope': |
|
1172 |
self.attr_scope = aVal |
|
1173 |
#members & relationships |
|
1174 |
for child in node.childNodes: |
|
1175 |
cName = child.nodeName |
|
1176 |
if cName == 'ReferencesGroup': |
|
1177 |
newEl = ReferencesGroup().retrieveOrNew(child) |
|
1178 |
newEl.importVegX(child,info) |
|
1179 |
self.ReferencesGroup = newEl |
|
1180 |
#These are the elements that refer to this one |
|
1181 |
elif cName == 'geographicCoverage': |
|
1182 |
newEl = GeographicCoverage().retrieveOrNew(child) |
|
1183 |
newEl.Coverage_id = self |
|
1184 |
newEl.importVegX(child,info) |
|
1185 |
elif cName == 'temporalCoverage': |
|
1186 |
newEl = temporalCoverageLC().retrieveOrNew(child) |
|
1187 |
newEl.Coverage_id = self |
|
1188 |
newEl.importVegX(child,info) |
|
1189 |
elif cName == 'taxonomicCoverage': |
|
1190 |
newEl = taxonomicCoverageLC().retrieveOrNew(child) |
|
1191 |
newEl.Coverage_id = self |
|
1192 |
newEl.importVegX(child,info) |
|
1193 |
|
|
1194 |
self.save() |
|
1195 |
|
|
1196 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
1197 |
newAttr = doc.createAttribute('id') |
|
1198 |
newAttr.value = str(getRandomString()) |
|
1199 |
myNode.setAttributeNode(newAttr) |
|
1200 |
|
|
1201 |
newAttr = doc.createAttribute('system') |
|
1202 |
newAttr.value = str(getRandomString()) |
|
1203 |
myNode.setAttributeNode(newAttr) |
|
1204 |
|
|
1205 |
newAttr = doc.createAttribute('scope') |
|
1206 |
newAttr.value = str(getRandomString()) |
|
1207 |
myNode.setAttributeNode(newAttr) |
|
1208 |
|
|
1209 |
if 'ReferencesGroup' not in usedObjectsStack: |
|
1210 |
usedObjectsStack.append('ReferencesGroup') |
|
1211 |
newEl = doc.createElement('ReferencesGroup') |
|
1212 |
newElObj = ReferencesGroup() |
|
1213 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
1214 |
usedObjectsStack.pop() |
|
1215 |
|
|
1216 |
if 'GeographicCoverage' not in usedObjectsStack: |
|
1217 |
usedObjectsStack.append('GeographicCoverage') |
|
1218 |
|
|
1219 |
newEl = doc.createElement('geographicCoverage') |
|
1220 |
childRef = GeographicCoverage() |
|
1221 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
1222 |
usedObjectsStack.pop() |
|
1223 |
|
|
1224 |
if 'temporalCoverageLC' not in usedObjectsStack: |
|
1225 |
usedObjectsStack.append('temporalCoverageLC') |
|
1226 |
|
|
1227 |
newEl = doc.createElement('temporalCoverage') |
|
1228 |
childRef = temporalCoverageLC() |
|
1229 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
1230 |
usedObjectsStack.pop() |
|
1231 |
|
|
1232 |
if 'taxonomicCoverageLC' not in usedObjectsStack: |
|
1233 |
usedObjectsStack.append('taxonomicCoverageLC') |
|
1234 |
|
|
1235 |
newEl = doc.createElement('taxonomicCoverage') |
|
1236 |
childRef = taxonomicCoverageLC() |
|
1237 |
myNode.appendChild(childRef.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
1238 |
usedObjectsStack.pop() |
|
1239 |
|
|
1240 |
return myNode |
|
1241 |
|
|
1242 |
def retrieveOrNew(self,node): |
|
1243 |
a_id = None |
|
1244 |
a_system = None |
|
1245 |
a_scope = None |
|
1246 |
for attr in node.attributes.keys(): |
|
1247 |
aVal = node.attributes[attr].nodeValue |
|
1248 |
if attr == 'id': |
|
1249 |
a_id = aVal |
|
1250 |
elif attr == 'system': |
|
1251 |
a_system = aVal |
|
1252 |
elif attr == 'scope': |
|
1253 |
a_scope = aVal |
|
1254 |
if a_id != None: |
|
1255 |
q = Coverage.objects.filter(attr_id__exact = a_id) |
|
1256 |
if a_system != None: |
|
1257 |
q = q.filter(attr_system__exact = a_system) |
|
1258 |
if a_scope != None: |
|
1259 |
q = q.filter(attr_scope__exact = a_scope) |
|
1260 |
if len(q) > 0: |
|
1261 |
return q[0] |
|
1262 |
else: |
|
1263 |
return Coverage() |
|
1264 |
else: |
|
1265 |
return Coverage() |
|
1266 |
|
|
1267 |
|
|
1268 |
class SingleDateTimeType(models.Model): |
|
1269 |
entryInfo = models.ForeignKey('EntryInfo') |
|
1270 |
TemporalCoverage_id = models.ForeignKey('TemporalCoverage', related_name='SingleDateTimeType_TemporalCoverage_id', null=True, blank=True) #Complex one2Many |
|
1271 |
alternativeTimeScale = models.ForeignKey('alternativeTimeScale', related_name='SingleDateTimeType_alternativeTimeScale', null=True, blank=True) #Complex one2Many |
|
1272 |
calendarDate = models.DateField(null=True, blank=True) |
|
1273 |
time = models.TimeField(null=True, blank=True) |
|
1274 |
|
|
1275 |
def exportVegX(self,myNode,doc): |
|
1276 |
if self.calendarDate != None: |
|
1277 |
newEl = doc.createElement('calendarDate') |
|
1278 |
newElText = doc.createTextNode(str(self.calendarDate)) |
|
1279 |
newEl.appendChild(newElText) |
|
1280 |
myNode.appendChild(newEl) |
|
1281 |
|
|
1282 |
if self.time != None: |
|
1283 |
newEl = doc.createElement('time') |
|
1284 |
newElText = doc.createTextNode(str(self.time)) |
|
1285 |
newEl.appendChild(newElText) |
|
1286 |
myNode.appendChild(newEl) |
|
1287 |
|
|
1288 |
if self.alternativeTimeScale != None: |
|
1289 |
newEl = doc.createElement('alternativeTimeScale') |
|
1290 |
myNode.appendChild(self.alternativeTimeScale.exportVegX(newEl,doc)) |
|
1291 |
|
|
1292 |
return myNode |
|
1293 |
|
|
1294 |
def importVegX(self,node,info): |
|
1295 |
self.entryInfo = info |
|
1296 |
self.save() |
|
1297 |
#members & relationships |
|
1298 |
for child in node.childNodes: |
|
1299 |
cName = child.nodeName |
|
1300 |
if cName == 'calendarDate': |
|
1301 |
if(len(child.childNodes) > 0): |
|
1302 |
cVal = child.childNodes[0].nodeValue |
|
1303 |
self.calendarDate = cVal |
|
1304 |
elif cName == 'time': |
|
1305 |
if(len(child.childNodes) > 0): |
|
1306 |
cVal = child.childNodes[0].nodeValue |
|
1307 |
self.time = cVal |
|
1308 |
elif cName == 'alternativeTimeScale': |
|
1309 |
newEl = alternativeTimeScale().retrieveOrNew(child) |
|
1310 |
newEl.importVegX(child,info) |
|
1311 |
self.alternativeTimeScale = newEl |
|
1312 |
|
|
1313 |
self.save() |
|
1314 |
|
|
1315 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
1316 |
newEl = doc.createElement('calendarDate') |
|
1317 |
newElText = doc.createTextNode(str(getRandomDate())) |
|
1318 |
newEl.appendChild(newElText) |
|
1319 |
myNode.appendChild(newEl) |
|
1320 |
|
|
1321 |
newEl = doc.createElement('time') |
|
1322 |
newElText = doc.createTextNode(str(getRandomTime())) |
|
1323 |
newEl.appendChild(newElText) |
|
1324 |
myNode.appendChild(newEl) |
|
1325 |
|
|
1326 |
if 'alternativeTimeScale' not in usedObjectsStack: |
|
1327 |
usedObjectsStack.append('alternativeTimeScale') |
|
1328 |
newEl = doc.createElement('alternativeTimeScale') |
|
1329 |
newElObj = alternativeTimeScale() |
|
1330 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
1331 |
usedObjectsStack.pop() |
|
1332 |
|
|
1333 |
return myNode |
|
1334 |
|
|
1335 |
def retrieveOrNew(self,node): |
|
1336 |
return SingleDateTimeType() |
|
1337 |
|
|
1338 |
|
|
1339 |
class rangeOfDates(models.Model): |
|
1340 |
entryInfo = models.ForeignKey('EntryInfo') |
|
1341 |
beginDate = models.ForeignKey('SingleDateTimeType', related_name='rangeOfDates_beginDate', null=True, blank=True) #Complex one2Many |
|
1342 |
endDate = models.ForeignKey('SingleDateTimeType', related_name='rangeOfDates_endDate', null=True, blank=True) #Complex one2Many |
|
1343 |
|
|
1344 |
def exportVegX(self,myNode,doc): |
|
1345 |
if self.beginDate != None: |
|
1346 |
newEl = doc.createElement('beginDate') |
|
1347 |
myNode.appendChild(self.beginDate.exportVegX(newEl,doc)) |
|
1348 |
|
|
1349 |
if self.endDate != None: |
|
1350 |
newEl = doc.createElement('endDate') |
|
1351 |
myNode.appendChild(self.endDate.exportVegX(newEl,doc)) |
|
1352 |
|
|
1353 |
return myNode |
|
1354 |
|
|
1355 |
def importVegX(self,node,info): |
|
1356 |
self.entryInfo = info |
|
1357 |
self.save() |
|
1358 |
#members & relationships |
|
1359 |
for child in node.childNodes: |
|
1360 |
cName = child.nodeName |
|
1361 |
if cName == 'beginDate': |
|
1362 |
newEl = SingleDateTimeType().retrieveOrNew(child) |
|
1363 |
newEl.importVegX(child,info) |
|
1364 |
self.beginDate = newEl |
|
1365 |
elif cName == 'endDate': |
|
1366 |
newEl = SingleDateTimeType().retrieveOrNew(child) |
|
1367 |
newEl.importVegX(child,info) |
|
1368 |
self.endDate = newEl |
|
1369 |
|
|
1370 |
self.save() |
|
1371 |
|
|
1372 |
def exportDummyVegX(self,myNode,doc,usedObjectsStack): |
|
1373 |
if 'SingleDateTimeType' not in usedObjectsStack: |
|
1374 |
usedObjectsStack.append('SingleDateTimeType') |
|
1375 |
newEl = doc.createElement('beginDate') |
|
1376 |
newElObj = SingleDateTimeType() |
|
1377 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
1378 |
usedObjectsStack.pop() |
|
1379 |
|
|
1380 |
if 'SingleDateTimeType' not in usedObjectsStack: |
|
1381 |
usedObjectsStack.append('SingleDateTimeType') |
|
1382 |
newEl = doc.createElement('endDate') |
|
1383 |
newElObj = SingleDateTimeType() |
|
1384 |
myNode.appendChild(newElObj.exportDummyVegX(newEl,doc,usedObjectsStack)) |
|
1385 |
usedObjectsStack.pop() |
|
1386 |
|
|
1387 |
return myNode |
|
1388 |
|
|
1389 |
def retrieveOrNew(self,node): |
|
1390 |
return rangeOfDates() |
|
1391 |
|
|
1392 |
|
|
1393 |
class CitationType(models.Model): |
|
1394 |
entryInfo = models.ForeignKey('EntryInfo') |
|
1395 |
alternativeTimeScale_id = models.ForeignKey('alternativeTimeScale', related_name='CitationType_alternativeTimeScale_id', null=True, blank=True) #Complex one2Many |
|
1396 |
taxonomicSystem_id = models.ForeignKey('taxonomicSystem', related_name='CitationType_taxonomicSystem_id', null=True, blank=True) #Complex one2Many |
|
1397 |
ReferencesGroup = models.ForeignKey('ReferencesGroup', related_name='CitationType_ReferencesGroup', null=True, blank=True) #Complex one2Many |
|
1398 |
ResourceGroup = models.ForeignKey('ResourceGroup', related_name='CitationType_ResourceGroup', null=True, blank=True) #Complex one2Many |
|
1399 |
access = models.ForeignKey('AccessType', related_name='CitationType_access', null=True, blank=True) #Complex one2Many |
|
1400 |
article = models.ForeignKey('Article', related_name='CitationType_article', null=True, blank=True) #Complex one2Many |
|
1401 |
book = models.ForeignKey('Book', related_name='CitationType_book', null=True, blank=True) #Complex one2Many |
|
1402 |
chapter = models.ForeignKey('Chapter', related_name='CitationType_chapter', null=True, blank=True) #Complex one2Many |
|
1403 |
editedBook = models.ForeignKey('Book', related_name='CitationType_editedBook', null=True, blank=True) #Complex one2Many |
|
1404 |
manuscript = models.ForeignKey('Manuscript', related_name='CitationType_manuscript', null=True, blank=True) #Complex one2Many |
|
1405 |
report = models.ForeignKey('Report', related_name='CitationType_report', null=True, blank=True) #Complex one2Many |
|
1406 |
thesis = models.ForeignKey('Thesis', related_name='CitationType_thesis', null=True, blank=True) #Complex one2Many |
|
1407 |
conferenceProceedings = models.ForeignKey('ConferenceProceedings', related_name='CitationType_conferenceProceedings', null=True, blank=True) #Complex one2Many |
|
1408 |
personalCommunication = models.ForeignKey('PersonalCommunication', related_name='CitationType_personalCommunication', null=True, blank=True) #Complex one2Many |
|
1409 |
map = models.ForeignKey('Map', related_name='CitationType_map', null=True, blank=True) #Complex one2Many |
|
1410 |
generic = models.ForeignKey('Generic', related_name='CitationType_generic', null=True, blank=True) #Complex one2Many |
|
1411 |
audioVisual = models.ForeignKey('AudioVisual', related_name='CitationType_audioVisual', null=True, blank=True) #Complex one2Many |
|
1412 |
presentation = models.ForeignKey('Presentation', related_name='CitationType_presentation', null=True, blank=True) #Complex one2Many |
|
1413 |
descriptor_id = models.ForeignKey('descriptor', related_name='CitationType_descriptor_id', null=True, blank=True) #Complex one2Many |
|
1414 |
studyAreaDescription_id = models.ForeignKey('studyAreaDescription', related_name='CitationType_studyAreaDescription_id', null=True, blank=True) #Complex one2Many |
|
1415 |
designDescription_id = models.ForeignKey('designDescription', related_name='CitationType_designDescription_id', null=True, blank=True) #Complex one2Many |
|
1416 |
literature_id = models.ForeignKey('literature', related_name='CitationType_literature_id', null=True, blank=True) #Complex one2Many |
|
1417 |
attr_id = models.CharField(max_length=255, null=True, blank=True, db_index=True) |
|
1418 |
attr_system = models.CharField(max_length=255, null=True, blank=True) |
|
1419 |
attr_scope = models.CharField(max_length=255, null=True, blank=True, default = 'document') |
|
1420 |
|
|
1421 |
def exportVegX(self,myNode,doc): |
|
1422 |
if self.attr_id != None: |
|
1423 |
newAttr = doc.createAttribute('id') |
|
1424 |
newAttr.value = str(self.attr_id) |
|
1425 |
myNode.setAttributeNode(newAttr) |
|
1426 |
|
|
1427 |
if self.attr_system != None: |
|
1428 |
newAttr = doc.createAttribute('system') |
|
1429 |
newAttr.value = str(self.attr_system) |
|
1430 |
myNode.setAttributeNode(newAttr) |
|
1431 |
|
|
1432 |
if self.attr_scope != None: |
|
1433 |
newAttr = doc.createAttribute('scope') |
|
1434 |
newAttr.value = str(self.attr_scope) |
|
1435 |
myNode.setAttributeNode(newAttr) |
|
1436 |
|
|
1437 |
if self.ReferencesGroup != None: |
|
1438 |
newEl = doc.createElement('ReferencesGroup') |
|
1439 |
myNode.appendChild(self.ReferencesGroup.exportVegX(newEl,doc)) |
|
1440 |
|
|
1441 |
if self.ResourceGroup != None: |
|
1442 |
newEl = doc.createElement('ResourceGroup') |
|
1443 |
myNode.appendChild(self.ResourceGroup.exportVegX(newEl,doc)) |
|
1444 |
|
|
1445 |
if self.access != None: |
|
1446 |
newEl = doc.createElement('access') |
|
1447 |
myNode.appendChild(self.access.exportVegX(newEl,doc)) |
|
1448 |
|
|
1449 |
if self.article != None: |
|
1450 |
newEl = doc.createElement('article') |
|
1451 |
myNode.appendChild(self.article.exportVegX(newEl,doc)) |
|
1452 |
|
|
1453 |
if self.book != None: |
|
1454 |
newEl = doc.createElement('book') |
|
1455 |
myNode.appendChild(self.book.exportVegX(newEl,doc)) |
|
1456 |
|
|
1457 |
if self.chapter != None: |
|
1458 |
newEl = doc.createElement('chapter') |
|
1459 |
myNode.appendChild(self.chapter.exportVegX(newEl,doc)) |
|
1460 |
|
|
1461 |
if self.editedBook != None: |
|
1462 |
newEl = doc.createElement('editedBook') |
|
1463 |
myNode.appendChild(self.editedBook.exportVegX(newEl,doc)) |
|
1464 |
|
|
1465 |
if self.manuscript != None: |
|
1466 |
newEl = doc.createElement('manuscript') |
|
1467 |
myNode.appendChild(self.manuscript.exportVegX(newEl,doc)) |
|
1468 |
|
|
1469 |
if self.report != None: |
|
1470 |
newEl = doc.createElement('report') |
|
1471 |
myNode.appendChild(self.report.exportVegX(newEl,doc)) |
|
1472 |
|
|
1473 |
if self.thesis != None: |
|
1474 |
newEl = doc.createElement('thesis') |
|
1475 |
myNode.appendChild(self.thesis.exportVegX(newEl,doc)) |
|
1476 |
|
|
1477 |
if self.conferenceProceedings != None: |
|
1478 |
newEl = doc.createElement('conferenceProceedings') |
|
1479 |
myNode.appendChild(self.conferenceProceedings.exportVegX(newEl,doc)) |
|
1480 |
|
|
1481 |
if self.personalCommunication != None: |
|
1482 |
newEl = doc.createElement('personalCommunication') |
|
1483 |
myNode.appendChild(self.personalCommunication.exportVegX(newEl,doc)) |
|
1484 |
|
|
1485 |
if self.map != None: |
|
1486 |
newEl = doc.createElement('map') |
|
1487 |
myNode.appendChild(self.map.exportVegX(newEl,doc)) |
|
1488 |
|
|
1489 |
if self.generic != None: |
|
1490 |
newEl = doc.createElement('generic') |
|
1491 |
myNode.appendChild(self.generic.exportVegX(newEl,doc)) |
|
1492 |
|
|
1493 |
if self.audioVisual != None: |
|
1494 |
newEl = doc.createElement('audioVisual') |
|
1495 |
myNode.appendChild(self.audioVisual.exportVegX(newEl,doc)) |
|
1496 |
|
Also available in: Unified diff
Added schemas/VegX/run.py