0

I have some problem with reasoning: how can I retrieve the instance of a class if I load ONLY the TBox of an ontology?

OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLDataFactory dataFactory = manager.getOWLDataFactory();
Ontology = manager.createOntology();
Ontology = manager.loadOntologyFromOntologyDocument(IRI.create("http://www.cs.ox.ac.uk/isg/ontologies/lib/RobertsFamily/2009-09-03/00775.owl"));
PelletReasoner reasoner = PelletReasonerFactory.getInstance().createNonBufferingReasoner(Ontology);
reasoner.getKB().printClassTree();

The execution is BLOCKED to the last Line (I don't have NULL POINTER). It's only blocked :(

blinkettaro
  • 341
  • 6
  • 18
  • The RobertsFamily ontology is quite complex, so what might be happening is that the reasoner is out of memory, or just going quite slow. Try this IRI instead - the Pizza ontology is a much simpler one `"http://www.cs.ox.ac.uk/isg/ontologies/lib/co-ode.org/PIZZA/2007-02-12/00793.owl"` – Ignazio Feb 03 '16 at 23:27

1 Answers1

1

It's just not possible. Without ABox, there are no class assertions, thus most individuals are not available for the reasoner to find.

The only individuals which might be found are the ones included in OneOf restrictions; however, I've not tried building an ontology that would work with Pellet (or other reasoners) in this way, so I'm not sure it's possible either.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • Thank for your answer. But I have this exercise: "Test inference services on common ontologies: for example membership of an individual to a class. How Can I do this task ? – blinkettaro Feb 02 '16 at 13:04
  • Membership of an individual is instance check, while what you did in your example is retrieval - you can ckeck if an individual is a member of a class by checking if the class assertion for your specific individual and class is entailed: reasoner.isEntailed(dataFactory.getOWLClassAssertionAxiom(your class, your individual)). However this test will most often return false, without an abox containing assertions. – Ignazio Feb 02 '16 at 13:15
  • Ok perfect, I understand that. So, Is there an ontology that contais Tbox and Abox that I can download? The ontologies that I found don't contain Abox. – blinkettaro Feb 02 '16 at 13:39
  • What's the difference between membership and entailed? – blinkettaro Feb 02 '16 at 13:46
  • Entailment is whether an axiom is supported by the ontology - the reasoner can prove the axiom is 'true'. Membership is a specific kind of axiom: a type assertion. – Ignazio Feb 02 '16 at 14:04
  • Well, is it possibile that there isn't a link to an ontology (TBOX + ABOX) in order to test this inference services in a correct way? – blinkettaro Feb 02 '16 at 17:23
  • There's plenty - a Google search for "Ontology Repository" brings back a large number. One's here: http://www.cs.ox.ac.uk/isg/ontologies/lib/ another is available from the ORE 2015 reasoning competition: https://www.w3.org/community/owled/ore-2015-workshop/competition/ warning: the dataset is various gigabytes in size. – Ignazio Feb 02 '16 at 19:53
  • So I can't load the ontology with Ontology = manager.loadOntologyFromOntologyDocument(IRI.create("http://protege.cim3.net/file/pub/ontologies/travel/travel.owl")); ? – blinkettaro Feb 02 '16 at 19:58
  • You can try `OWLOntology o = OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument(IRI.create("http://www.cs.ox.ac.uk/isg/ontologies/lib/RobertsFamily/2009-09-03/00775.owl"));` I just tried it and the abox has 1500 axioms. – Ignazio Feb 02 '16 at 21:15
  • Ok perfect. I load that ontologiy (thank you for the repository) but when I attach the reasoner to ontology and a I do this, I receive NULL POINTER: PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner(Ontology); System.out.println(reasoner.getKB().getTBox().toString()); – blinkettaro Feb 03 '16 at 10:59
  • Can you update the question with your current code and the null pointer stack trace? – Ignazio Feb 03 '16 at 11:12
  • I edited my question. I don't have null pointer, but a blocked execution. – blinkettaro Feb 03 '16 at 16:57
  • Could you help me ?? :( – blinkettaro Feb 05 '16 at 10:17
  • I've solved the problem. The execution wasn't blocked but needed a bit of time :D – blinkettaro Feb 05 '16 at 12:02