public void visit(OWLObjectOneOf desc) {
   try {
     faCTPlusPlus.initArgList();
     for (OWLIndividual ind : desc.getIndividuals()) {
       ind.accept(this);
       faCTPlusPlus.addArg(getLastIndividualPointer());
     }
     faCTPlusPlus.closeArgList();
     lastClassPointer = faCTPlusPlus.getOneOf();
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLObjectSelfRestriction desc) {
   try {
     desc.getProperty().accept(this);
     lastClassPointer = faCTPlusPlus.getSelf(getLastObjectPropertyPointer());
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLObjectPropertyInverse property) {
   try {
     property.getInverse().accept(this);
     lastObjectPropertyPointer = faCTPlusPlus.getInverseProperty(getLastObjectPropertyPointer());
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLDataType dataType) {
   try {
     lastDataTypeExpressionPointer = null;
     lastDataTypePointer =
         (DataTypePointer) owlDataRange2DataTypeExpressionPointerMap.get(dataType);
     if (lastDataTypePointer == null) {
       if (owlOntologyManager.getOWLDataFactory().getTopDataType().equals(dataType)) {
         lastDataTypePointer = faCTPlusPlus.getDataTop();
       } else {
         lastDataTypePointer = faCTPlusPlus.getBuiltInDataType(dataType.getURI().toString());
       }
       owlDataRange2DataTypeExpressionPointerMap.put(dataType, lastDataTypePointer);
       dataTypeExpressionPointerMap.put(lastDataTypePointer, dataType);
     }
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLObjectComplementOf owlNot) {
   try {
     owlNot.getOperand().accept(this);
     ClassPointer cp = getLastClassPointer();
     lastClassPointer = faCTPlusPlus.getConceptNot(cp);
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLDataSomeRestriction owlDataSomeRestriction) {
   try {
     DataPropertyPointer p = translate(owlDataSomeRestriction.getProperty());
     owlDataSomeRestriction.getFiller().accept(this);
     lastClassPointer = faCTPlusPlus.getDataSome(p, getLastDataTypeExpressionPointer());
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLDataValueRestriction owlDataValueRestriction) {
   try {
     DataPropertyPointer p = translate(owlDataValueRestriction.getProperty());
     OWLConstant val = owlDataValueRestriction.getValue();
     val.accept(this);
     lastClassPointer = faCTPlusPlus.getDataValue(p, getLastDataValuePointer());
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLClass owlClass) {
   try {
     lastClassPointer = owlClass2ClassPointerMap.get(owlClass);
     // Cache if not in map
     if (lastClassPointer == null) {
       if (owlClass.getURI().equals(OWLRDFVocabulary.OWL_THING.getURI())) {
         lastClassPointer = faCTPlusPlus.getThing();
       } else if (owlClass.getURI().equals(OWLRDFVocabulary.OWL_NOTHING.getURI())) {
         lastClassPointer = faCTPlusPlus.getNothing();
       } else {
         lastClassPointer = faCTPlusPlus.getNamedClass(owlClass.getURI().toString());
       }
       classPointerMap.put(lastClassPointer, owlClass);
       owlClass2ClassPointerMap.put(owlClass, lastClassPointer);
     }
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLObjectUnionOf owlOr) {
   try {
     // We can't do "nested" arg lists, so translate all operands
     // and put the pointers into a set first, then create the intersection
     Set<ClassPointer> operandPointers = new HashSet<ClassPointer>();
     for (OWLDescription desc : owlOr.getOperands()) {
       desc.accept(this);
       operandPointers.add(getLastClassPointer());
     }
     faCTPlusPlus.initArgList();
     for (ClassPointer operandPointer : operandPointers) {
       faCTPlusPlus.addArg(operandPointer);
     }
     faCTPlusPlus.closeArgList();
     lastClassPointer = faCTPlusPlus.getConceptOr();
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLObjectValueRestriction owlObjectValueRestriction) {
   try {
     owlObjectValueRestriction.getValue().accept(this);
     IndividualPointer individualPointer = getLastIndividualPointer();
     owlObjectValueRestriction.getProperty().accept(this);
     ObjectPropertyPointer propertyPointer = getLastObjectPropertyPointer();
     lastClassPointer = faCTPlusPlus.getObjectValue(propertyPointer, individualPointer);
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLObjectSomeRestriction owlObjectSomeRestriction) {
   try {
     owlObjectSomeRestriction.getFiller().accept(this);
     ClassPointer classPointer = getLastClassPointer();
     owlObjectSomeRestriction.getProperty().accept(this);
     ObjectPropertyPointer propertyPointer = getLastObjectPropertyPointer();
     lastClassPointer = faCTPlusPlus.getObjectSome(propertyPointer, classPointer);
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLDataMaxCardinalityRestriction desc) {
   try {
     desc.getProperty().accept(this);
     DataPropertyPointer p = getLastDataPropertyPointer();
     desc.getFiller().accept(this);
     lastClassPointer =
         faCTPlusPlus.getDataAtMost(desc.getCardinality(), p, getLastDataTypeExpressionPointer());
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLIndividual individual) {
   try {
     lastIndividualPointer = owlIndividual2IndividualPointerMap.get(individual);
     if (lastIndividualPointer == null) {
       lastIndividualPointer = faCTPlusPlus.getIndividual(individual.getURI().toString());
       individualPointerMap.put(lastIndividualPointer, individual);
       owlIndividual2IndividualPointerMap.put(individual, lastIndividualPointer);
     }
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLDataProperty owlDataProperty) {
   try {
     lastDataPropertyPointer = owlDataProperty2DataPropertyPointerMap.get(owlDataProperty);
     if (lastDataPropertyPointer == null) {
       lastDataPropertyPointer = faCTPlusPlus.getDataProperty(owlDataProperty.getURI().toString());
       dataPropertyPointerMap.put(lastDataPropertyPointer, owlDataProperty);
       owlDataProperty2DataPropertyPointerMap.put(owlDataProperty, lastDataPropertyPointer);
     }
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLObjectMaxCardinalityRestriction desc) {
   try {
     desc.getFiller().accept(this);
     ClassPointer classPointer = getLastClassPointer();
     desc.getProperty().accept(this);
     ObjectPropertyPointer propertyPointer = getLastObjectPropertyPointer();
     lastClassPointer =
         faCTPlusPlus.getObjectAtMost(desc.getCardinality(), propertyPointer, classPointer);
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLDataComplementOf node) {
   try {
     lastDataTypeExpressionPointer = owlDataRange2DataTypeExpressionPointerMap.get(node);
     if (lastDataTypeExpressionPointer == null) {
       node.getDataRange().accept(this);
       lastDataTypeExpressionPointer = faCTPlusPlus.getDataNot(getLastDataTypeExpressionPointer());
       owlDataRange2DataTypeExpressionPointerMap.put(node, lastDataTypeExpressionPointer);
       dataTypeExpressionPointerMap.put(lastDataTypeExpressionPointer, node);
     }
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
 public void visit(OWLTypedConstant node) {
   try {
     lastDataValuePointer = owlConstant2DataValuePointerMap.get(node);
     if (lastDataValuePointer == null) {
       node.getDataType().accept((OWLDataVisitor) this);
       lastDataValuePointer =
           faCTPlusPlus.getDataValue(node.getLiteral(), getLastDataTypePointer());
       owlConstant2DataValuePointerMap.put(node, lastDataValuePointer);
       dataValuePointerMap.put(lastDataValuePointer, node);
     }
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
  public void visit(OWLDataOneOf node) {
    try {
      lastDataTypeExpressionPointer = owlDataRange2DataTypeExpressionPointerMap.get(node);
      if (lastDataTypeExpressionPointer == null) {

        List<DataValuePointer> pointers = new ArrayList<DataValuePointer>();
        for (OWLConstant con : node.getValues()) {
          con.accept(this);
          pointers.add(getLastDataValuePointer());
        }
        faCTPlusPlus.initArgList();
        for (DataValuePointer pointer : pointers) {
          faCTPlusPlus.addArg(pointer);
        }
        faCTPlusPlus.closeArgList();
        lastDataTypeExpressionPointer = faCTPlusPlus.getDataEnumeration();
        owlDataRange2DataTypeExpressionPointerMap.put(node, lastDataTypeExpressionPointer);
        dataTypeExpressionPointerMap.put(lastDataTypeExpressionPointer, node);
      }
    } catch (Exception e) {
      throw new FaCTPlusPlusRuntimeException(e);
    }
  }
 public void visit(OWLUntypedConstant node) {
   try {
     lastDataValuePointer = owlConstant2DataValuePointerMap.get(node);
     if (lastDataValuePointer == null) {
       owlOntologyManager
           .getOWLDataFactory()
           .getOWLDataType(XSDVocabulary.STRING.getURI())
           .accept((OWLDataVisitor) this);
       lastDataValuePointer =
           faCTPlusPlus.getDataValue(node.getLiteral(), getLastDataTypePointer());
       owlConstant2DataValuePointerMap.put(node, lastDataValuePointer);
       dataValuePointerMap.put(lastDataValuePointer, node);
     }
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
  public void visit(OWLDataRangeRestriction node) {
    try {
      lastDataTypeExpressionPointer = owlDataRange2DataTypeExpressionPointerMap.get(node);
      if (lastDataTypeExpressionPointer == null) {
        lastDataTypeExpressionPointer = null;
        lastDataTypePointer = null;
        node.getDataRange().accept(this);
        DataTypeExpressionPointer dt = getLastDataTypeExpressionPointer();

        for (OWLDataRangeFacetRestriction restriction : node.getFacetRestrictions()) {

          restriction.getFacetValue().accept(this);
          DataValuePointer dv = getLastDataValuePointer();
          DataTypeFacet facet = null;
          if (restriction.getFacet().equals(OWLRestrictedDataRangeFacetVocabulary.MIN_INCLUSIVE)) {
            facet = faCTPlusPlus.getMinInclusiveFacet(dv);
          } else if (restriction
              .getFacet()
              .equals(OWLRestrictedDataRangeFacetVocabulary.MAX_INCLUSIVE)) {
            facet = faCTPlusPlus.getMaxInclusiveFacet(dv);
          } else if (restriction
              .getFacet()
              .equals(OWLRestrictedDataRangeFacetVocabulary.MIN_EXCLUSIVE)) {
            facet = faCTPlusPlus.getMinExclusiveFacet(dv);
          } else if (restriction
              .getFacet()
              .equals(OWLRestrictedDataRangeFacetVocabulary.MAX_EXCLUSIVE)) {
            facet = faCTPlusPlus.getMaxExclusiveFacet(dv);
          } else if (restriction.getFacet().equals(OWLRestrictedDataRangeFacetVocabulary.LENGTH)) {
            facet = faCTPlusPlus.getLength(dv);
          } else if (restriction
              .getFacet()
              .equals(OWLRestrictedDataRangeFacetVocabulary.MIN_LENGTH)) {
            facet = faCTPlusPlus.getMinLength(dv);
          } else if (restriction
              .getFacet()
              .equals(OWLRestrictedDataRangeFacetVocabulary.MAX_LENGTH)) {
            facet = faCTPlusPlus.getMaxLength(dv);
          } else if (restriction
              .getFacet()
              .equals(OWLRestrictedDataRangeFacetVocabulary.FRACTION_DIGITS)) {
            facet = faCTPlusPlus.getFractionDigitsFacet(dv);
          } else if (restriction.getFacet().equals(OWLRestrictedDataRangeFacetVocabulary.PATTERN)) {
            facet = faCTPlusPlus.getPattern(dv);
          } else if (restriction
              .getFacet()
              .equals(OWLRestrictedDataRangeFacetVocabulary.TOTAL_DIGITS)) {
            facet = faCTPlusPlus.getTotalDigitsFacet(dv);
          } else {
            throw new FaCTPlusPlusReasonerException(
                "Unsupported data type facet: " + restriction.getFacet());
          }
          dt = lastDataTypeExpressionPointer = faCTPlusPlus.getRestrictedDataType(dt, facet);
        }
        owlDataRange2DataTypeExpressionPointerMap.put(node, lastDataTypeExpressionPointer);
        dataTypeExpressionPointerMap.put(lastDataTypeExpressionPointer, node);
      }
    } catch (Exception e) {
      throw new FaCTPlusPlusRuntimeException(e);
    }
  }