SPARQLUpdateDataBlockParser extends TriGStarParser { @Override protected void parseGraph() throws RDFParseException, RDFHandlerException, IOException { int c = readCodePoint(); int c2 = peekCodePoint(); Resource contextOrSubject = null; boolean foundContextOrSubject = false; if (c == '[') { skipWSC(); c2 = readCodePoint(); if (c2 == ']') { contextOrSubject = createNode(); foundContextOrSubject = true; skipWSC(); } else { unread(c2); unread(c); } c = readCodePoint(); } else if (c == '<' || TurtleUtil.isPrefixStartChar(c) || (c == ':' && c2 != '-') || (c == '_' && c2 == ':')) { unread(c); Value value = parseValue(); if (value instanceof Resource) { contextOrSubject = (Resource) value; foundContextOrSubject = true; } else { reportFatalError("Illegal graph name: " + value); } skipWSC(); c = readCodePoint(); } else { setContext(null); } if (c == '{') { setContext(contextOrSubject); c = skipWSC(); if (c != '}') { parseTriples(); c = skipWSC(); while (c == '.') { readCodePoint(); c = skipWSC(); if (c == '}') { break; } parseTriples(); c = skipWSC(); } verifyCharacterOrFail(c, "}"); } } else { setContext(null); if (foundContextOrSubject) { subject = contextOrSubject; unread(c); parsePredicateObjectList(); } else { unread(c); parseTriples(); } } c = peekCodePoint(); if (c == '.' || c == '}') { readCodePoint(); } skipOptionalPeriod(); } SPARQLUpdateDataBlockParser();  SPARQLUpdateDataBlockParser(ValueFactory valueFactory); @Override RDFFormat getRDFFormat(); boolean isAllowBlankNodes(); void setAllowBlankNodes(boolean allowBlankNodes); void setLineNumberOffset(int lineNumberOffset);  }
@Test public void testParseGraph() throws RDFParseException, RDFHandlerException, IOException { SPARQLUpdateDataBlockParser parser = new SPARQLUpdateDataBlockParser(); String blocksToCheck[] = new String[] { "graph <u:g1> {<u:1> <p:1> 1 } . <u:2> <p:2> 2.", "graph <u:g1> {<u:1> <p:1> 1 .} . <u:2> <p:2> 2." }; for (String block : blocksToCheck) { parser.parse(new StringReader(block), "http: } }