def transform_aggregate_concepts(rdf, cs, relationmap, aggregates):
if not aggregates:<EOL><INDENT>logging.debug("<STR_LIT>")<EOL><DEDENT>aggregate_concepts = []<EOL>relation = relationmap.get(<EOL>OWL.equivalentClass, [(OWL.equivalentClass, False)])[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>for conc, eq in rdf.subject_objects(relation):<EOL><INDENT>eql = rdf.value(eq, OWL.unionOf, None)<EOL>if eql is None:<EOL><INDENT>continue<EOL><DEDENT>if aggregates:<EOL><INDENT>aggregate_concepts.append(conc)<EOL>for item in rdf.items(eql):<EOL><INDENT>rdf.add((conc, SKOS.narrowMatch, item))<EOL><DEDENT><DEDENT>rdf.remove((conc, relation, eq))<EOL>rdf.remove((eq, RDF.type, OWL.Class))<EOL>rdf.remove((eq, OWL.unionOf, eql))<EOL>delete_uri(rdf, eql)<EOL>if not aggregates:<EOL><INDENT>delete_uri(rdf, conc)<EOL><DEDENT><DEDENT>if len(aggregate_concepts) > <NUM_LIT:0>:<EOL><INDENT>ns = cs.replace(localname(cs), '<STR_LIT>')<EOL>acs = create_concept_scheme(rdf, ns, '<STR_LIT>')<EOL>logging.debug("<STR_LIT>", acs)<EOL>for conc in aggregate_concepts:<EOL><INDENT>rdf.add((conc, SKOS.inScheme, acs))<EOL><DEDENT><DEDENT>
Transform YSO-style AggregateConcepts into skos:Concepts within their
       own skos:ConceptScheme, linked to the regular concepts with
       SKOS.narrowMatch relationships. If aggregates is False, remove
       all aggregate concepts instead.