def skosify(*sources, **config):
cfg = Config()<EOL>for key in config:<EOL><INDENT>if hasattr(cfg, key):<EOL><INDENT>setattr(cfg, key, config[key])<EOL><DEDENT><DEDENT>config = cfg<EOL>namespaces = config.namespaces<EOL>typemap = config.types<EOL>literalmap = config.literals<EOL>relationmap = config.relations<EOL>logging.debug("<STR_LIT>")<EOL>starttime = time.time()<EOL>logging.debug("<STR_LIT>")<EOL>try:<EOL><INDENT>voc = read_rdf(sources, config.from_format)<EOL><DEDENT>except:<EOL><INDENT>logging.critical("<STR_LIT>",<EOL>str(sys.exc_info()[<NUM_LIT:1>]))<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>inputtime = time.time()<EOL>logging.debug("<STR_LIT>")<EOL>if config.update_query is not None:<EOL><INDENT>transform_sparql_update(voc, config.update_query)<EOL><DEDENT>if config.construct_query is not None:<EOL><INDENT>voc = transform_sparql_construct(voc, config.construct_query)<EOL><DEDENT>if config.infer:<EOL><INDENT>logging.debug("<STR_LIT>")<EOL>infer.rdfs_classes(voc)<EOL>infer.rdfs_properties(voc)<EOL><DEDENT>logging.debug("<STR_LIT>")<EOL>for prefix, uri in namespaces.items():<EOL><INDENT>voc.namespace_manager.bind(prefix, uri)<EOL><DEDENT>logging.debug("<STR_LIT>")<EOL>transform_concepts(voc, typemap)<EOL>transform_literals(voc, literalmap)<EOL>transform_relations(voc, relationmap)<EOL>transform_labels(voc, config.default_language)<EOL>transform_collections(voc)<EOL>cs = get_concept_scheme(voc)<EOL>if not cs:<EOL><INDENT>cs = create_concept_scheme(voc, config.namespace)<EOL><DEDENT>initialize_concept_scheme(voc, cs, label=config.label,<EOL>language=config.default_language,<EOL>set_modified=config.set_modified)<EOL>transform_aggregate_concepts(<EOL>voc, cs, relationmap, config.aggregates)<EOL>transform_deprecated_concepts(voc, cs)<EOL>logging.debug("<STR_LIT>")<EOL>enrich_relations(voc, config.enrich_mappings,<EOL>config.narrower, config.transitive)<EOL>logging.debug("<STR_LIT>")<EOL>if config.cleanup_properties:<EOL><INDENT>cleanup_properties(voc)<EOL><DEDENT>if config.cleanup_classes:<EOL><INDENT>cleanup_classes(voc)<EOL><DEDENT>if config.cleanup_unreachable:<EOL><INDENT>cleanup_unreachable(voc)<EOL><DEDENT>logging.debug("<STR_LIT>")<EOL>setup_concept_scheme(voc, cs)<EOL>setup_top_concepts(voc, config.mark_top_concepts)<EOL>logging.debug("<STR_LIT>")<EOL>check_hierarchy(voc, config.break_cycles,<EOL>config.keep_related, config.mark_top_concepts,<EOL>config.eliminate_redundancy)<EOL>logging.debug("<STR_LIT>")<EOL>check_labels(voc, config.preflabel_policy)<EOL>processtime = time.time()<EOL>logging.debug("<STR_LIT>",<EOL>(inputtime - starttime))<EOL>logging.debug("<STR_LIT>",<EOL>(processtime - inputtime))<EOL>logging.debug("<STR_LIT>")<EOL>return voc<EOL>
Convert, extend, and check SKOS vocabulary.