/** Create an {@link RDFParserBuilder}. * <p> * Often used in a pattern such as: * <pre> * RDFParser.create() * .source("data.ttl") * .parse(graph); * </pre> * */ public static RDFParserBuilder create() { return RDFParserBuilder.create(); }
/** * Create an {@link RDFParserBuilder} and set the source to the * {@link Path}. * <p> * This is a shortcut for {@code RDFParser.create().source(path)}. * * @param path * @return this */ public static RDFParserBuilder source(Path path) { return RDFParserBuilder.create().source(path); }
/** * Create an {@link RDFParserBuilder} and set the source to the URI, which * can be a filename. * <p> * This is a shortcut for {@code RDFParser.create().source(uriOrFile)}. * * @param uriOrFile * @return this */ public static RDFParserBuilder source(String uriOrFile) { return RDFParserBuilder.create().source(uriOrFile); }
/** * Create an {@link RDFParserBuilder} and set content to parse to be the * given string. The syntax must be set with {@code .lang(...)}. * <p> * Shortcut for {@code RDFParser.create.fromString(string)}. * @param string * @return this */ public static RDFParserBuilder fromString(String string) { return RDFParserBuilder.create().fromString(string); }
/** * Create an {@link RDFParserBuilder} and set the source to {@link InputStream}. * The {@link InputStream} will be closed when the * parser is called and the parser can not be reused. * The syntax must be set with {@code .lang(...)}. * <p> * This is a shortcut for {@code RDFParser.create().source(input)}. * @param input * @return this */ public static RDFParserBuilder source(InputStream input) { return RDFParserBuilder.create().source(input); }
private RDFParserBuilder builder() { InputStream input = new ByteArrayInputStream(testdata.getBytes(StandardCharsets.UTF_8)); return RDFParserBuilder.create().lang(Lang.TTL).source(input); }
@Test public void source_not_uri_01() { Graph graph = GraphFactory.createGraphMem(); RDFParserBuilder.create().lang(Lang.TTL).fromString(testdata).parse(graph); assertEquals(1, graph.size()); }