title: How to add an individual to a class using OWL API?
body: <p>I wand to add an individual to a class, and I referenced the doc in OWL API official site.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>public void addIndividualsToClass(String className, String indName) throws OWLOntologyStorageException{
      /*
       * Add an individual to input class
       */
      OWLClass tClass = fac.getOWLClass(IRI.create(NS + className));
      OWLNamedIndividual tIndividual = fac.getOWLNamedIndividual(IRI.create(NS + indName));
      OWLClassAssertionAxiom classAssertion = fac.getOWLClassAssertionAxiom(tClass, tIndividual);
      manager.addAxiom(ont, classAssertion);
      manager.saveOntology(ont, new StreamDocumentTarget(new ByteArrayOutputStream()));
  }
  </code></pre>
  
  <p>Then, eclipse throws this exception.</p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract!
  at java.util.ComparableTimSort.mergeLo(ComparableTimSort.java:714)
  at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:451)
  at java.util.ComparableTimSort.mergeCollapse(ComparableTimSort.java:376)
  at java.util.ComparableTimSort.sort(ComparableTimSort.java:182)
  at java.util.ComparableTimSort.sort(ComparableTimSort.java:146)
  at java.util.Arrays.sort(Arrays.java:472)
  at java.util.Collections.sort(Collections.java:155)
  at org.coode.owlapi.owlxml.renderer.OWLXMLObjectRenderer.visit(OWLXMLObjectRenderer.java:184)
  at uk.ac.manchester.cs.owl.owlapi.OWLOntologyImpl.accept(OWLOntologyImpl.java:1630)
  at org.coode.owlapi.owlxml.renderer.OWLXMLRenderer.render(OWLXMLRenderer.java:106)
  at org.coode.owlapi.owlxml.renderer.OWLXMLOntologyStorer.storeOntology(OWLXMLOntologyStorer.java:73)
  at org.semanticweb.owlapi.util.AbstractOWLOntologyStorer.storeOntology(AbstractOWLOntologyStorer.java:174)
  at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.saveOntology(OWLOntologyManagerImpl.java:870)
  at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.saveOntology(OWLOntologyManagerImpl.java:861)
  at Test.addIndividualsToClass(Test.java:146)
  at Test.main(Test.java:155)
  </code></pre>
  
  <p>Can someone help me?</p>