def transform_concepts(rdf, typemap):
<EOL>types = set()<EOL>for s, o in rdf.subject_objects(RDF.type):<EOL><INDENT>if o not in typemap and in_general_ns(o):<EOL><INDENT>continue<EOL><DEDENT>types.add(o)<EOL><DEDENT>for t in types:<EOL><INDENT>if mapping_match(t, typemap):<EOL><INDENT>newval = mapping_get(t, typemap)<EOL>newuris = [v[<NUM_LIT:0>] for v in newval]<EOL>logging.debug("<STR_LIT>", t, str(newuris))<EOL>if newuris[<NUM_LIT:0>] is None:  <EOL><INDENT>for inst in rdf.subjects(RDF.type, t):<EOL><INDENT>delete_uri(rdf, inst)<EOL><DEDENT>delete_uri(rdf, t)<EOL><DEDENT>else:<EOL><INDENT>replace_object(rdf, t, newuris, predicate=RDF.type)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>logging.info("<STR_LIT>", t)<EOL><DEDENT><DEDENT>
Transform Concepts into new types, as defined by the config file.