docs: def merge_with_master_config(self, config, defaults={}, delete_orphan_fields=False) -> dict:
          """
          Merge current ontology with input master config.
  
          :param config: master config, should be str or dict
          :param defaults: a dict that sets default color and icon
          :param delete_orphan_fields: if a property doesn't exist in the ontology then delete it
          :return: merged master config in dict
          """
          if isinstance(config, str):
              import json
              config = json.loads(config)
          properties = self.all_properties()
          config['fields'] = config.get('fields', dict())
          fields = config['fields']
  
          d_color = defaults.get('color', 'white')
          d_icon = defaults.get('icon', 'icons:default')
  
          if delete_orphan_fields:
              exist = {p.name() for p in properties}
              unexist = set(fields.keys()) - exist
              for name in unexist:
                  del fields[name]
  
          for p in properties:
              field = fields.get(p.name(), {'show_in_search': False,
                                            'combine_fields': False,
                                            'number_of_rules': 0,
                                            'glossaries': [],
                                            'use_in_network_search': False,
                                            'case_sensitive': False,
                                            'show_as_link': 'text',
                                            'blacklists': [],
                                            'show_in_result': 'no',
                                            'rule_extractor_enabled': False,
                                            'search_importance': 1,
                                            'group_name': '',
                                            'show_in_facets': False,
                                            'predefined_extractor': 'none',
                                            'rule_extraction_target': ''})
              config['fields'][p.name()] = field
              field['screen_label'] = ' '.join(p.label())
              field['description'] = '\n'.join(p.definition())
              field['name'] = p.name()
  
              # color
              if 'color' not in field:
                  color = self.__merge_close_ancestor_color(p, fields, attr='color')
                  field['color'] = color if color else d_color
              # icon
              if 'icon' not in field:
                  icon = self.__merge_close_ancestor_color(p, fields, attr='icon')
                  field['icon'] = icon if icon else d_icon
              # type
              if isinstance(p, OntologyObjectProperty):
                  field['type'] = 'kg_id'
              else:
                  try:
                      field['type'] = self.__merge_xsd_to_type(next(iter(p.included_ranges())))
                  except StopIteration:
                      field['type'] = None
          return config