docs: def skosify(*sources, **config):
      """Convert, extend, and check SKOS vocabulary."""
  
      cfg = Config()
      for key in config:
          if hasattr(cfg, key):
              setattr(cfg, key, config[key])
      config = cfg
  
      namespaces = config.namespaces
      typemap = config.types
      literalmap = config.literals
      relationmap = config.relations
  
      logging.debug("Skosify starting. $Revision$")
      starttime = time.time()
  
      logging.debug("Phase 1: Parsing input files")
      try:
          voc = read_rdf(sources, config.from_format)
      except:
          logging.critical("Parsing failed. Exception: %s",
                           str(sys.exc_info()[1]))
          sys.exit(1)
  
      inputtime = time.time()
  
      logging.debug("Phase 2: Performing inferences")
      if config.update_query is not None:
          transform_sparql_update(voc, config.update_query)
      if config.construct_query is not None:
          voc = transform_sparql_construct(voc, config.construct_query)
      if config.infer:
          logging.debug("doing RDFS subclass and properties inference")
          infer.rdfs_classes(voc)
          infer.rdfs_properties(voc)
  
      logging.debug("Phase 3: Setting up namespaces")
      for prefix, uri in namespaces.items():
          voc.namespace_manager.bind(prefix, uri)
  
      logging.debug("Phase 4: Transforming concepts, literals and relations")
      # transform concepts, literals and concept relations
      transform_concepts(voc, typemap)
      transform_literals(voc, literalmap)
      transform_relations(voc, relationmap)
  
      # special transforms for labels: whitespace, prefLabel vs altLabel
      transform_labels(voc, config.default_language)
  
      # special transforms for collections + aggregate and deprecated concepts
      transform_collections(voc)
  
      # find/create concept scheme
      cs = get_concept_scheme(voc)
      if not cs:
          cs = create_concept_scheme(voc, config.namespace)
      initialize_concept_scheme(voc, cs, label=config.label,
                                language=config.default_language,
                                set_modified=config.set_modified)
  
      transform_aggregate_concepts(
          voc, cs, relationmap, config.aggregates)
      transform_deprecated_concepts(voc, cs)
  
      logging.debug("Phase 5: Performing SKOS enrichments")
      # enrichments: broader <-> narrower, related <-> related
      enrich_relations(voc, config.enrich_mappings,
                       config.narrower, config.transitive)
  
      logging.debug("Phase 6: Cleaning up")
      # clean up unused/unnecessary class/property definitions and unreachable
      # triples
      if config.cleanup_properties:
          cleanup_properties(voc)
      if config.cleanup_classes:
          cleanup_classes(voc)
      if config.cleanup_unreachable:
          cleanup_unreachable(voc)
  
      logging.debug("Phase 7: Setting up concept schemes and top concepts")
      # setup inScheme and hasTopConcept
      setup_concept_scheme(voc, cs)
      setup_top_concepts(voc, config.mark_top_concepts)
  
      logging.debug("Phase 8: Checking concept hierarchy")
      # check hierarchy for cycles
      check_hierarchy(voc, config.break_cycles,
                      config.keep_related, config.mark_top_concepts,
                      config.eliminate_redundancy)
  
      logging.debug("Phase 9: Checking labels")
      # check for duplicate labels
      check_labels(voc, config.preflabel_policy)
  
      processtime = time.time()
  
      logging.debug("reading input file took  %d seconds",
                    (inputtime - starttime))
      logging.debug("processing took          %d seconds",
                    (processtime - inputtime))
  
      logging.debug("Phase 10: Writing output")
  
      return voc