def create_concept_scheme(rdf, ns, lname='<STR_LIT>'):
ont = None<EOL>if not ns:<EOL><INDENT>onts = list(rdf.subjects(RDF.type, OWL.Ontology))<EOL>if len(onts) > <NUM_LIT:1>:<EOL><INDENT>onts.sort()<EOL>ont = onts[<NUM_LIT:0>]<EOL>logging.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>", ont)<EOL><DEDENT>elif len(onts) == <NUM_LIT:1>:<EOL><INDENT>ont = onts[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>ont = None<EOL><DEDENT>if not ont:<EOL><INDENT>logging.info(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>ns = detect_namespace(rdf)<EOL><DEDENT>elif ont.endswith('<STR_LIT:/>') or ont.endswith('<STR_LIT:#>') or ont.endswith('<STR_LIT::>'):<EOL><INDENT>ns = ont<EOL><DEDENT>else:<EOL><INDENT>ns = ont + '<STR_LIT:/>'<EOL><DEDENT><DEDENT>NS = Namespace(ns)<EOL>cs = NS[lname]<EOL>rdf.add((cs, RDF.type, SKOS.ConceptScheme))<EOL>if ont is not None:<EOL><INDENT>rdf.remove((ont, RDF.type, OWL.Ontology))<EOL>for o in rdf.objects(ont, OWL.imports):<EOL><INDENT>rdf.remove((ont, OWL.imports, o))<EOL><DEDENT>for p, o in rdf.predicate_objects(ont):<EOL><INDENT>prot = URIRef(<EOL>'<STR_LIT>')<EOL>if p.startswith(prot):<EOL><INDENT>rdf.remove((ont, p, o))<EOL><DEDENT><DEDENT>replace_uri(rdf, ont, cs)<EOL><DEDENT>return cs<EOL>
Create a skos:ConceptScheme in the model and return it.