0

I used Protege to make an ontology. It consists of two base classes. Each of them has three subsclasses. Subclasses are classes with specific object and data properties. When I make an instance I make it as class individual but with such data properties so that instance also belongs to some subclass. When I run Hermit in Protege, it is well done. It says that my instance belongs to class and subclass. But in Jfact in Java and Owlapi, when I try to print all instances from subclasses, my instance belongs only to superclass, not to subclass. Is it about JFact or something else?

for (OWLClass c : ont.getClassesInSignature()) {
            if (c.getIRI().getFragment().equals("Baby")) {
                NodeSet<OWLClass> subClasses = reasoner.getSubClasses(c, false);

                for (OWLClass subClass : subClasses.getFlattened()) {
                    System.out.println(subClass.getIRI().getFragment());


                    NodeSet<OWLNamedIndividual> instances = reasoner.getInstances(subClass, false);

                    for (OWLNamedIndividual i : instances.getFlattened()) {
                        System.out.println(i.getIRI().getFragment());

                        s += i.getIRI().getFragment() + " ";
                    }
                }
                }
            }
Ignazio
  • 10,504
  • 1
  • 14
  • 25
melnej
  • 1
  • 1
  • Please share the code you're having troubles with. – Ruben Steins Oct 17 '16 at 10:17
  • I shared the code. It works but output is not like I expected (Like Hermit in Protege). This Baby class has three subclasses. I created Baby instance, but it should be recognized as instance of one of subclasses by reasoner, but this code says that subclasses dont have their instances. – melnej Oct 17 '16 at 11:42

1 Answers1

0

Looks like a bug in JFact. Can you add an issue on its tracker, with version and ontology?

Edit: JFact 1.2.1 is ancient and has known bugs. Update to at least 1.2.4 (and OWLAPI 3.5.5, the most recent release for the 3.x version).

If possible, I recommend updating to OWLAPI 4 (for Java 7) or 5 (for Java 8) and the same main version for JFact.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • I send you a message on sourceforge. – melnej Oct 17 '16 at 22:21
  • I tried, but I have problems to import OWLAPI in Android project. JFact 1.2.4 and same old OWL don't resolved my problem of inferring subclasses for given instances. Also, I make new Android project, trying to use Pellet but there is no success with importing either. – melnej Oct 18 '16 at 23:19
  • Can you describe the failure? If you wish, please raise an issue on GitHub, so we can resolve the import problem. – Ignazio Oct 19 '16 at 05:42