Package org.openrdf.rio

Examples of org.openrdf.rio.RDFHandlerException


            } else {
                JsonUtils.write(writer, output);
            }

        } catch (final JsonLdError e) {
            throw new RDFHandlerException("Could not render JSONLD", e);
        } catch (final JsonGenerationException e) {
            throw new RDFHandlerException("Could not render JSONLD", e);
        } catch (final JsonMappingException e) {
            throw new RDFHandlerException("Could not render JSONLD", e);
        } catch (final IOException e) {
            throw new RDFHandlerException("Could not render JSONLD", e);
        }
    }
View Full Code Here


        public void endRDF() throws RDFHandlerException {
          try {
            flushDelayAdd();
          }
          catch (RepositoryException e) {
            throw new RDFHandlerException("Problem executing query: ", e);
          }
        }

        public void handleNamespace(String prefix, String name) throws RDFHandlerException {
          String query = "DB.DBA.XML_SET_NS_DECL(?, ?, 1)";
          try {
            PreparedStatement psn = prepareStatement(query);
            psn.setString(1, prefix);
            psn.setString(2, name);
            psn.execute();
            psn.close();
          }
          catch (SQLException e) {
            throw new RDFHandlerException("Problem executing query: " + query, e);
          }
        }

        public void handleStatement(Statement st) throws RDFHandlerException {
           try {
          Resource[] hcontexts;
          if (st.getContext() != null && useStatementContext) {
            hcontexts = new Resource[] {st.getContext()};
          } else {
            hcontexts = _contexts;
          }
                addToQuadStore(st.getSubject(), st.getPredicate(), st.getObject(), hcontexts);
          
           catch(Exception e) {
             throw new RDFHandlerException(e);
           }
        }
      });
      parser.parse(reader, baseURI); // parse out each tripled to be handled by the handler above
    }
View Full Code Here

        public void startRDF() throws RDFHandlerException {
          if (ps == null)
            try {
                    ps = prepareStatement(VirtuosoRepositoryConnection.S_INSERT);
                  } catch (java.sql.SQLException e) {
              throw new RDFHandlerException("Problem PrepareStatement: ", e);
                  }
        }


        public void endRDF() throws RDFHandlerException {
          try {
            if (count > 0) {
              ps.executeBatch();
              ps.clearBatch();
              count = 0;
            }
            if (ps != null) {
              ps.close();
              ps = null;
            }
          }
          catch (SQLException e) {
            throw new RDFHandlerException("Problem executing query: ", e);
          }
        }

        public void handleNamespace(String prefix, String name) throws RDFHandlerException {
          String query = "DB.DBA.XML_SET_NS_DECL(?, ?, 1)";
          try {
            PreparedStatement psn = prepareStatement(query);
            psn.setString(1, prefix);
            psn.setString(2, name);
            psn.execute();
            psn.close();
          }
          catch (SQLException e) {
            throw new RDFHandlerException("Problem executing query: " + query, e);
          }
        }

        public void handleStatement(Statement st) throws RDFHandlerException {
           try {
          Resource[] hcontexts;
          if (st.getContext() != null && useStatementContext) {
            hcontexts = new Resource[] {st.getContext()};
          } else {
            hcontexts = _contexts;
          }
          for (int i = 0; i < hcontexts.length; i++) {
            ps.setString(1, hcontexts[i].stringValue());
            bindResource(ps, 2, st.getSubject());
            bindURI(ps, 3, st.getPredicate());
            bindValue(ps, 4, st.getObject());
            ps.addBatch();
            count++;
          }
          if (count > BATCH_SIZE) {
            ps.executeBatch();
            ps.clearBatch();
            count = 0;
          }
           } 
           catch(Exception e) {
             throw new RDFHandlerException(e);
           }
        }
      };

      parser.setRDFHandler(rdfInserter);
View Full Code Here

            } else {
                JSONUtils.write(writer, output);
            }

        } catch (final JsonLdError e) {
            throw new RDFHandlerException("Could not render JSONLD", e);
        } catch (final JsonGenerationException e) {
            throw new RDFHandlerException("Could not render JSONLD", e);
        } catch (final JsonMappingException e) {
            throw new RDFHandlerException("Could not render JSONLD", e);
        } catch (final IOException e) {
            throw new RDFHandlerException("Could not render JSONLD", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.openrdf.rio.RDFHandlerException

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.