0

I have a program that uses Jena to load an .owl Ontology designed in Protege. I am trying to do reasoning over it using Pellet in a way that if I add some statements in run time to model be able to check its consistency. For example I have 'Method', 'Signature' and 'hasSignature' concepts in which hasSignature is an object property. I have following axiom:

Method hasSignature exactly 1 Signature

When I add some instance statements in order to violate above axiom no inconsistency is reported. Here is my code:

List<Statement> statements = new ArrayList<>();

OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_RULE_INF);
FileManager.get().readModel(model, "Ontologies\\Ontology.owl");

OntClass Method = model.createClass( ns + "Method");
Individual method1 = Method.createIndividual(ns + "method1");

OntClass Signature = model.createClass( ns + "Signature");
Individual sign1 = Signature.createIndividual(ns + "sign1");
Individual sign2 = Signature.createIndividual(ns + "sign2");

Property hasSignature = model.createObjectProperty(ns + "hasSignature");

Statement st = model.createStatement(method1, hasSignature, sign1);
statements.add(st);

Statement st1 = model.createStatement(method1, hasSignature, sign2);
statements.add(st1);

Reasoner reasoner = PelletReasonerFactory.theInstance().create();
InfModel inf = ModelFactory.createInfModel(reasoner, model.add(statements));
System.out.println(inf.validate().isValid());

What's wrong? Why it doesn't work?

Kourosh
  • 91
  • 7

1 Answers1

1

You have not declared sign1 and sign2 to be different from each other. So, since it is possible for the two individuals to be sameAs each other, the reasoner has determined that that's the only case not rising a clash. Therefore the ontology is consistent.

Ignazio
  • 10,504
  • 1
  • 14
  • 25