Project

General

Profile

« Previous | Next » 

Revision 10191

bin/map: removed no longer used support for map.csv input column prefixes (expand out the prefixes instead). this used to be used by SpeciesLink to use just one mapping for a single term with multiple DwC namespaces, but was replaced with an explicit, ordered rather than implicit, unordered /_alt-ing together of the terms.

View differences:

bin/map
315 315
            col_names_ct = len(col_names)
316 316
            col_idxs = util.list_flip(col_names)
317 317
            col_names_map = dict(zip(col_names, col_names))
318
            prefixes_simp = map(maps.simplify, prefixes)
319 318
            
320
            # Resolve prefixes
319
            # Resolve names
321 320
            mappings_orig = mappings[:] # save a copy
322 321
            mappings[:] = [] # empty existing elements
323 322
            for in_, out in mappings_orig:
324 323
                if is_metadata(in_): mappings.append([in_, out])
325 324
                else:
326
                    try:
327
                        cols = get_with_prefix(col_names_map, prefixes_simp,
328
                            in_)
325
                    try: cols = get_with_prefix(col_names_map, [], in_)
329 326
                    except KeyError: pass
330 327
                    else:
331 328
                        mappings[len(mappings):] = [[db_xml.ColRef(
......
433 430
                    return rows
434 431
                
435 432
                def get_value(in_, row):
436
                    in_ = './{'+(','.join(strings.with_prefixes(
437
                        ['']+prefixes, in_)))+'}' # also with no prefix
438 433
                    nodes = xpath.get(row, in_, allow_rooted=False)
439 434
                    if nodes != []: return xml_dom.value(nodes[0])
440 435
                    else: return None

Also available in: Unified diff