model.open();
// using reasoning (here: assuming RDFS semantics)
URI A = model.createURI("urn:A");
URI B = model.createURI("urn:B");
URI C = model.createURI("urn:C");
model.addStatement(B, RDFS.subClassOf, A);
model.addStatement(C, RDFS.subClassOf, B);
// now let's see who is a superclass of C:
System.out.println("All superclasses of "+C+":");
ClosableIterator<? extends Statement> it = model.findStatements(C, RDFS.subClassOf, Variable.ANY);