Package org.apache.marmotta.kiwi.reasoner.persistence

Examples of org.apache.marmotta.kiwi.reasoner.persistence.KiWiReasoningConnection.commit()


        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            // should not throw an exception and the program should have a database ID afterwards
            connection.storeProgram(p);
            connection.commit();

            Assert.assertNotNull("program did not get a database ID",p.getId());

            // load the program by name and check if it is equal to the original program
            Program p1 = connection.loadProgram("test-001");
View Full Code Here


            Assert.assertNotNull("program did not get a database ID",p.getId());

            // load the program by name and check if it is equal to the original program
            Program p1 = connection.loadProgram("test-001");
            connection.commit();

            Assert.assertNotNull("load program by name: loaded program is null",p1);
            Assert.assertEquals("load program by name: loaded program differs from original",p,p1);

            // load the program by name and check if it is equal to the original program
View Full Code Here

            Assert.assertNotNull("load program by name: loaded program is null",p1);
            Assert.assertEquals("load program by name: loaded program differs from original",p,p1);

            // load the program by name and check if it is equal to the original program
            Program p2 = connection.loadProgram(p.getId());
            connection.commit();

            Assert.assertNotNull("load program by ID: loaded program is null",p2);
            Assert.assertEquals("load program by ID: loaded program differs from original",p,p2);

        } finally {
View Full Code Here

        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            // should not throw an exception and the program should have a database ID afterwards
            connection.storeProgram(p);
            connection.commit();

            Assert.assertNotNull("program did not get a database ID",p.getId());


            // load the program by name and check if it is equal to the original program
View Full Code Here

            Assert.assertNotNull("program did not get a database ID",p.getId());


            // load the program by name and check if it is equal to the original program
            Program p1 = connection.loadProgram("test-001");
            connection.commit();

            Assert.assertNotNull("load program by name: loaded program is null",p1);
            Assert.assertEquals("load program by name: loaded program differs from original",p,p1);

View Full Code Here

            ResultSet resultListRules1 = listRules1.executeQuery();

            Assert.assertTrue(resultListRules1.next());
            Assert.assertEquals(5, resultListRules1.getInt("count"));
            resultListRules1.close();
            connection.commit();



            // now remove two rules from the original and update the existing program
            p.getRules().remove(p.getRules().size()-1);
View Full Code Here

            connection.updateProgram(p);

            // load the program by name and check if it is equal to the original program
            Program p2 = connection.loadProgram(p.getName());
            connection.commit();

            Assert.assertNotNull("load program by name: loaded program is null",p2);
            Assert.assertEquals("load program by name: loaded program differs from original",p,p2);

            PreparedStatement listRules2 = connection.getJDBCConnection().prepareStatement("SELECT count(*) AS count FROM reasoner_rules");
View Full Code Here

            ResultSet resultListRules2 = listRules2.executeQuery();

            Assert.assertTrue(resultListRules2.next());
            Assert.assertEquals(3, resultListRules2.getInt("count"));
            resultListRules2.close();
            connection.commit();



        } finally {
            connection.close();
View Full Code Here

            for(String name : new String[] {"test-001", "test-002", "test-003", "test-004"}) {
                KWRLProgramParserBase parser = new KWRLProgramParser(repository.getValueFactory(), this.getClass().getResourceAsStream(name+".kwrl"));
                Program p = parser.parseProgram();
                p.setName(name);
                connection.storeProgram(p);
                connection.commit();

                programs.add(p);
            }

            // now we should have a collection of 4 programs in the database
View Full Code Here

            ResultSet result = checkNodeStmt.executeQuery();

            Assert.assertTrue(result.next());
            Assert.assertEquals(4, result.getInt("count"));
            result.close();
            connection.commit();

            // list programs should return the same number and equal programs
            List<Program> dbPrograms1 = asList(connection.listPrograms());
            Assert.assertEquals(4, dbPrograms1.size());
            Assert.assertEquals("list of original programs differs from list of database",programs,dbPrograms1);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.