code: def transform_aggregate_concepts(rdf, cs, relationmap, aggregates):
      
  
      if not aggregates:
          logging.debug("removing aggregate concepts")
  
      aggregate_concepts = []
  
      relation = relationmap.get(
          OWL.equivalentClass, [(OWL.equivalentClass, False)])[0][0]
      for conc, eq in rdf.subject_objects(relation):
          eql = rdf.value(eq, OWL.unionOf, None)
          if eql is None:
              continue
          if aggregates:
              aggregate_concepts.append(conc)
              for item in rdf.items(eql):
                  rdf.add((conc, SKOS.narrowMatch, item))
          # remove the old equivalentClass-unionOf-rdf:List structure
          rdf.remove((conc, relation, eq))
          rdf.remove((eq, RDF.type, OWL.Class))
          rdf.remove((eq, OWL.unionOf, eql))
          # remove the rdf:List structure
          delete_uri(rdf, eql)
          if not aggregates:
              delete_uri(rdf, conc)
  
      if len(aggregate_concepts) > 0:
          ns = cs.replace(localname(cs), '')
          acs = create_concept_scheme(rdf, ns, 'aggregateconceptscheme')
          logging.debug("creating aggregate concept scheme %s", acs)
          for conc in aggregate_concepts:
              rdf.add((conc, SKOS.inScheme, acs))
docs: 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.