def skos_transitive(rdf, narrower=True):
for conc in rdf.subjects(RDF.type, SKOS.Concept):<EOL><INDENT>for bt in rdf.transitive_objects(conc, SKOS.broader):<EOL><INDENT>if bt == conc:<EOL><INDENT>continue<EOL><DEDENT>rdf.add((conc, SKOS.broaderTransitive, bt))<EOL>if narrower:<EOL><INDENT>rdf.add((bt, SKOS.narrowerTransitive, conc))<EOL><DEDENT><DEDENT><DEDENT>
Perform transitive closure inference (S22, S24).