开发者

What should I do with this SPARQL result in Jena?

开发者 https://www.devze.com 2023-01-21 11:31 出处:网络
I created a simple query to show subjects with value of a DataType property. This query runs in Protege 3.4.3. But when I run in Jena I receive this title \"com.hp.hpl.jena.sparql.engine.ResultSetStr

I created a simple query to show subjects with value of a DataType property. This query runs in Protege 3.4.3. But when I run in Jena I receive 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消