/** * Projection of an ungrouped variable (not appearing in the GROUP BY * expression) */ public void test_agg09() throws MalformedQueryException { final String query = "PREFIX : <http://www.example.org/>\n" + "SELECT ?P (COUNT(?O) AS ?C)\n" + "WHERE { ?S ?P ?O } GROUP BY ?S"; negativeTest(query); }
/** * Use of an ungrouped variable in a project expression, where the variable * appears in a GROUP BY expression */ public void test_agg12() throws MalformedQueryException { final String query = "PREFIX : <http://www.example.org/>\n"+ "SELECT ?O1 (COUNT(?O2) AS ?C)\n"+ "WHERE { ?S :p ?O1; :q ?O2 } GROUP BY (?O1 + ?O2)"; negativeTest(query); }
/** Too many separators (in UPDATE request) */ public void test_syntax_update_bad_08() throws MalformedQueryException { final String query = "CREATE GRAPH <:g> ;; LOAD <:remote> into GRAPH <:g>"; negativeTest(query); }
/** grouping by expression, done wrong */ public void test_agg08() throws MalformedQueryException { final String query = "PREFIX : <http://www.example.org/>\n" + "SELECT ((?O1 + ?O2) AS ?O12) (COUNT(?O1) AS ?C)\n" + "WHERE { ?S :p ?O1; :q ?O2 } GROUP BY (?O1 + ?O2)\n" + "ORDER BY ?O12"; negativeTest(query); }
/** * Use of an ungrouped variable in a project expression */ public void test_agg11() throws MalformedQueryException { final String query = "PREFIX : <http://www.example.org/>\n" + "SELECT ((?O1 + ?O2) AS ?O12) (COUNT(?O1) AS ?C)\n" + "WHERE { ?S :p ?O1; :q ?O2 } GROUP BY (?S)"; negativeTest(query); }
/** BNode in DELETE WHERE */ public void test_syntax_update_bad_10() throws MalformedQueryException { final String query = "DELETE WHERE { _:a <:p> <:o> }"; negativeTest(query); }
/** * Same variable can not be projected more than once. */ public void test_syn_bad_03() throws MalformedQueryException { final String query = "SELECT (1 AS ?X) (1 AS ?X) {}"; negativeTest(query); }
/** * Variable in DELETE DATA's data. */ public void test_syntax_update_bad_03() throws MalformedQueryException { final String query = "DELETE DATA { ?s <:p> <:o> }"; negativeTest(query); }
/** Variable in INSERT DATA's data. */ public void test_syntax_update_bad_04() throws MalformedQueryException { final String query = "INSERT DATA { GRAPH ?g {<:s> <:p> <:o> } }"; negativeTest(query); }
/** * Use of an ungrouped variable in a project expression, where the variable * appears in a GROUP BY expression */ public void test_agg12() throws MalformedQueryException { final String query = "PREFIX : <http://www.example.org/>\n"+ "SELECT ?O1 (COUNT(?O2) AS ?C)\n"+ "WHERE { ?S :p ?O1; :q ?O2 } GROUP BY (?O1 + ?O2)"; negativeTest(query); }
/** Too many separators (in UPDATE request) */ public void test_syntax_update_bad_08() throws MalformedQueryException { final String query = "CREATE GRAPH <:g> ;; LOAD <:remote> into GRAPH <:g>"; negativeTest(query); }
/** BNode in DELETE WHERE */ public void test_syntax_update_bad_10() throws MalformedQueryException { final String query = "DELETE WHERE { _:a <:p> <:o> }"; negativeTest(query); }
/** * Projection of an ungrouped variable (not appearing in the GROUP BY * expression) */ public void test_agg09() throws MalformedQueryException { final String query = "PREFIX : <http://www.example.org/>\n" + "SELECT ?P (COUNT(?O) AS ?C)\n" + "WHERE { ?S ?P ?O } GROUP BY ?S"; negativeTest(query); }
/** Variable in INSERT DATA's data. */ public void test_syntax_update_bad_04() throws MalformedQueryException { final String query = "INSERT DATA { GRAPH ?g {<:s> <:p> <:o> } }"; negativeTest(query); }
/** Too many separators (in UPDATE request) */ public void test_syntax_update_bad_09() throws MalformedQueryException { final String query = "CREATE GRAPH <:g> ; LOAD <:remote> into GRAPH <:g> ;;"; negativeTest(query); }
/** grouping by expression, done wrong */ public void test_agg08() throws MalformedQueryException { final String query = "PREFIX : <http://www.example.org/>\n" + "SELECT ((?O1 + ?O2) AS ?O12) (COUNT(?O1) AS ?C)\n" + "WHERE { ?S :p ?O1; :q ?O2 } GROUP BY (?O1 + ?O2)\n" + "ORDER BY ?O12"; negativeTest(query); }
/** * Same variable can not be projected more than once. */ public void test_syn_bad_03() throws MalformedQueryException { final String query = "SELECT (1 AS ?X) (1 AS ?X) {}"; negativeTest(query); }
/** * Projection of an ungrouped variable (no GROUP BY expression at all) */ public void test_agg10() throws MalformedQueryException { final String query = "PREFIX : <http://www.example.org/>\n" + "SELECT ?P (COUNT(?O) AS ?C)\n" + "WHERE { ?S ?P ?O }"; negativeTest(query); }
/** * Use of an ungrouped variable in a project expression */ public void test_agg11() throws MalformedQueryException { final String query = "PREFIX : <http://www.example.org/>\n" + "SELECT ((?O1 + ?O2) AS ?O12) (COUNT(?O1) AS ?C)\n" + "WHERE { ?S :p ?O1; :q ?O2 } GROUP BY (?S)"; negativeTest(query); }
/** * projection of ungrouped variable */ public void test_group06() throws MalformedQueryException { final String query = "PREFIX : <http://example/>\n"+ "SELECT ?s ?v\n"+ "{\n"+ " ?s :p ?v .\n"+ "}\n"+ "GROUP BY ?s"; negativeTest(query); }