Package org.openrdf.rio

Examples of org.openrdf.rio.RDFHandlerException


                    }
                } else {
                    c.addStatement(s.getSubject(), s.getPredicate(), s.getObject(), s.getContext());
                }
            } catch (SailException e) {
                throw new RDFHandlerException(e);
            }
        }
View Full Code Here


        public void endRDF() throws RDFHandlerException {
            try {
                c.commit();
                c.begin();
            } catch (SailException e) {
                throw new RDFHandlerException(e);
            }
        }
View Full Code Here

        public void handleNamespace(String prefix, String uri) throws RDFHandlerException {
            try {
                c.setNamespace(prefix, uri);
            } catch (SailException e) {
                throw new RDFHandlerException(e);
            }

            incrementCount();
        }
View Full Code Here

        public void handleStatement(Statement statement) throws RDFHandlerException {
            try {
                c.addStatement(statement.getSubject(), statement.getPredicate(), statement.getObject(), statement.getContext());
            } catch (SailException e) {
                throw new RDFHandlerException(e);
            }

            incrementCount();
        }
View Full Code Here

                    if (verbose && 0 == count % loggingBufferSize) {
                        LOGGER.info("" + System.currentTimeMillis() + "\t" + count);
                    }
                } catch (SailException e) {
                    throw new RDFHandlerException(e);
                }
            }
        }
View Full Code Here

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

        currentContext = context;
        inActiveContext = true;
      }
    }
    catch (IOException e) {
      throw new RDFHandlerException(e);
    }

    super.handleStatement(st);
  }
View Full Code Here

  public void startRDF()
    throws RDFHandlerException
  {
    if (writingStarted) {
      throw new RDFHandlerException("Document writing has already started");
    }

    try {
      xmlWriter.startDocument();

      xmlWriter.setAttribute("xmlns", NAMESPACE);
      xmlWriter.startTag(ROOT_TAG);
    }
    catch (IOException e) {
      throw new RDFHandlerException(e);
    }
    finally {
      writingStarted = true;
    }
  }
View Full Code Here

  public void endRDF()
    throws RDFHandlerException
  {
    if (!writingStarted) {
      throw new RDFHandlerException("Document writing has not yet started");
    }

    try {
      if (inActiveContext) {
        xmlWriter.endTag(CONTEXT_TAG);
        inActiveContext = false;
        currentContext = null;
      }
      xmlWriter.endTag(ROOT_TAG);
      xmlWriter.endDocument();
    }
    catch (IOException e) {
      throw new RDFHandlerException(e);
    }
    finally {
      writingStarted = false;
    }
  }
View Full Code Here

  public void handleStatement(Statement st)
    throws RDFHandlerException
  {
    if (!writingStarted) {
      throw new RDFHandlerException("Document writing has not yet been started");
    }

    try {
      Resource context = st.getContext();

      if (inActiveContext && !contextsEquals(context, currentContext)) {
        // Close currently active context
        xmlWriter.endTag(CONTEXT_TAG);
        inActiveContext = false;
      }

      if (!inActiveContext) {
        // Open new context
        xmlWriter.startTag(CONTEXT_TAG);

        if (context != null) {
          writeValue(context);
        }

        currentContext = context;
        inActiveContext = true;
      }

      xmlWriter.startTag(TRIPLE_TAG);

      writeValue(st.getSubject());
      writeValue(st.getPredicate());
      writeValue(st.getObject());

      xmlWriter.endTag(TRIPLE_TAG);
    }
    catch (IOException e) {
      throw new RDFHandlerException(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.