Mercurial > hg > drupalISMI
diff importFromOpenMind/importer/ismixml2model.py @ 48:6625019a0c96
old model2neo4j renamed to model2neo4j_restclient. new model2neo4j_client and model2neo4j_import. fixed ismixml2model and compare_models.
author | casties |
---|---|
date | Tue, 07 Feb 2017 21:06:13 +0100 |
parents | 378dcb66a27f |
children | 5a633e875490 |
line wrap: on
line diff
--- a/importFromOpenMind/importer/ismixml2model.py Mon Feb 06 18:44:43 2017 +0100 +++ b/importFromOpenMind/importer/ismixml2model.py Tue Feb 07 21:06:13 2017 +0100 @@ -98,19 +98,19 @@ 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: - if att_elem.tail is not None: - # tail belongs to parent - ov += att_elem.tail - ct = att_elem.get('content-type', None) name = att_elem.get('name', None) if name in exclude_attributes_of_type: # exclude attribute continue - if ct is None or ct.lower() in ['text', 'arabic', 'bool', 'boolean', 'url', 'language']: + if ct is None or ct.lower() in ['text', 'arabic', 'bool', 'boolean', 'url', 'language', 'null']: # normal text attribute (assume no content_type is text too...) val = att_elem.text @@ -120,11 +120,12 @@ if year is not None: val = year - # keep attribute - attrs[name] = val - #if 'nov' in att: - # # add normalized value - # attrs['_n_'+name] = att['nov'] + if val is not None: + # keep attribute + attrs[name] = val + #if 'nov' in att: + # # add normalized value + # attrs['_n_'+name] = att['nov'] elif ct == 'date': # date attribute @@ -199,19 +200,19 @@ atts_elem = rel_elem.find('attributes') if atts_elem is not None: + 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: - if att_elem.tail is not None: - # tail belongs to parent - ov += att_elem.tail - ct = att_elem.get('content-type', None) name = att_elem.get('name', None) if name in exclude_attributes_of_type: # exclude attribute continue - if ct is None or ct.lower() in ['text', 'arabic', 'bool', 'boolean', 'url', 'language']: + if ct is None or ct.lower() in ['text', 'arabic', 'bool', 'boolean', 'url', 'language', 'null']: # normal text attribute (assume no content_type is text too...) val = att_elem.text @@ -221,11 +222,12 @@ if year is not None: val = year - # keep attribute - attrs[name] = val - #if 'nov' in att: - # # add normalized value - # attrs['_n_'+name] = att['nov'] + if val is not None: + # keep attribute + attrs[name] = val + #if 'nov' in att: + # # add normalized value + # attrs['_n_'+name] = att['nov'] elif ct == 'date': # date attribute