Package org.openrdf.query

Examples of org.openrdf.query.TupleQueryResultHandlerException


                    public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException {
                        subject = triples.getValueFactory().createURI(resource.stringValue());
                        try {
                            con = triples.getConnection();
                        } catch (RepositoryException e) {
                            throw new TupleQueryResultHandlerException("error while creating repository connection",e);
                        }
                    }

                    @Override
                    public void endQueryResult() throws TupleQueryResultHandlerException   {
                        try {
                            con.commit();
                            con.close();
                        } catch (RepositoryException e) {
                            throw new TupleQueryResultHandlerException("error while closing repository connection",e);
                        }
                    }

                    @Override
                    public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException {

                        try {
                            Value predicate = bindingSet.getValue("p");
                            Value object    = bindingSet.getValue("o");

                            if(predicate instanceof URI) {
                                con.add(triples.getValueFactory().createStatement(subject,(URI)predicate,object));
                            } else {
                                log.error("ignoring binding as predicate {} is not a URI",predicate);
                            }
                        } catch (RepositoryException e) {
                            throw new TupleQueryResultHandlerException("error while adding triple to repository connection",e);
                        }
                    }
                },
                triples.getValueFactory());
View Full Code Here


        this.vars = vars;
        try {
            templatingService.process(SPARQLResultsHTMLWriter.class, START_TEMPLATE, data, new OutputStreamWriter(out));
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new TupleQueryResultHandlerException(e);
        }
  }
View Full Code Here

        data.put("result", result);
        try {
            templatingService.process(SPARQLResultsHTMLWriter.class, RESULT_TEMPLATE, data, new OutputStreamWriter(out));
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new TupleQueryResultHandlerException(e);
        }
  } 
View Full Code Here

    Map<String, Object> data = new HashMap<String, Object>();
        try {           
            templatingService.process(SPARQLResultsHTMLWriter.class, END_TEMPLATE, data, new OutputStreamWriter(out));
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new TupleQueryResultHandlerException(e);
        }
  } 
View Full Code Here

            openArray();

            firstTupleWritten = false;
        }
        catch (IOException e) {
            throw new TupleQueryResultHandlerException(e);
        }
    }
View Full Code Here

            closeBraces(); // results braces
            closeBraces(); // root braces
            writer.flush();
        }
        catch (IOException e) {
            throw new TupleQueryResultHandlerException(e);
        }
    }
View Full Code Here

            closeBraces(); // end solution

            writer.flush();
        }
        catch (IOException e) {
            throw new TupleQueryResultHandlerException(e);
        }
    }
View Full Code Here

            writer.write(", ");
            writeKeyValue("value", lit.getLabel());
        }
        else {
            throw new TupleQueryResultHandlerException("Unknown Value object type: " + value.getClass());
        }

        writer.write(" }");
    }
View Full Code Here

            XMLOutputter printer = new XMLOutputter(Format.getPrettyFormat());
            printer.output(output, writer);
            writer.flush();

        } catch (Exception ex) {
            throw new TupleQueryResultHandlerException("error while transforming XML results to HTML", ex);
        } finally {
            try {
                writer.close();
            } catch (IOException e) {}
        }
View Full Code Here

TOP

Related Classes of org.openrdf.query.TupleQueryResultHandlerException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.