title: Creating an instance in OWLready2 creates a completely new class instead of asigning it to the existing class
body: <p>I'm trying to create a simple ontology, following the tutorial on the official website.
  The code runs smoothly and everything seems fine when running this code:</p>
  <pre><code>import owlready2
  owlready2.JAVA_EXE = r&quot;my-path-to-java-exe&quot;          
  
  # new.owl is a non-existing file and therefore onto has no pre-defined classes
  # if you know of any nicer way to define an ontology, I'd appreciate it
  
  onto = get_ontology(&quot;new.owl&quot;)
  
  with onto:
      class Drug(Thing): pass
      class number_of_tablets(Drug &gt;&gt; int, FunctionalProperty): pass          # Creating some properties
      class price(Drug &gt;&gt; float, FunctionalProperty): pass
      class price_per_tablet(Drug &gt;&gt; float, FunctionalProperty): pass
  
      rule = Imp()
  
      # Rule: &quot;Drug instance ?d     AND     price of ?d is ?p     AND     drug ?d has number_of_tablets = ?n
      #        AND     ?r = ?p/?n     -&gt;      Drug ?d has price_per_tablet = ?r&quot;
      
      rule.set_as_rule(&quot;&quot;&quot;Drug(?d), price(?d,?p), number_of_tablets(?d,?n), divide(?r, ?p, ?n) -&gt; price_per_tablet(?d, ?r)&quot;&quot;&quot;)
  
      # Create an instance &quot;drug&quot; with properties defined in brackets
      drug = Drug(number_of_tablets = 10, price = 25.0)
      #print(drug.iri)
  
      # Syncing the reasoner infers new info
      sync_reasoner_pellet(infer_property_values = True, infer_data_property_values = True)
  
      # New property price_per_tablet is now added to drug and we can use it normally:
      print(drug.price_per_tablet)
  
  # Save this ontology with rules in the same folder, filename: test
  onto.save(file = &quot;test&quot;, format = &quot;rdfxml&quot;)
  </code></pre>
  <p>Problem: When I open the resulting file &quot;test&quot; in Protégé, my instance &quot;drug1&quot; is <strong>not</strong> a part of the previously defined class Drug but of a new class of the same name <em>Drug</em> (I'll always denote this one in italic so it doesn't get confusing). Interestingly, this new class <em>Drug</em> is not even a subclass of owl:Thing class.</p>
  <p>I'm not sure what's the problem. According to Protégé, the defined class Drug has IRI: <strong>file:/C:/.../new#Drug</strong>, and the other class <em>Drug</em> has IRI: <strong>new#Drug</strong>.</p>
  <p>When I checked IRIs of all the described objects in Python, they were all synchronized.</p>
  <p>I'm very confused about what happened here.</p>
  <p>I checked the &quot;test&quot; file and the part concerning this instance is:</p>
  <pre><code>&lt;Drug rdf:about=&quot;#drug1&quot;&gt;
    &lt;rdf:type rdf:resource=&quot;http://www.w3.org/2002/07/owl#NamedIndividual&quot;/&gt;
    &lt;number_of_tablets rdf:datatype=&quot;http://www.w3.org/2001/XMLSchema#integer&quot;&gt;10&lt;/number_of_tablets&gt;
    &lt;price rdf:datatype=&quot;http://www.w3.org/2001/XMLSchema#decimal&quot;&gt;25.0&lt;/price&gt;
    &lt;price_per_tablet rdf:datatype=&quot;http://www.w3.org/2001/XMLSchema#decimal&quot;&gt;2.5&lt;/price_per_tablet&gt;
  &lt;/Drug&gt;
  </code></pre>
  <p>This is confusing because when I opened the file PizzaTutorial.owl from the famous Pizza tutorial, an instance was defined like this:</p>
  <pre><code>&lt;owl:NamedIndividual rdf:about=&quot;http://www.semanticweb.org/pizzatutorial/ontologies/2020/PizzaTutorial#AmericanaHotPizza2&quot;&gt;
          &lt;rdf:type rdf:resource=&quot;http://www.semanticweb.org/pizzatutorial/ontologies/2020/PizzaTutorial#AmericanaHotPizza&quot;/&gt;
          &lt;hasCaloricContent rdf:datatype=&quot;http://www.w3.org/2001/XMLSchema#integer&quot;&gt;675&lt;/hasCaloricContent&gt;
      &lt;/owl:NamedIndividual&gt;
  </code></pre>
  <p>What happened?!</p>
  <p>Another question: When I inspected the individual in Protégé, I noticed that the properties <em>number_of_tablets</em> and <em>price</em> were added as Annotations, and not as Data Properties. I assume that this is the reason why my SWRL rule (which was correctly exported) doesn't conclude the <em>price_per_tablet</em> property for this individual when I remove the sync_reasoner line.</p>
  <p>Please comment on anything you notice is wrong, I'm a beginner in ontology programming and in both tools and I would very much appreciate your help!</p>