private List<UID> collectUIDs(CharSet cs) throws IOException { List<UID> uids = new ArrayList<UID>(); String token = null; do { skipWhitespace(); token = collectWhileIn(cs); skipWhitespace(); if (!token.isEmpty()) { UID uid = uri(); uids.add(uid); } } while (!token.isEmpty()); return uids; }
private UpdateClause drop() throws IOException { // DROP [ SILENT ] GRAPH <uri> String token = collectWhileIn(SILENT); skipWhitespace(); skipWhileIn(GRAPH); skipWhitespace(); UID uid = uri(); return new UpdateClause(prefixes, UpdateClause.Type.DROP, uid, !token.isEmpty()); }
private UpdateClause create() throws IOException { // CREATE [ SILENT ] GRAPH <uri> String token = collectWhileIn(SILENT); skipWhitespace(); skipWhileIn(GRAPH); skipWhitespace(); UID uid = uri(); return new UpdateClause(prefixes, UpdateClause.Type.CREATE, uid, !token.isEmpty()); }
while (nextChar().in(P)) { skipWhileIn(PREFIX, WS); String prefix = collectWhileIn(WORD); skipWhileIn(COLON, WS); UID ns = uri(); String start = collectWhileIn(ALPHA); skipWhitespace(); if (start.equals("CLEAR")) {
private UpdateClause delete() throws IOException { // DELETE DATA [ FROM <uri> ]* { triples } // DELETE [ FROM <uri> ]* { template } [ WHERE { pattern } ] String token = collectWhileIn(DATA, FROM); UpdateClause delete = new UpdateClause(prefixes, UpdateClause.Type.DELETE); if (token.equals("DATA")) { delete.addFrom(from()); delete.setTemplate(block()); } else { if (token.equals("FROM")) { skipWhitespace(); delete.addFrom(uri()); delete.addFrom(from()); skipWhitespace(); } delete.setTemplate(block()); skipWhileIn(WS, WHERE); delete.setPattern(block()); } return delete; }
private UpdateClause insert() throws IOException { // INSERT DATA [ INTO <uri> ]* { triples } // INSERT [ INTO <uri> ]* { template } [ WHERE { pattern } ] String token = collectWhileIn(DATA, INTO); UpdateClause insert = new UpdateClause(prefixes, UpdateClause.Type.INSERT); if (token.equals("DATA")) { insert.addInto(into()); insert.setTemplate(block()); } else { if (token.equals("INTO")) { skipWhitespace(); insert.addInto(uri()); insert.addInto(into()); skipWhitespace(); } insert.setTemplate(block()); skipWhileIn(WS); if (nextChar().in(WHERE)) { skipWhileIn(WS, WHERE); insert.setPattern(block()); } } return insert; }