title: OWL Ontology: how to write a complement class definition?
body: <p>The reasoner fails to classify classes under a class A that is defined as a complement of another class B.</p>
  
  <p>I have created a minimal OWL ontology example (based on the famous pizza example) in protege 5 to illustrate this problem.</p>
  
  <p>There are two pizza classes: Americana and Soho, the former with meat toppings and the latter with vegetable toppings. 
  There are then two classes: VegetarianPizza defined as those pizzas with vegetable toppings and NonVegetarianPizza as those pizzas that are not a VegetarianPizza. Soho is correctly classified under VegetarianPizza but Americana isn't getting classified under NonVegetarianPizza. </p>
  
  <p>Could someone explain what's wrong?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;Ontology xmlns="http://www.w3.org/2002/07/owl#"
   xml:base="http://www.pizza.com/ontologies/pizza-minimal.owl"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:xml="http://www.w3.org/XML/1998/namespace"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
   xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
   ontologyIRI="http://www.pizza.com/ontologies/pizza-minimal.owl"
   versionIRI="http://www.pizza.com/ontologies/pizza-minimal.owl/v1.0"&gt;
  &lt;Prefix name="" IRI="http://www.pizza.com/ontologies/pizza-minimal.owl"/&gt;
  &lt;Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/&gt;
  &lt;Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/&gt;
  &lt;Prefix name="xml" IRI="http://www.w3.org/XML/1998/namespace"/&gt;
  &lt;Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/&gt;
  &lt;Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/&gt;
  &lt;Declaration&gt;
      &lt;ObjectProperty IRI="#isToppingOf"/&gt;
  &lt;/Declaration&gt;
  &lt;Declaration&gt;
      &lt;ObjectProperty IRI="#hasTopping"/&gt;
  &lt;/Declaration&gt;
  &lt;Declaration&gt;
      &lt;Class IRI="#NonVegetarianPizza"/&gt;
  &lt;/Declaration&gt;
  &lt;Declaration&gt;
      &lt;Class IRI="#SohoPizza"/&gt;
  &lt;/Declaration&gt;
  &lt;Declaration&gt;
      &lt;Class IRI="#VegetableTopping"/&gt;
  &lt;/Declaration&gt;
  &lt;Declaration&gt;
      &lt;Class IRI="#VegetarianPizza"/&gt;
  &lt;/Declaration&gt;
  &lt;Declaration&gt;
      &lt;Class IRI="#Pizza"/&gt;
  &lt;/Declaration&gt;
  &lt;Declaration&gt;
      &lt;Class IRI="#MeatTopping"/&gt;
  &lt;/Declaration&gt;
  &lt;Declaration&gt;
      &lt;Class IRI="#PizzaTopping"/&gt;
  &lt;/Declaration&gt;
  &lt;Declaration&gt;
      &lt;Class IRI="#AmericanaPizza"/&gt;
  &lt;/Declaration&gt;
  &lt;EquivalentClasses&gt;
      &lt;Class IRI="#NonVegetarianPizza"/&gt;
      &lt;ObjectIntersectionOf&gt;
          &lt;Class IRI="#Pizza"/&gt;
          &lt;ObjectComplementOf&gt;
              &lt;Class IRI="#VegetarianPizza"/&gt;
          &lt;/ObjectComplementOf&gt;
      &lt;/ObjectIntersectionOf&gt;
  &lt;/EquivalentClasses&gt;
  &lt;EquivalentClasses&gt;
      &lt;Class IRI="#VegetarianPizza"/&gt;
      &lt;ObjectIntersectionOf&gt;
          &lt;Class IRI="#Pizza"/&gt;
          &lt;ObjectAllValuesFrom&gt;
              &lt;ObjectProperty IRI="#hasTopping"/&gt;
              &lt;Class IRI="#VegetableTopping"/&gt;
          &lt;/ObjectAllValuesFrom&gt;
      &lt;/ObjectIntersectionOf&gt;
  &lt;/EquivalentClasses&gt;
  &lt;SubClassOf&gt;
      &lt;Class IRI="#AmericanaPizza"/&gt;
      &lt;Class IRI="#Pizza"/&gt;
  &lt;/SubClassOf&gt;
  &lt;SubClassOf&gt;
      &lt;Class IRI="#AmericanaPizza"/&gt;
      &lt;ObjectSomeValuesFrom&gt;
          &lt;ObjectProperty IRI="#hasTopping"/&gt;
          &lt;Class IRI="#MeatTopping"/&gt;
      &lt;/ObjectSomeValuesFrom&gt;
  &lt;/SubClassOf&gt;
  &lt;SubClassOf&gt;
      &lt;Class IRI="#AmericanaPizza"/&gt;
      &lt;ObjectAllValuesFrom&gt;
          &lt;ObjectProperty IRI="#hasTopping"/&gt;
          &lt;Class IRI="#MeatTopping"/&gt;
      &lt;/ObjectAllValuesFrom&gt;
  &lt;/SubClassOf&gt;
  &lt;SubClassOf&gt;
      &lt;Class IRI="#MeatTopping"/&gt;
      &lt;Class IRI="#PizzaTopping"/&gt;
  &lt;/SubClassOf&gt;
  &lt;SubClassOf&gt;
      &lt;Class IRI="#SohoPizza"/&gt;
      &lt;Class IRI="#Pizza"/&gt;
  &lt;/SubClassOf&gt;
  &lt;SubClassOf&gt;
      &lt;Class IRI="#SohoPizza"/&gt;
      &lt;ObjectSomeValuesFrom&gt;
          &lt;ObjectProperty IRI="#hasTopping"/&gt;
          &lt;Class IRI="#VegetableTopping"/&gt;
      &lt;/ObjectSomeValuesFrom&gt;
  &lt;/SubClassOf&gt;
  &lt;SubClassOf&gt;
      &lt;Class IRI="#SohoPizza"/&gt;
      &lt;ObjectAllValuesFrom&gt;
          &lt;ObjectProperty IRI="#hasTopping"/&gt;
          &lt;Class IRI="#VegetableTopping"/&gt;
      &lt;/ObjectAllValuesFrom&gt;
  &lt;/SubClassOf&gt;
  &lt;SubClassOf&gt;
      &lt;Class IRI="#VegetableTopping"/&gt;
      &lt;Class IRI="#PizzaTopping"/&gt;
  &lt;/SubClassOf&gt;
  &lt;InverseObjectProperties&gt;
      &lt;ObjectProperty IRI="#hasTopping"/&gt;
      &lt;ObjectProperty IRI="#isToppingOf"/&gt;
  &lt;/InverseObjectProperties&gt;
  &lt;ObjectPropertyDomain&gt;
      &lt;ObjectProperty IRI="#hasTopping"/&gt;
      &lt;Class IRI="#Pizza"/&gt;
  &lt;/ObjectPropertyDomain&gt;
  &lt;ObjectPropertyRange&gt;
      &lt;ObjectProperty IRI="#hasTopping"/&gt;
      &lt;Class IRI="#PizzaTopping"/&gt;
  &lt;/ObjectPropertyRange&gt;
  &lt;/Ontology&gt;
  </code></pre>