Mercurial > hg > drupalISMI
comparison importFromOpenMind/importer/ismi2model.py @ 27:3fce3fa9097e
ignore notes_old.
author | casties |
---|---|
date | Tue, 06 Oct 2015 13:03:23 +0200 |
parents | 5bdcb5805d29 |
children | a9bfd49355f8 |
comparison
equal
deleted
inserted
replaced
26:248bf8d1e2e7 | 27:3fce3fa9097e |
---|---|
11 # OpenMind base URL | 11 # OpenMind base URL |
12 baseURL="http://localhost:18080/ismi-richfaces/jsonInterface?" | 12 baseURL="http://localhost:18080/ismi-richfaces/jsonInterface?" |
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 | |
17 # attributes to exclude | |
18 exclude_attributes_of_type = [ | |
19 'lw', | |
20 'node_type', | |
21 'nov', | |
22 'notes_old' | |
23 ] | |
16 | 24 |
17 | 25 |
18 entsURL=baseURL+"method=get_ents&oc=%s" | 26 entsURL=baseURL+"method=get_ents&oc=%s" |
19 | 27 |
20 entsByIdURL = baseURL+"method=get_ents&include_content=True&ids=%s" | 28 entsByIdURL = baseURL+"method=get_ents&include_content=True&ids=%s" |
40 | 48 |
41 nx_nodes = {} | 49 nx_nodes = {} |
42 ismi_relations = {} | 50 ismi_relations = {} |
43 nx_relations = {} | 51 nx_relations = {} |
44 | 52 |
45 ent_exclude_attrs = [ | |
46 'lw', | |
47 'node_type', | |
48 'nov' | |
49 ] | |
50 | 53 |
51 def fixName(name, is_src_rel=False, is_tar_rel=False, att_from_rel=False): | 54 def fixName(name, is_src_rel=False, is_tar_rel=False, att_from_rel=False): |
52 # these are too embarrassing... | 55 # these are too embarrassing... |
53 if 'FLORUIT' in name: | 56 if 'FLORUIT' in name: |
54 name = name.replace('FLORUIT', 'FLOURISH') | 57 name = name.replace('FLORUIT', 'FLOURISH') |
85 if ct is None or ct.lower() in ['text', 'arabic', 'bool', 'boolean', 'url', 'language']: | 88 if ct is None or ct.lower() in ['text', 'arabic', 'bool', 'boolean', 'url', 'language']: |
86 # normal text attribute (assume no content_type is text too...) | 89 # normal text attribute (assume no content_type is text too...) |
87 key = att['name'] | 90 key = att['name'] |
88 val = att['ov'] | 91 val = att['ov'] |
89 | 92 |
90 if key in ent_exclude_attrs: | 93 if key in exclude_attributes_of_type: |
91 # exclude attribute | 94 # exclude attribute |
92 continue | 95 continue |
93 | 96 |
94 # keep attribute | 97 # keep attribute |
95 attrs[key] = val | 98 attrs[key] = val |
97 elif ct == 'num': | 100 elif ct == 'num': |
98 # number attribute | 101 # number attribute |
99 key = att['name'] | 102 key = att['name'] |
100 val = att['ov'] | 103 val = att['ov'] |
101 | 104 |
102 if key in ent_exclude_attrs: | 105 if key in exclude_attributes_of_type: |
103 # exclude attribute | 106 # exclude attribute |
104 continue | 107 continue |
105 | 108 |
106 # keep attribute, assume num is int | 109 # keep attribute, assume num is int |
107 attrs[key] = int(val) | 110 attrs[key] = int(val) |