anushr 0 Newbie Poster

can I know how to access the databse from jena using tdb and arq..am unable to get the resultsetformatter in jsp..the code runs perfectly in java,but i encounter problem in jsp...

String s = ""
                            + "PREFIX dc: <http://purl.org/dc/elements/1.1/>"
                            + "PREFIX skos:<http://www.w3.org/2004/02/skos/core#>"
                            + "SELECT  ?s "
                            + " { "
                            + "?s skos:related ?o"
                            + "}";
                    //See http://www.openjena.org/ARQ/app_api.html
                    //out.println("</textarea>");
                    out.println("<br><br>");
                    out.println("your query is<br>");
                    out.println(s);

                   //if (s.contains(cd))
                        //{
                    
                        Query que = QueryFactory.create(s);
                        QueryExecution qe = QueryExecutionFactory.create(que, m);
                        qe.getContext().setTrue(ARQ.enablePropertyFunctions);
                        ResultSet rs = qe.execSelect();
                        List vars = rs.getResultVars();
                        Iterator it = vars.iterator();
                        while(it.hasNext())
                            {
                        while(rs.hasNext())
                            {
                         QuerySolution qs=rs.nextSolution();
                         it=qs.varNames();
                         out.println(qs);
                         }
                        }
                        qe.close();
                        m.close();

                        //ResultSetRewindable rs = qe.execSelect() ;
                        ResultSetFormatter.out(rs);

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.