def detect_namespace(rdf):
<EOL>conc = rdf.value(None, RDF.type, SKOS.Concept, any=True)<EOL>if conc is None:<EOL><INDENT>logging.critical(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>ln = localname(conc)<EOL>ns = URIRef(conc.replace(ln, '<STR_LIT>'))<EOL>if ns.strip() == '<STR_LIT>':<EOL><INDENT>logging.critical(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>logging.info(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>", ns)<EOL>return ns<EOL>
Try to automatically detect the URI namespace of the vocabulary.

    Return namespace as URIRef.