@Test public void isInsert_false_notAnUpdate() throws Exception { final String sparql = "SELECT * WHERE { ?a ?b ?c . }"; assertFalse( QueryInvestigator.isInsertWhere(sparql) ); }
public static boolean isInsertWhere(final String sparql) throws MalformedQueryException { requireNonNull(sparql); try { PARSER.parseUpdate(sparql, null); return Pattern.matches("[\\s\\S]*?insert\\s*?\\{[\\s\\S]*?\\}[\\s\\S]*?where\\s*\\{[\\s\\S]*?\\}", sparql.toLowerCase()); } catch(final MalformedQueryException updateE) { try { PARSER.parseQuery(sparql, null); return false; } catch(final MalformedQueryException queryE) { throw updateE; } } }
QueryInvestigator { public static boolean isInsertWhere(final String sparql) throws MalformedQueryException { requireNonNull(sparql); try { PARSER.parseUpdate(sparql, null); return Pattern.matches("[\\s\\S]*?insert\\s*?\\{[\\s\\S]*?\\}[\\s\\S]*?where\\s*\\{[\\s\\S]*?\\}", sparql.toLowerCase()); } catch(final MalformedQueryException updateE) { try { PARSER.parseQuery(sparql, null); return false; } catch(final MalformedQueryException queryE) { throw updateE; } } } }
QueryInvestigator { public static boolean isInsertWhere(final String sparql) throws MalformedQueryException { requireNonNull(sparql); try { PARSER.parseUpdate(sparql, null); return Pattern.matches("[\\s\\S]*?insert\\s*?\\{[\\s\\S]*?\\}[\\s\\S]*?where\\s*\\{[\\s\\S]*?\\}", sparql.toLowerCase()); } catch(final MalformedQueryException updateE) { try { PARSER.parseQuery(sparql, null); return false; } catch(final MalformedQueryException queryE) { throw updateE; } } } private  QueryInvestigator(); }
QueryInvestigator { public static boolean isInsertWhere(final String sparql) throws MalformedQueryException { requireNonNull(sparql); try { PARSER.parseUpdate(sparql, null); return Pattern.matches("[\\s\\S]*?insert\\s*?\\{[\\s\\S]*?\\}[\\s\\S]*?where\\s*\\{[\\s\\S]*?\\}", sparql.toLowerCase()); } catch(final MalformedQueryException updateE) { try { PARSER.parseQuery(sparql, null); return false; } catch(final MalformedQueryException queryE) { throw updateE; } } } private  QueryInvestigator(); static boolean isConstruct(final String sparql); static boolean isInsertWhere(final String sparql); }
QueryInvestigator { public static boolean isInsertWhere(final String sparql) throws MalformedQueryException { requireNonNull(sparql); try { PARSER.parseUpdate(sparql, null); return Pattern.matches("[\\s\\S]*?insert\\s*?\\{[\\s\\S]*?\\}[\\s\\S]*?where\\s*\\{[\\s\\S]*?\\}", sparql.toLowerCase()); } catch(final MalformedQueryException updateE) { try { PARSER.parseQuery(sparql, null); return false; } catch(final MalformedQueryException queryE) { throw updateE; } } } private  QueryInvestigator(); static boolean isConstruct(final String sparql); static boolean isInsertWhere(final String sparql);  }