Problem in inferring instances that have integer cardinality constraint
Posted
by Mikae Combarado
on Stack Overflow
See other posts from Stack Overflow
or by Mikae Combarado
Published on 2010-06-13T19:58:07Z
Indexed on
2010/06/13
20:02 UTC
Read the original article
Hit count: 268
Hello, I have created an RDF/OWL file using Protege 4.1 alpha. I also created a defined class in Protege called CheapPhone. This class has a restriction which is shown below :
(hasPrice some integer[< 350])
Whenever, a price of a phone is below 350, it is inferred as CheapPhone. There is no problem for inferring this in Protege 4.1 alpha. However, I cannot infer this using Jena.
I also created a defined class called SmartPhone. This class also has a restriction which is shown below :
(has3G value true) and (hasInternet value true)
Whenever, a phone has 3G and Internet, it is inferred as SmartPhone. In this situation, there is no problem inferring this in both Protege and Jena.
I have started to think that there is a problem in default inference engine of Jena. The code that I use in Java is below :
Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
reasoner = reasoner.bindSchema(ontModel);
OntModelSpec ontModelSpec = OntModelSpec.OWL_MEM_MINI_RULE_INF;
ontModelSpec.setReasoner(reasoner);
// Create ontology model with reasoner support
// ontModel was created and read before, so I don't share the code in order
// not to create garbage here
OntModel model = ModelFactory.createOntologyModel(ontModelSpec, ontModel);
OntClass sPhone = model.getOntClass(ns + "SmartPhone");
ExtendedIterator s = sPhone.listInstances();
while(s.hasNext()) {
OntResource mp = (OntResource)s.next();
System.out.println(mp.getURI());
}
This code works perfectly and returns me the instances, but when I change the code below and make it appropriate for CheapPhone, it doesn't return anything.
OntClass sPhone = model.getOntClass(ns + "CheapPhone");
Am I doing something wrong ?
© Stack Overflow or respective owner