title: How to use Transitive Reasoner with Jena?
body: <p>I would like to set up a TransitiveReasoner with Jena to create a new inference model from a schema and a dataset. It works with RDFS reasoner but not with TransitiveReasoner.</p>
  
  <p>This is my first experience with inference; I looked at the Jena Inference Support plus other tutorials, but could not manage to solve my problem.</p>
  
  <p>Here my test code in java:</p>
  
  <pre><code>import com.hp.hpl.jena.ontology.*;
  import com.hp.hpl.jena.rdf.model.*;
  import com.hp.hpl.jena.reasoner.*;
  import com.hp.hpl.jena.vocabulary.*;
  
  public class TestInference 
  {
  
      public static void myTest() throws IOException
      {
        String NS = "testInference:";
        OntModel schema = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
        OntClass m = schema.createClass(NS + "Mention");
        OntClass pm = schema.createClass(NS + "PersonMention");
        pm.addProperty(RDFS.subClassOf, m);
  
        Model data = ModelFactory.createDefaultModel();
        Resource r = data.createResource(NS+"alberto");
        r.addProperty(RDF.type, pm);
  
        Reasoner rdfsReasoner = ReasonerRegistry.getRDFSSimpleReasoner();
        Reasoner transReasoner = ReasonerRegistry.getTransitiveReasoner();
  
        System.out.println("\n===== RDSF =====");
        InfModel rdfsInf = ModelFactory.createInfModel(rdfsReasoner, schema, data);
        rdfsInf.write(System.out, "TURTLE");
  
        System.out.println("\n===== Trans =====");
        InfModel transInf = ModelFactory.createInfModel(transReasoner, schema, data);
        transInf.write(System.out, "TURTLE");
  }
  
  public static void main(String[] args) throws IOException
  {
      myTest();
  }
  </code></pre>
  
  <p>Trying to change the <code>OntModelSpec</code> does not help. </p>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks in advance for your help.</p>