Package org.openrdf.repository

Examples of org.openrdf.repository.RepositoryConnection.begin()


        URI predicate = repository.getValueFactory().createURI("http://localhost/resource/" + RandomStringUtils.randomAlphanumeric(8));
        Literal object = repository.getValueFactory().createLiteral(value);

        RepositoryConnection connection1 = repository.getConnection();
        try {
            connection1.begin();
            connection1.add(subject,predicate,object);
            connection1.rollback();

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


            connection1.close();
        }

        RepositoryConnection connection2 = repository.getConnection();
        try {
            connection2.begin();
            Assert.assertFalse(connection2.hasStatement(subject,predicate,object,true));

            connection2.add(subject,predicate,object);
            connection2.commit();
View Full Code Here

            con1.begin();
            con1.add(r1,r2,r3);

            Assert.assertTrue(con1.hasStatement(r1,r2,r3,true));

            con2.begin();
            Assert.assertFalse(con2.hasStatement(r1,r2,r3,true));

            con2.add(r1,r2,r3);

            Assert.assertTrue(con2.hasStatement(r1,r2,r3,true));
View Full Code Here


    public void profileListStatements() throws RepositoryException {
        RepositoryConnection con = repository.getConnection();
        try {
            con.begin();

            long start = System.currentTimeMillis();
            long stmts = 0;

            RepositoryResult<Statement> r = con.getStatements(null,null,null,true);
View Full Code Here

    @Test
    @SuppressWarnings("unchecked")
    public void testNamespaces() throws RepositoryException {
        RepositoryConnection connection = repository.getConnection();

        connection.begin();
        connection.setNamespace("ns1","http://localhost/ns1/");
        connection.setNamespace("ns2","http://localhost/ns2/");

        connection.commit();
View Full Code Here

                        hasProperty("name", is("http://localhost/ns2/"))
                )
        );

        // update ns1 to a different URL
        connection.begin();
        connection.setNamespace("ns1","http://localhost/ns3/");
        connection.commit();

        Assert.assertEquals("http://localhost/ns3/", connection.getNamespace("ns1"));
        Assert.assertThat(
View Full Code Here

                )
        );


        // remove ns2
        connection.begin();
        connection.removeNamespace("ns2");
        connection.commit();

        connection.begin();
        Assert.assertEquals(1, Iterations.asList(connection.getNamespaces()).size());
View Full Code Here

        // remove ns2
        connection.begin();
        connection.removeNamespace("ns2");
        connection.commit();

        connection.begin();
        Assert.assertEquals(1, Iterations.asList(connection.getNamespaces()).size());


        connection.commit();
        connection.close();
View Full Code Here

        }
        // get another connection and check if demo data is available
        RepositoryConnection connection = repository.getConnection();

        try {
            connection.begin();
            List<String> resources = ImmutableList.copyOf(
                    Iterables.transform(
                            ResourceUtils.listResources(connection),
                            new Function<Resource, String>() {
                                @Override
View Full Code Here

            long oldsize = connection.size();
            connection.commit();


            // remove a resource and all its triples
            connection.begin();
            ResourceUtils.removeResource(connection, connection.getValueFactory().createURI("http://localhost:8080/LMF/resource/hans_meier"));
            connection.commit();

            connection.begin();
            long newsize = connection.size();
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.