Jena Effects of Different Entailment Regimes
Posted
by blueomega
on Stack Overflow
See other posts from Stack Overflow
or by blueomega
Published on 2010-06-09T16:20:26Z
Indexed on
2010/06/09
16:42 UTC
Read the original article
Hit count: 325
I am trying sparql and the use of entailment.
As a example i used http://www.w3.org/TR/2010/WD-sparql11-entailment-20100126/#t112
i try to put them in jena.
OntClass book1= model.createClass(NS+"book1");
OntClass book2=model.createClass(NS+"book2");
OntClass book3=model.createClass(NS+"book3");
OntClass publication=model.createClass(NS+"publication");
OntClass article=model.createClass(NS+"article");
OntClass mit=model.createClass(NS+"MIT");
ObjectProperty a = model.createObjectProperty(NS+"a");
ObjectProperty publishes = model.createObjectProperty(NS+"publishes");
book1.addProperty(a, publication);
book2.addProperty(a, article);
publication.addSubClass(article);
publishes.addRange(publication);
mit.addProperty(publishes, book3);
where model is type OntModel.
and i used the query similar to the problem
"PREFIX table: "I have correct namespace here"+
"SELECT *"+
"WHERE"+
"{"+
" ?x ?y table:publication ."+
"}";
The model was created like this. Hope OntModelSpec is ok.
OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_RDFS_INF, null);
i get as results from query
x y
| http://www.example.com/ontologies/sample.owl#publishes | rdfs:range |
| http://www.example.com/ontologies/sample.owl#article | rdfs:subClassOf |
| http://www.example.com/ontologies/sample.owl#book1 | http://www.example.com/ontologies/sample.owl#a |
| http://www.example.com/ontologies/sample.owl#publication | rdfs:subClassOf |
| http://www.example.com/ontologies/sample.owl#book3 | rdf:type |
Can anyone give me a example, with and without entailment, so a cant try code, can get the results right.
© Stack Overflow or respective owner