Mercurial > hg > drupalISMI
comparison importFromOpenMind/importer/ismixml2model.py @ 59:adfb57978a69
use sys.exit(1) when something breaks.
author | casties |
---|---|
date | Wed, 16 Aug 2017 23:17:55 +0200 |
parents | 4f833d8fc383 |
children |
comparison
equal
deleted
inserted
replaced
58:4f833d8fc383 | 59:adfb57978a69 |
---|---|
10 | 10 |
11 input_fn = "openmind-data.xml" | 11 input_fn = "openmind-data.xml" |
12 | 12 |
13 | 13 |
14 # node types to exclude from the graph | 14 # node types to exclude from the graph |
15 exclude_objects_of_type = ['DIGITALIZATION', 'REFERENCE'] | 15 #exclude_objects_of_type = ['DIGITALIZATION', 'REFERENCE'] |
16 exclude_objects_of_type = [] | |
16 | 17 |
17 # attributes to exclude | 18 # attributes to exclude |
18 exclude_attributes_of_type = [ | 19 exclude_attributes_of_type = [ |
19 'lw', | 20 'lw', |
20 'node_type', | 21 'node_type', |
301 | 302 |
302 ismi_id = int(ent_elem.get('id')) | 303 ismi_id = int(ent_elem.get('id')) |
303 log('DEBUG', "reading entity[%s]"%ismi_id) | 304 log('DEBUG', "reading entity[%s]"%ismi_id) |
304 | 305 |
305 if ismi_id in nx_nodes: | 306 if ismi_id in nx_nodes: |
306 log("ERROR", "entity with id=%s exists!"%ismi_id) | 307 log("ERROR", "entity with id=%s exists! Aborting."%ismi_id) |
307 return | 308 sys.exit(1) |
308 | 309 |
309 # create networkx node | 310 # create networkx node |
310 node = nodeFromEnt(ent_elem) | 311 node = nodeFromEnt(ent_elem) |
311 | 312 |
312 # save node reference | 313 # save node reference |
330 | 331 |
331 ismi_id = int(rel_elem.get('id')) | 332 ismi_id = int(rel_elem.get('id')) |
332 log('DEBUG', "reading relation[%s]"%ismi_id) | 333 log('DEBUG', "reading relation[%s]"%ismi_id) |
333 | 334 |
334 if ismi_id in nx_relations: | 335 if ismi_id in nx_relations: |
335 print("ERROR: relation with id=%s exists!"%ismi_id) | 336 print("ERROR: relation with id=%s exists! Aborting."%ismi_id) |
336 return | 337 sys.exit(1) |
337 | 338 |
338 # create networkx relation | 339 # create networkx relation |
339 relation = relationFromRel(rel_elem) | 340 relation = relationFromRel(rel_elem) |
340 | 341 |
341 # save relation reference | 342 # save relation reference |