protected void throwEOFException() throws RDFParseException { throw new RDFParseException("Unexpected end of file"); }
protected void throwEOFException() throws RDFParseException { throw new RDFParseException("Unexpected end of file"); }
protected void throwEOFException() throws RDFParseException { throw new RDFParseException("Unexpected end of file"); }
protected void throwEOFException() throws RDFParseException { throw new RDFParseException("Unexpected end of file"); }
/** * Reports a fatal error with associated line- and column number to the registered ParseErrorListener, if * any, and throws a <tt>ParseException</tt> afterwards. */ 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); }
/** * Reports a fatal error with associated line- and column number to the registered ParseErrorListener, if * any, and throws a <tt>ParseException</tt> afterwards. */ 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); }
/** * Reports a fatal error with associated line- and column number to the registered ParseErrorListener, if * any, and throws a <tt>ParseException</tt> afterwards. */ 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); }
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)); } }
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)); } }
/** * 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); }
/** * 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); }
/** * 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); }
@Override protected Resource parseNodeID() throws IOException, RDFParseException { if (isAllowBlankNodes()) { return super.parseNodeID(); } else { throw new RDFParseException("blank nodes not allowed in data block"); } }
@Override public void parse(Reader reader, String baseURI) throws RDFParseException, RDFHandlerException { refreshSettings(); try { streamProcessor.process(reader, baseURI); } catch (ParseException e) { throw new RDFParseException(e); } }
@Override protected Resource parseImplicitBlank() throws IOException, RDFParseException, RDFHandlerException { if (isAllowBlankNodes()) { return super.parseImplicitBlank(); } else { throw new RDFParseException("blank nodes not allowed in data block"); } }
protected int parsePredicate(int c) throws IOException, RDFParseException { StringBuilder sb = new StringBuilder(100); // predicate must be an uriref (<foo://bar>) if (c == '<') { // predicate is an uriref c = parseUriRef(c, sb); predicate = createURI(sb.toString()); } else if (c == -1) { throwEOFException(); } else { throw new RDFParseException("Expected '<', found: " + new String(Character.toChars(c)), lineNo, c); } return c; }
protected int parsePredicate(int c) throws IOException, RDFParseException { StringBuilder sb = new StringBuilder(100); // predicate must be an uriref (<foo://bar>) if (c == '<') { // predicate is an uriref c = parseUriRef(c, sb); predicate = createURI(sb.toString()); } else if (c == -1) { throwEOFException(); } else { throw new RDFParseException("Expected '<', found: " + new String(Character.toChars(c)), lineNo, c); } return c; }
/** * send an RDFTransaction, including attributes. * * @param rdftransaction a stream in application/x-rdftransaction format * @param attributes a JSONObject of attribute bindings that will be added * to each triple imported from `rdftransaction'. * @throws RepositoryException if there is an error during the request * @throws RDFParseException if malformed data is encountered * @throws IOException on errors reading from the <code>rdftransaction</code> stream */ public void sendRDFTransaction(InputStream rdftransaction, JSONObject attributes) throws RepositoryException, RDFParseException, IOException { try { prepareHttpRepoClient().sendRDFTransaction(rdftransaction, attributes); } catch (AGMalformedDataException e) { throw new RDFParseException(e); } }
protected Literal createLiteral(String label, String lang, String datatype) throws RDFParseException { try { label = NTriplesUtil.unescapeString(label); } catch (IllegalArgumentException e) { throw new RDFParseException(e, lineNo, -1); } if (lang.length() == 0) { lang = null; } if (datatype.length() == 0) { datatype = null; } IRI dtURI = null; if (datatype != null) { dtURI = createURI(datatype); } return super.createLiteral(label, lang, dtURI, lineNo, -1); }
protected Literal createLiteral(String label, String lang, String datatype) throws RDFParseException { try { label = NTriplesUtil.unescapeString(label); } catch (IllegalArgumentException e) { throw new RDFParseException(e, lineNo, -1); } if (lang.length() == 0) { lang = null; } if (datatype.length() == 0) { datatype = null; } IRI dtURI = null; if (datatype != null) { dtURI = createURI(datatype); } return super.createLiteral(label, lang, dtURI, lineNo, -1); }