On 25/09/15 10:34, df.santamaria87 wrote:
Dear all,
I have a problem querying labels in Jena with Pellet reasoner.
The ontologies I'm using were populated with OWL-API and Pellet. Now I
would ask for some labels. So I write:
KnowledgeBase kb = reasoner.getKB();
PelletInfGraph graph = new
org.mindswap.pellet.jena.PelletReasoner().bind( kb );
InfModel model = ModelFactory.createInfModel( graph );
Query q = QueryFactory.create(query);
QueryExecution qe = QueryExecutionFactory.create( q, model );
ResultSet rs = qe.execSelect();
The query simple asks for labels:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?subject ?object
WHERE { ?subject rdfs:label ?object }
I get no result. I tried the query in Protegè with the same ontologies
and it works properly. Other queries work, the problem is limited to
labels . So, what I'm missing in the code ?
I'm not familiar with the Pellet API but don't see where you are loading
the data. Does kb have anything in it? If you do kb.find(Node.ANY,
Node.ANY, Node.Any) and iterate over the first few triples is there
anything there?
If you load the same ontology into a plain model and run the query does
it work?
If so then it sounds like a question for the Pellet folks.
If you are using jena 3 then there may be incompatibilities with Pellet
due to the RDF 1.1 changes to how strings are handled.
Dave