/** * Returns a new instance of NQuadsParser. */ public RDFParser getParser() { return new NQuadsParser(); } }
/** * Returns a new instance of {@link NQuadsWriter}. */ @Override public RDFWriter getWriter(OutputStream out) { return new NQuadsWriter(out); }
@Override public RDFWriter getWriter(Writer writer, String baseURI) { return getWriter(writer); } }
c = parseSubject(c); c = skipWhitespace(c); c = parsePredicate(c); c = skipWhitespace(c); c = parseObject(c); c = skipWhitespace(c); c = parseContext(c); c = skipWhitespace(c); throwEOFException(); reportFatalError("Expected '.', found: " + new String(Character.toChars(c))); c = assertLineTerminates(c); if (getParserConfig().isNonFatalError(NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES)) { reportError(rdfpe, NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES); ignoredAnError = true; c = skipLine(c); Statement st = createStatement(subject, predicate, object, context); if (rdfHandler != null) {
protected int parseContext(int c) throws IOException, RDFParseException { StringBuilder sb = new StringBuilder(100); // subject is either an uriref (<foo://bar>) or a nodeID (_:node1) if (c == '<') { // subject is an uriref c = parseUriRef(c, sb); context = createURI(sb.toString()); } else if (c == '_') { // subject is a bNode c = parseNodeID(c, sb); context = createNode(sb.toString()); } else if (c == -1) { throwEOFException(); } else { reportFatalError("Expected '<' or '_', found: " + new String(Character.toChars(c))); } return c; }
throws IOException, RDFParseException, RDFHandlerException clear(); lineNo = 1; reportLocation(lineNo, 1); int c = readCodePoint(); c = skipWhitespace(c); c = skipLine(c); c = skipLine(c); c = parseQuad(c); c = skipWhitespace(c); clear();
@Override public synchronized void parse(final InputStream inputStream, final String baseURI) throws IOException, RDFParseException, RDFHandlerException { if (inputStream == null) { throw new IllegalArgumentException("Input stream can not be 'null'"); } // Note: baseURI will be checked in parse(Reader, String) try { parse(new InputStreamReader(new BOMInputStream(inputStream, false), StandardCharsets.UTF_8), baseURI); } catch (UnsupportedEncodingException e) { // Every platform should support the UTF-8 encoding... throw new RuntimeException(e); } }
writeValue(st.getSubject()); writer.write(" "); writeValue(st.getPredicate()); writer.write(" "); writeValue(st.getObject()); writeValue(st.getContext());
@Override public RDFParser setRDFHandler(RDFHandler handler) { if (handler instanceof TimRdfHandler) { // It might be nicer to override statement, to make it contain the action, but it takes to much effort for now. ((TimRdfHandler) handler).registerActionSupplier(() -> actions.pop()); } return super.setRDFHandler(handler); }
protected int parseContext(int c) throws IOException, RDFParseException { StringBuilder sb = new StringBuilder(100); // subject is either an uriref (<foo://bar>) or a nodeID (_:node1) if (c == '<') { // subject is an uriref c = parseUriRef(c, sb); context = createURI(sb.toString()); } else if (c == '_') { // subject is a bNode c = parseNodeID(c, sb); context = createNode(sb.toString()); } else if (c == -1) { throwEOFException(); } else { reportFatalError("Expected '<' or '_', found: " + new String(Character.toChars(c))); } return c; }
throws IOException, RDFParseException, RDFHandlerException clear(); lineNo = 1; reportLocation(lineNo, 1); int c = readCodePoint(); c = skipWhitespace(c); c = skipLine(c); c = skipLine(c); c = parseQuad(c); c = skipWhitespace(c); clear();
/** * Returns a new instance of {@link NQuadsWriter}. */ @Override public RDFWriter getWriter(Writer writer) { return new NQuadsWriter(writer); }
public RDFWriter getWriter(Writer writer, String baseURI) { return getWriter(writer); } }
/** * Returns a new instance of NQuadsParser. */ @Override public RDFParser getParser() { return new NQuadsParser(); } }
@Override public synchronized void parse(final InputStream inputStream, final String baseURI) throws IOException, RDFParseException, RDFHandlerException { if (inputStream == null) { throw new IllegalArgumentException("Input stream can not be 'null'"); } // Note: baseURI will be checked in parse(Reader, String) try { parse(new InputStreamReader(new BOMInputStream(inputStream, false), StandardCharsets.UTF_8), baseURI); } catch (UnsupportedEncodingException e) { // Every platform should support the UTF-8 encoding... throw new RuntimeException(e); } }
writeValue(st.getSubject()); writer.write(" "); writeValue(st.getPredicate()); writer.write(" "); writeValue(st.getObject()); writeValue(st.getContext());
/** * Returns a new instance of {@link NQuadsWriter}. */ public RDFWriter getWriter(OutputStream out) { return new NQuadsWriter(out); }
@Override public RDFWriter getWriter(OutputStream out, String baseURI) { return getWriter(out); }
/** * Returns a new instance of {@link NQuadsWriter}. */ public RDFWriter getWriter(Writer writer) { return new NQuadsWriter(writer); }
public RDFWriter getWriter(OutputStream out, String baseURI) { return getWriter(out); }