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()); }
private UpdateClause clear() throws IOException { // CLEAR [ GRAPH <uri> ] skipWhitespace(); nextChar(); if (ch > -1 && ch < 65535) { // FIXME skipWhileIn(GRAPH, WS); UID uid = uri(); return new UpdateClause(prefixes, UpdateClause.Type.CLEAR, uid); } else { return new UpdateClause(prefixes, UpdateClause.Type.CLEAR); } }
skipWhitespace(); if (start.equals("CLEAR")) { return 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; }
private UpdateClause modify() throws IOException { // MODIFY [ <uri> ]* DELETE { template } INSERT { template } [ WHERE { // pattern } ] UpdateClause modify = new UpdateClause(prefixes, UpdateClause.Type.MODIFY); nextChar(); while (in(LT)) { pushback(); modify.addInto(uri()); skipWhitespace(); nextChar(); } skipWhileIn(DELETE, WS); modify.setDelete(block()); skipWhileIn(INSERT, WS); modify.setInsert(block()); skipWhitespace(); nextChar(); if (ch > -1 && ch < 65535) { // FIXME skipWhileIn(WHERE, WS); modify.setPattern(block()); } return modify; }