      n.simple_name                                                                             AS simple_name,
      coalesce(n.name_element, '?')                                                             AS name_element,
      ipath.instance_path                                                                       AS tree_path,
-     regexp_replace(ipath.instance_path, 'x', '', 'g')                                         AS instance_path,
+     regexp_replace(ipath.instance_path, '[xb]', '', 'g')                                      AS instance_path,
      ipath.name_path                                                                           AS name_path,
      ipath.depth                                                                               AS depth,
      'APNI'                                                                                    AS source_shard,

    n.simple_name :: TEXT                                            AS simple_name,
    coalesce(n.name_element,
             '?')                                                    AS name_path,
    CASE WHEN (node.type_uri_id_part <> 'ApcConcept')
      THEN
        'x' || node.instance_id :: TEXT
    ELSE
      node.instance_id :: TEXT
    END                                                              AS instance_path,
    ''                                                               AS parent_instance_path,
    FALSE                                                            AS parent_excluded,


CREATE INDEX tree_element_instance_index
  ON tree_element (instance_id);

CREATE INDEX instance_path_index
  ON tree_element (instance_path);

