org.openrdf.rio.RDFParseException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.openrdf.rio.RDFParseException.<init>方法的一些代码示例,展示了RDFParseException.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RDFParseException.<init>方法的具体详情如下:
包路径:org.openrdf.rio.RDFParseException
类名称:RDFParseException
方法名:<init>

RDFParseException.<init>介绍

[英]Creates a new ParseException.
[中]创建新的ParseException。

代码示例

代码示例来源:origin: blazegraph/database

private void throwEOFException()
  throws RDFParseException
{
  throw new RDFParseException("Unexpected end of file");
}

代码示例来源:origin: org.openrdf.sesame/sesame-rio-turtle

protected void throwEOFException()
  throws RDFParseException
{
  throw new RDFParseException("Unexpected end of file");
}

代码示例来源:origin: com.blazegraph/bigdata-core

private void throwEOFException()
  throws RDFParseException
{
  throw new RDFParseException("Unexpected end of file");
}

代码示例来源:origin: org.openrdf.sesame/sesame-rio-ntriples

protected void throwEOFException()
  throws RDFParseException
{
  throw new RDFParseException("Unexpected end of file");
}

代码示例来源:origin: org.openrdf.sesame/sesame-rio-rdfa

private void handleException()
  throws IOException, RDFHandlerException, RDFParseException
{
  if (exception != null) {
    try {
      throw exception;
    }
    catch (IOException e) {
      throw e;
    }
    catch (RDFHandlerException e) {
      throw e;
    }
    catch (RuntimeException e) {
      throw e;
    }
    catch (Exception e) {
      throw new RDFParseException(e);
    }
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-rio-api

/**
 * Reports a fatal error with associated line- and column number to the
 * registered ParseErrorListener, if any, and throws a
 * <tt>ParseException</tt> afterwards.
 * 
 * @since 2.7.1
 */
public static void reportFatalError(String msg, long lineNo, long columnNo, ParseErrorListener errListener)
  throws RDFParseException
{
  if (errListener != null) {
    errListener.fatalError(msg, lineNo, columnNo);
  }
  throw new RDFParseException(msg, lineNo, columnNo);
}

代码示例来源:origin: org.openrdf.sesame/sesame-rio-turtle

private char readLocalEscapedChar()
  throws RDFParseException, IOException
{
  int c = readCodePoint();
  if (TurtleUtil.isLocalEscapedChar(c)) {
    return (char)c;
  }
  else {
    throw new RDFParseException("found '" + new String(Character.toChars(c)) + "', expected one of: "
        + Arrays.toString(TurtleUtil.LOCAL_ESCAPED_CHARS));
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-rio-api

/**
 * Gets the namespace that is associated with the specified prefix or throws
 * an {@link RDFParseException}.
 * 
 * @throws RDFParseException
 *         if no namespace is associated with this prefix
 */
protected String getNamespace(String prefix)
  throws RDFParseException
{
  if (namespaceTable.containsKey(prefix))
    return namespaceTable.get(prefix);
  String msg = "Namespace prefix '" + prefix + "' used but not defined";
  if ("".equals(prefix)) {
    msg = "Default namespace used but not defined";
  }
  reportFatalError(msg);
  throw new RDFParseException(msg);
}

代码示例来源:origin: org.openrdf.sesame/sesame-rio-rdfa

private void await(final CountDownLatch latch)
  throws RDFParseException, IOException, RDFHandlerException
{
  try {
    latch.await();
  }
  catch (InterruptedException e) {
    handleException();
    throw new RDFParseException(e);
  }
  handleException();
}

代码示例来源:origin: blazegraph/database

@Override
public void parse(InputStream in, String baseURI) throws IOException,
    RDFParseException, RDFHandlerException {
  try {
    parser.parseQueryResult(in);
  } catch (QueryResultParseException e) {
    throw new RDFParseException(e);
  } catch (QueryResultHandlerException e) {
    throw new RDFHandlerException(e);
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-repository-sail

@Override
protected Resource parseImplicitBlank()
  throws IOException, RDFParseException, RDFHandlerException
{
  if (isAllowBlankNodes()) {
    return super.parseImplicitBlank();
  }
  else {
    throw new RDFParseException("blank nodes not allowed in data block");
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-repository-sail

@Override
protected BNode parseNodeID()
  throws IOException, RDFParseException
{
  if (isAllowBlankNodes()) {
    return super.parseNodeID();
  }
  else {
    throw new RDFParseException("blank nodes not allowed in data block");
  }
}

代码示例来源:origin: com.blazegraph/bigdata-core

@Override
public void parse(InputStream in, String baseURI) throws IOException,
    RDFParseException, RDFHandlerException {
  try {
    parser.parseQueryResult(in);
  } catch (QueryResultParseException e) {
    throw new RDFParseException(e);
  } catch (QueryResultHandlerException e) {
    throw new RDFHandlerException(e);
  }
}

代码示例来源:origin: org.semarglproject/semargl-sesame

@Override
public void parse(Reader reader, String baseURI) throws RDFParseException, RDFHandlerException {
  refreshSettings();
  try {
    streamProcessor.process(reader, baseURI);
  } catch (ParseException e) {
    throw new RDFParseException(e);
  }
}

代码示例来源:origin: org.openrdf.sesame/sesame-rio-rdfa

private void parse(StreamSource source, String baseURI)
  throws IOException, RDFParseException, RDFHandlerException
{
  CountDownLatch latch = new CountDownLatch(1);
  PipedInputStream pipe = new PipedInputStream();
  PipedOutputStream out = new PipedOutputStream(pipe);
  try {
    parse(pipe, baseURI, latch);
    transformer.transform(source, new StreamResult(out));
  }
  catch (TransformerException e) {
    handleException();
    throw new RDFParseException(e);
  }
  finally {
    out.close();
  }
  await(latch);
}

代码示例来源:origin: com.github.jsonld-java/jsonld-java-sesame

@Override
public void parse(final Reader reader, final String baseURI) throws IOException,
    RDFParseException, RDFHandlerException {
  final SesameTripleCallback callback = new SesameTripleCallback(getRDFHandler(),
      valueFactory, getParserConfig(), getParseErrorListener());
  final JsonLdOptions options = new JsonLdOptions(baseURI);
  options.useNamespaces = true;
  try {
    JsonLdProcessor.toRDF(JsonUtils.fromReader(reader), callback, options);
  } catch (final JsonLdError e) {
    throw new RDFParseException("Could not parse JSONLD", e);
  } catch (final JsonParseException e) {
    throw new RDFParseException("Could not parse JSONLD", e);
  } catch (final RuntimeException e) {
    if (e.getCause() != null && e.getCause() instanceof RDFParseException) {
      throw (RDFParseException) e.getCause();
    }
    throw e;
  }
}

代码示例来源:origin: com.github.jsonld-java/jsonld-java-sesame

@Override
public void parse(final InputStream in, final String baseURI) throws IOException,
    RDFParseException, RDFHandlerException {
  final SesameTripleCallback callback = new SesameTripleCallback(getRDFHandler(),
      valueFactory, getParserConfig(), getParseErrorListener());
  final JsonLdOptions options = new JsonLdOptions(baseURI);
  options.useNamespaces = true;
  try {
    JsonLdProcessor.toRDF(JsonUtils.fromInputStream(in), callback, options);
  } catch (final JsonLdError e) {
    throw new RDFParseException("Could not parse JSONLD", e);
  } catch (final JsonParseException e) {
    throw new RDFParseException("Could not parse JSONLD", e);
  } catch (final RuntimeException e) {
    if (e.getCause() != null && e.getCause() instanceof RDFParseException) {
      throw (RDFParseException) e.getCause();
    }
    throw e;
  }
}

代码示例来源:origin: apache/marmotta

/**
 * Parses the data from the supplied Reader, using the supplied baseURI to
 * resolve any relative URI references.
 *
 * @param reader  The Reader from which to read the data.
 * @param baseURI The URI associated with the data in the InputStream.
 * @throws java.io.IOException If an I/O error occurred while data was read from the InputStream.
 * @throws org.openrdf.rio.RDFParseException
 *                             If the parser has found an unrecoverable parse error.
 * @throws org.openrdf.rio.RDFHandlerException
 *                             If the configured statement handler has encountered an
 *                             unrecoverable error.
 */
@Override
public void parse(Reader reader, String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  Preconditions.checkNotNull(baseURI);
  setBaseURI(baseURI);
  try {
    parseCalendar(new CalendarBuilder().build(reader));
  } catch (ParserException e) {
    throw new RDFParseException(e);
  }
}

代码示例来源:origin: net.fortytwo.sesametools/rdfjson

public void parse(final Reader reader,
         final String baseURI) throws IOException, RDFParseException, RDFHandlerException {
  if (null == rdfHandler) {
    throw new IllegalStateException("RDF handler has not been set");
  }
  String s = toString(reader);
  Collection<Statement> g = RDFJSON.rdfJsonToGraph(s);
  
  if(g == null) {
    throw new RDFParseException("Could not parse JSON RDF Graph");
  }
  
  rdfHandler.startRDF();
  for (Statement statement : g) {
    rdfHandler.handleStatement(statement);
  }
  rdfHandler.endRDF();
}

代码示例来源:origin: eu.fbk.rdfpro/rdfpro-jsonld

@Override
public void parse(final Reader reader, final String baseURI) throws IOException,
    RDFParseException, RDFHandlerException {
  final QuadSink sink = new SesameSink(this.rdfHandler, this.valueFactory);
  try {
    final CharSink parser = JsonLdParser.connect(sink);
    parser.startStream();
    final char[] buffer = new char[4096];
    while (true) {
      final int length = reader.read(buffer);
      if (length < 0) {
        break;
      }
      parser.process(buffer, 0, length);
    }
    parser.endStream();
  } catch (final ParseException ex) {
    throw new RDFParseException(ex.getMessage(), ex);
  }
}

相关文章