views:

18

answers:

1

I create a simple query to show subjects with value of DataType property. this query run in the Protege3.4.3.but when i run in the Jena i revive this title "com.hp.hpl.jena.sparql.engine.ResultSetStream@16be68f".why? this is my query:

PREFIX VB:http://VBnet# SELECT ?x ?y WHERE { ?x rdf:type VB:LearnerInformation . ?x VB:Name ?y

LearnerInformation is one class and Name is a Datatype property.

If anybody know me please help me.
thanks in advance

+1  A: 

You have received a set of results, which is represented by a ResultSet. You can step through it as follows:

ResultSet results = ... // result of query
while (results.hasNext()) {
  QuerySolution soln = results.next();
  System.err.printf("X is '%s'\n", soln.getResource("x"));
  System.err.printf("Y is '%s'\n", soln.getLiteral("y"));
}

Note that the results are structured objects themselves.

My friend thanks for your answer.But already i used this code in my programming.i don't know why my query in jena doesn't has any output while in Protege i can see the output!??
saman
@saman @user205512 could it be that Jena is not doing any reasoning and Protege is giving answers based on some sort level of reasoning ??
msalvadores