Problem in inferring instances that have integer cardinality constraint
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 Chea开发者_Go百科pPhone, it doesn't return anything.
OntClass sPhone = model.getOntClass(ns + "CheapPhone");
Am I doing something wrong ?
Data ranges (the [< 350]
bit) is a feature of OWL 2. Jena doesn't support OWL 2. See W3C's OWL 2 Implementations page for a list of tools with OWL 2 support—you'll have to use one of those. (Some experimental ongoing work for Jena is listed there, but this definitely hasn't made it into a Jena release yet.)
精彩评论