@Override
 public void visit(OWLDifferentIndividualsAxiom axiom) {
   Set<OWLClassExpression> nominals = new HashSet<OWLClassExpression>();
   for (OWLIndividual ind : axiom.getIndividuals()) {
     nominals.add(oneOf(ind));
   }
   result = factory.getOWLObjectIntersectionOf(nominals);
 }
 public void visit(OWLDifferentIndividualsAxiom object) {
   OWLIndividual[] individuals = new OWLIndividual[object.getIndividuals().size()];
   object.getIndividuals().toArray(individuals);
   for (int i = 0; i < individuals.length; i++)
     for (int j = i + 1; j < individuals.length; j++) {
       Atom atom =
           Atom.create(
               Inequality.create(),
               getIndividual(individuals[i]),
               getIndividual(individuals[j]));
       Collection<OWLAxiom> originalAxioms = m_positiveFacts_map.get(atom);
       if (originalAxioms == null) {
         originalAxioms = new ArrayList<OWLAxiom>();
         m_positiveFacts_map.put(atom, originalAxioms);
       }
       if (originalAxiom != null) originalAxioms.add(originalAxiom);
     }
 }
 @Override
 public void visit(OWLDifferentIndividualsAxiom axiom) {
   for (Iterator<OWLIndividual> it = axiom.getIndividuals().iterator(); it.hasNext(); ) {
     write("\\{");
     it.next().accept(this);
     write("\\}");
     if (it.hasNext()) {
       writeSpace();
       write(NOT_EQUIV);
       writeSpace();
     }
   }
 }
  public Set<OWLAxiom> write(OWLIndividual individual) {
    Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
    axioms.addAll(writeEntityStart(INDIVIDUAL, individual));
    if (!isFiltered(AxiomType.CLASS_ASSERTION)) {
      for (OWLOntology ontology : getOntologies()) {
        SectionMap expressions = new SectionMap();
        for (OWLClassAssertionAxiom ax : ontology.getClassAssertionAxioms(individual)) {
          if (isDisplayed(ax)) {
            expressions.add(ax.getClassExpression(), ax);
            axioms.add(ax);
          }
        }
        writeSection(TYPES, expressions, ",", true, ontology);
      }
    }
    for (OWLOntology ontology : getOntologies()) {

      List<OWLPropertyAssertionAxiom<?, ?>> assertions =
          new ArrayList<OWLPropertyAssertionAxiom<?, ?>>();
      assertions.addAll(ontology.getObjectPropertyAssertionAxioms(individual));
      assertions.addAll(ontology.getNegativeObjectPropertyAssertionAxioms(individual));
      assertions.addAll(ontology.getDataPropertyAssertionAxioms(individual));
      assertions.addAll(ontology.getNegativeDataPropertyAssertionAxioms(individual));

      if (!assertions.isEmpty()) {
        fireSectionRenderingPrepared(FACTS.toString());
        writeSection(FACTS);
        writeSpace();
        writeOntologiesList(ontology);
        incrementTab(1);
        writeNewLine();
        fireSectionRenderingStarted(FACTS.toString());

        for (Iterator<OWLPropertyAssertionAxiom<?, ?>> it = assertions.iterator(); it.hasNext(); ) {
          OWLPropertyAssertionAxiom<?, ?> ax = it.next();
          fireSectionItemPrepared(FACTS.toString());
          Set<OWLAnnotation> annos = ax.getAnnotations();
          if (!annos.isEmpty()) {
            writeAnnotations(annos);
            pushTab(getIndent() + 1);
          }

          if (ax instanceof OWLNegativeDataPropertyAssertionAxiom
              || ax instanceof OWLNegativeObjectPropertyAssertionAxiom) {
            write(NOT);
            writeSpace();
          }
          ax.getProperty().accept(this);
          writeSpace();
          writeSpace();
          ax.getObject().accept(this);
          if (!annos.isEmpty()) {
            popTab();
          }
          fireSectionItemFinished(FACTS.toString());
          if (it.hasNext()) {
            write(",");
            writeNewLine();
          }
        }
        popTab();
        writeNewLine();
        writeNewLine();
      }
    }

    if (!isFiltered(AxiomType.SAME_INDIVIDUAL)) {
      for (OWLOntology ontology : getOntologies()) {
        Set<OWLIndividual> inds = new TreeSet<OWLIndividual>();
        for (OWLSameIndividualAxiom ax : ontology.getSameIndividualAxioms(individual)) {
          if (isDisplayed(ax)) {
            inds.addAll(ax.getIndividuals());
            axioms.add(ax);
          }
        }
        inds.remove(individual);
        writeSection(SAME_AS, inds, ",", true, ontology);
      }
    }
    if (!isFiltered(AxiomType.DIFFERENT_INDIVIDUALS)) {
      for (OWLOntology ontology : getOntologies()) {
        Set<OWLIndividual> inds = new TreeSet<OWLIndividual>();
        Set<OWLDifferentIndividualsAxiom> nary = new TreeSet<OWLDifferentIndividualsAxiom>();
        for (OWLDifferentIndividualsAxiom ax : ontology.getDifferentIndividualAxioms(individual)) {
          if (ax.getIndividuals().size() == 2 && isDisplayed(ax)) {
            inds.addAll(ax.getIndividuals());
            axioms.add(ax);
          } else {
            nary.add(ax);
          }
        }
        inds.remove(individual);
        writeSection(DIFFERENT_FROM, inds, ",", true, ontology);
        if (renderExtensions) {
          for (OWLDifferentIndividualsAxiom ax : nary) {
            writeSection(DIFFERENT_INDIVIDUALS, ax.getIndividuals(), ", ", false, ontology);
          }
        }
      }
    }
    writeEntitySectionEnd(INDIVIDUAL.toString());
    return axioms;
  }
  public void writeOntology() throws OWLRendererException {
    if (ontologies.size() != 1) {
      throw new OWLRuntimeException("Can only render one ontology");
    }
    OWLOntology ontology = getOntologies().iterator().next();
    writePrefixMap();
    writeNewLine();
    writeOntologyHeader(ontology);

    for (OWLAnnotationProperty prop : ontology.getAnnotationPropertiesInSignature()) {
      write(prop);
    }
    for (OWLDatatype datatype : ontology.getDatatypesInSignature()) {
      write(datatype);
    }
    for (OWLObjectProperty prop : ontology.getObjectPropertiesInSignature()) {
      write(prop);
      OWLObjectPropertyExpression invProp = prop.getInverseProperty();
      if (!ontology.getAxioms(invProp).isEmpty()) {
        write(invProp);
      }
    }
    for (OWLDataProperty prop : ontology.getDataPropertiesInSignature()) {
      write(prop);
    }
    for (OWLClass cls : ontology.getClassesInSignature()) {
      write(cls);
    }
    for (OWLNamedIndividual ind : ontology.getIndividualsInSignature()) {
      write(ind);
    }
    for (OWLAnonymousIndividual ind : ontology.getReferencedAnonymousIndividuals()) {
      write(ind);
    }
    // Nary disjoint classes axioms
    event = new RendererEvent(this, ontology);
    for (OWLDisjointClassesAxiom ax : ontology.getAxioms(AxiomType.DISJOINT_CLASSES)) {
      if (ax.getClassExpressions().size() > 2) {
        SectionMap map = new SectionMap();
        map.add(ax.getClassExpressions(), ax);
        writeSection(DISJOINT_CLASSES, map, ",", false, ontology);
      }
    }
    // Nary equivalent classes axioms
    for (OWLEquivalentClassesAxiom ax : ontology.getAxioms(AxiomType.EQUIVALENT_CLASSES)) {
      if (ax.getClassExpressions().size() > 2) {
        SectionMap map = new SectionMap();
        map.add(ax.getClassExpressions(), ax);
        writeSection(EQUIVALENT_CLASSES, map, ",", false, ontology);
      }
    }
    // Nary disjoint properties
    for (OWLDisjointObjectPropertiesAxiom ax :
        ontology.getAxioms(AxiomType.DISJOINT_OBJECT_PROPERTIES)) {
      if (ax.getProperties().size() > 2) {
        SectionMap map = new SectionMap();
        map.add(ax.getProperties(), ax);
        writeSection(DISJOINT_PROPERTIES, map, ",", false, ontology);
      }
    }
    // Nary equivlant properties
    for (OWLEquivalentObjectPropertiesAxiom ax :
        ontology.getAxioms(AxiomType.EQUIVALENT_OBJECT_PROPERTIES)) {
      if (ax.getProperties().size() > 2) {
        SectionMap map = new SectionMap();
        map.add(ax.getProperties(), ax);
        writeSection(EQUIVALENT_PROPERTIES, map, ",", false, ontology);
      }
    }
    // Nary disjoint properties
    for (OWLDisjointDataPropertiesAxiom ax :
        ontology.getAxioms(AxiomType.DISJOINT_DATA_PROPERTIES)) {
      if (ax.getProperties().size() > 2) {
        SectionMap map = new SectionMap();
        map.add(ax.getProperties(), ax);
        writeSection(DISJOINT_PROPERTIES, map, ",", false, ontology);
      }
    }
    // Nary equivalent properties
    for (OWLEquivalentDataPropertiesAxiom ax :
        ontology.getAxioms(AxiomType.EQUIVALENT_DATA_PROPERTIES)) {
      if (ax.getProperties().size() > 2) {
        SectionMap map = new SectionMap();
        map.add(ax.getProperties(), ax);
        writeSection(EQUIVALENT_PROPERTIES, map, ",", false, ontology);
      }
    }
    // Nary different individuals
    for (OWLDifferentIndividualsAxiom ax : ontology.getAxioms(AxiomType.DIFFERENT_INDIVIDUALS)) {
      if (ax.getIndividuals().size() > 2) {
        SectionMap map = new SectionMap();
        map.add(ax.getIndividuals(), ax);
        writeSection(DIFFERENT_INDIVIDUALS, map, ",", false, ontology);
      }
    }
    for (SWRLRule rule : ontology.getAxioms(AxiomType.SWRL_RULE)) {
      writeSection(RULE, Collections.singleton(rule), ", ", false);
    }
    flush();
  }
 @Override
 public void visit(OWLDifferentIndividualsAxiom axiom) {
   Set<OWLIndividual> inds = duplicateSet(axiom.getIndividuals());
   obj = dataFactory.getOWLDifferentIndividualsAxiom(inds, duplicateAxiomAnnotations(axiom));
 }
 @Override
 public void visit(OWLDifferentIndividualsAxiom axiom) {
   handleObject(axiom);
   process(axiom.getIndividuals());
 }
 public void visit(OWLDifferentIndividualsAxiom axiom) {
   for (OWLIndividual ind : axiom.getIndividuals()) {
     ind.accept(this);
   }
   processAxiomAnnotations(axiom);
 }