/** * <pre> * drop graph <http://www.bigdata.com/data> * </pre> */ public void test_drop_graph() throws MalformedQueryException, TokenMgrError, ParseException { //drop ( SILENT )? (GRAPH IRIref | DEFAULT | NAMED | ALL ) final String sparql = "drop graph <http://www.bigdata.com/data>"; final UpdateRoot expected = new UpdateRoot(); { final DropGraph op = new DropGraph(); expected.addChild(op); op.setTargetGraph(new ConstantNode(makeIV(valueFactory .createURI("http://www.bigdata.com/data")))); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
parseUpdate(sparql, baseURI); fail("Expecting exception: blank nodes not allowed in DELETE template"); } catch (MalformedQueryException ex) {
/** * <pre> * clear named * </pre> */ public void test_clear_named() throws MalformedQueryException, TokenMgrError, ParseException { //CLEAR ( SILENT )? (GRAPH IRIref | DEFAULT | NAMED | ALL ) final String sparql = "clear named"; final UpdateRoot expected = new UpdateRoot(); { final ClearGraph op = new ClearGraph(); expected.addChild(op); op.setScope(Scope.NAMED_CONTEXTS); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
public void test_insert_data_triples_then_quads2() throws MalformedQueryException, TokenMgrError, ParseException { final String sparql = "PREFIX dc: <http://purl.org/dc/elements/1.1/>\n" + "PREFIX ns: <http://example.org/ns#>\n" + "INSERT DATA\n" + "{\n" + " { <a:s1> <a:p1> <a:o1>\n }" + " GRAPH <a:G> { <a:s> <a:p1> 'o1'; <a:p2> <a:o2> }\n" + " GRAPH <a:G1> { <a:s> <a:p1> 'o1'; <a:p2> <a:o2> } \n" + " <a:s1> <a:p1> <a:o1>\n" + "}"; parseUpdate(sparql, baseURI); }
/** * <pre> * clear default * </pre> */ public void test_clear_default() throws MalformedQueryException, TokenMgrError, ParseException { //CLEAR ( SILENT )? (GRAPH IRIref | DEFAULT | NAMED | ALL ) final String sparql = "clear default"; final UpdateRoot expected = new UpdateRoot(); { final ClearGraph op = new ClearGraph(); expected.addChild(op); op.setScope(Scope.DEFAULT_CONTEXTS); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
public void test_insert_data_triples_then_quads2() throws MalformedQueryException, TokenMgrError, ParseException { final String sparql = "PREFIX dc: <http://purl.org/dc/elements/1.1/>\n" + "PREFIX ns: <http://example.org/ns#>\n" + "INSERT DATA\n" + "{\n" + " { <a:s1> <a:p1> <a:o1>\n }" + " GRAPH <a:G> { <a:s> <a:p1> 'o1'; <a:p2> <a:o2> }\n" + " GRAPH <a:G1> { <a:s> <a:p1> 'o1'; <a:p2> <a:o2> } \n" + " <a:s1> <a:p1> <a:o1>\n" + "}"; parseUpdate(sparql, baseURI); }
/** * <pre> * create graph <http://www.bigdata.com/graph1> * </pre> */ public void test_create() throws MalformedQueryException, TokenMgrError, ParseException { //CREATE ( SILENT )? GRAPH IRIref final String sparql = "create graph <http://www.bigdata.com/graph1>"; final UpdateRoot expected = new UpdateRoot(); { final CreateGraph op = new CreateGraph(); expected.addChild(op); op.setTargetGraph(new ConstantNode(makeIV(valueFactory .createURI("http://www.bigdata.com/graph1")))); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
/** * <pre> * drop default * </pre> */ public void test_drop_default() throws MalformedQueryException, TokenMgrError, ParseException { //drop ( SILENT )? (GRAPH IRIref | DEFAULT | NAMED | ALL ) final String sparql = "drop default"; final UpdateRoot expected = new UpdateRoot(); { final DropGraph op = new DropGraph(); expected.addChild(op); op.setScope(Scope.DEFAULT_CONTEXTS); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
parseUpdate(sparql, baseURI); fail("Expecting exception: blank nodes not allowed in DELETE template"); } catch (MalformedQueryException ex) {
/** * Unit test for simple CLEAR operation. * * <pre> * clear graph <http://www.bigdata.com/data> * </pre> */ public void test_clear_graph() throws MalformedQueryException, TokenMgrError, ParseException { //CLEAR ( SILENT )? (GRAPH IRIref | DEFAULT | NAMED | ALL ) final String sparql = "clear graph <http://www.bigdata.com/data>"; final UpdateRoot expected = new UpdateRoot(); { final ClearGraph op = new ClearGraph(); expected.addChild(op); op.setTargetGraph(new ConstantNode(makeIV(valueFactory .createURI("http://www.bigdata.com/data")))); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
/** * <pre> * drop named * </pre> */ public void test_drop_named() throws MalformedQueryException, TokenMgrError, ParseException { //drop ( SILENT )? (GRAPH IRIref | DEFAULT | NAMED | ALL ) final String sparql = "drop named"; final UpdateRoot expected = new UpdateRoot(); { final DropGraph op = new DropGraph(); expected.addChild(op); op.setScope(Scope.NAMED_CONTEXTS); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
parseUpdate(sparql, baseURI); fail("Expecting exception: blank nodes not allowed in DELETE template"); } catch (MalformedQueryException ex) {
/** * <pre> * load <http://www.bigdata.com/data> * </pre> */ public void test_load_graph() throws MalformedQueryException, TokenMgrError, ParseException { //LOAD ( SILENT )? IRIref_from ( INTO GRAPH IRIref_to )? final String sparql = "load <http://www.bigdata.com/data>"; final UpdateRoot expected = new UpdateRoot(); { final LoadGraph op = new LoadGraph(); expected.addChild(op); final RDFParserOptions options = new RDFParserOptions(); op.setSourceGraph(new ConstantNode(makeIV(valueFactory .createURI("http://www.bigdata.com/data")))); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
/** * <pre> * clear all * </pre> */ public void test_clear_all() throws MalformedQueryException, TokenMgrError, ParseException { //CLEAR ( SILENT )? (GRAPH IRIref | DEFAULT | NAMED | ALL ) final String sparql = "clear all"; final UpdateRoot expected = new UpdateRoot(); { final ClearGraph op = new ClearGraph(); op.setAllGraphs(true); op.setAllSolutionSets(true); expected.addChild(op); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
parseUpdate(sparql, baseURI); fail("Expecting exception: blank nodes not allowed in DELETE template"); } catch (MalformedQueryException ex) {
/** * <pre> * copy <http://www.bigdata.com/graph1> to <http://www.bigdata.com/graph2> * </pre> */ public void test_copy_graph_to_graph() throws MalformedQueryException, TokenMgrError, ParseException { //COPY ( SILENT )? ( ( GRAPH )? IRIref_from | DEFAULT) TO ( ( GRAPH )? IRIref_to | DEFAULT ) final String sparql = "copy <http://www.bigdata.com/graph1> to <http://www.bigdata.com/graph2>"; final UpdateRoot expected = new UpdateRoot(); { final CopyGraph op = new CopyGraph(); expected.addChild(op); op.setSourceGraph(new ConstantNode(makeIV(valueFactory .createURI("http://www.bigdata.com/graph1")))); op.setTargetGraph(new ConstantNode(makeIV(valueFactory .createURI("http://www.bigdata.com/graph2")))); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
/** * <pre> * drop all * </pre> */ public void test_drop_all() throws MalformedQueryException, TokenMgrError, ParseException { //drop ( SILENT )? (GRAPH IRIref | DEFAULT | NAMED | ALL ) final String sparql = "drop all"; final UpdateRoot expected = new UpdateRoot(); { final DropGraph op = new DropGraph(); op.setAllGraphs(true); op.setAllSolutionSets(true); expected.addChild(op); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
/** * <pre> * move <http://www.bigdata.com/graph1> to <http://www.bigdata.com/graph2> * </pre> */ public void test_move_graph_to_graph() throws MalformedQueryException, TokenMgrError, ParseException { //COPY ( SILENT )? ( ( GRAPH )? IRIref_from | DEFAULT) TO ( ( GRAPH )? IRIref_to | DEFAULT ) final String sparql = "move <http://www.bigdata.com/graph1> to <http://www.bigdata.com/graph2>"; final UpdateRoot expected = new UpdateRoot(); { final MoveGraph op = new MoveGraph(); expected.addChild(op); op.setSourceGraph(new ConstantNode(makeIV(valueFactory .createURI("http://www.bigdata.com/graph1")))); op.setTargetGraph(new ConstantNode(makeIV(valueFactory .createURI("http://www.bigdata.com/graph2")))); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
/** * <pre> * clear silent all * </pre> */ public void test_clear_silent_all() throws MalformedQueryException, TokenMgrError, ParseException { //clear ( SILENT )? (GRAPH IRIref | DEFAULT | NAMED | ALL ) final String sparql = "clear silent all"; final UpdateRoot expected = new UpdateRoot(); { final ClearGraph op = new ClearGraph(); expected.addChild(op); op.setAllGraphs(true); op.setAllSolutionSets(true); op.setSilent(true); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }
/** * <pre> * copy silent default to <http://www.bigdata.com/graph2> * </pre> */ public void test_silent_copy_default_to_graph() throws MalformedQueryException, TokenMgrError, ParseException { //COPY ( SILENT )? ( ( GRAPH )? IRIref_from | DEFAULT) TO ( ( GRAPH )? IRIref_to | DEFAULT ) final String sparql = "copy silent default to <http://www.bigdata.com/graph2>"; final UpdateRoot expected = new UpdateRoot(); { final CopyGraph op = new CopyGraph(); expected.addChild(op); op.setSilent(true); op.setTargetGraph(new ConstantNode(makeIV(valueFactory .createURI("http://www.bigdata.com/graph2")))); } final UpdateRoot actual = parseUpdate(sparql, baseURI); assertSameAST(sparql, expected, actual); }