# HG changeset patch # User casties # Date 1488568266 -3600 # Node ID 5a633e8754901ceb616db18ab89dd92957755f1b # Parent 1be17309db7985a5aa6519d2d59e92c8792acafe also read normalized fields from xml. diff -r 1be17309db79 -r 5a633e875490 importFromOpenMind/importer/ismixml2model.py --- a/importFromOpenMind/importer/ismixml2model.py Thu Feb 23 19:57:36 2017 +0100 +++ b/importFromOpenMind/importer/ismixml2model.py Fri Mar 03 20:11:06 2017 +0100 @@ -98,10 +98,6 @@ log('DEBUG', "entity has no attributes: %s"%ent_elem) else: - if atts_elem.tail is not None: - # tail belongs to parent - ov += atts_elem.tail - # go through all attributes for att_elem in atts_elem: ct = att_elem.get('content-type', None) @@ -123,9 +119,11 @@ if val is not None: # keep attribute attrs[name] = val - #if 'nov' in att: - # # add normalized value - # attrs['_n_'+name] = att['nov'] + # check for normalized value + nov = att_elem.findtext('norm') + if nov is not None: + # add normalized value + attrs['_n_'+name] = nov elif ct == 'date': # date attribute @@ -165,9 +163,11 @@ if len(ov) > 0: # save ov as label attrs['label'] = ov - #if 'nov' in ent: - # # add normalized value - # attrs['_n_label'] = ent.get('nov') + # check for normalized value + nov = ent_elem.findtext('norm') + if nov is not None: + # add normalized value + attrs['_n_label'] = nov # create node log('DEBUG', "new node(%s, %s)"%(ismi_id, attrs)) @@ -225,9 +225,11 @@ if val is not None: # keep attribute attrs[name] = val - #if 'nov' in att: - # # add normalized value - # attrs['_n_'+name] = att['nov'] + # check for normalized value + nov = att_elem.findtext('norm') + if nov is not None: + # add normalized value + attrs['_n_'+name] = nov elif ct == 'date': # date attribute