Hi again :)

String query ="SELECT ?subject ?predicate ?object from"+ WybierzGrafComboBox.getSelectedItem().toString() +"\n" +
                                                "WHERE {\n" +
" ?subject ?predicate ?object\n" +
                                                "}";
                    String service = "http://localhost:3030/test/query";;
                    Query q= QueryFactory.create(query);
try(QueryExecution qexec = QueryExecutionFactory.sparqlService(service, q))
                    {
                        ResultSet rs = qexec.execSelect();
                        for ( ; rs.hasNext() ; )
                        {
                            QuerySolution soln = rs.nextSolution() ;
                            RDFNode s = soln.get("subject");
                            RDFNode p = soln.get("predicate");
                            RDFNode o = soln.get("object");
                            System.out.println(s +" "+ p+ " "+ o);
                        }
                    }

give me good result:

http://www.example.org/exampleDocument#Monica http://www.example.org/vocabulary#hasSkill http://www.example.org/vocabulary#Programming http://www.example.org/exampleDocument#Monica http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.example.org/vocabulary#Person

But i need print it as all other serialization supported in Jena
I think about brutal metod - write all into file give dot on end (to make it N-Quads), and then use RDFDataMgr :?
I'm sure there are other methods :?
Please pointing me how to do it

--
Pozdrawiam
Wojciech Ciesielski

Reply via email to