Package org.openrdf.sail

Examples of org.openrdf.sail.SailConnection.begin()


    @Test
    public void testGetNamespaces() throws Exception {
        SailConnection sc = sail.getConnection();
        try {
            sc.begin();
            CloseableIteration<? extends Namespace, SailException> namespaces;
            int before = 0, during = 0, after = 0;
            // just iterate through all namespaces
            namespaces = sc.getNamespaces();
            while (namespaces.hasNext()) {
View Full Code Here


            String namePrefix = "http://example.org/test";
            for (int i = 0; i < nTests; i++) {
                sc.setNamespace(prefixPrefix + i, namePrefix + i);
            }
            sc.commit();
            sc.begin();
            namespaces = sc.getNamespaces();
            while (namespaces.hasNext()) {
                Namespace ns = namespaces.next();
                during++;
                String prefix = ns.getPrefix();
View Full Code Here

            namespaces.close();
            for (int i = 0; i < nTests; i++) {
                sc.removeNamespace(prefixPrefix + i);
            }
            sc.commit();
            sc.begin();
            namespaces = sc.getNamespaces();
            while (namespaces.hasNext()) {
                namespaces.next();
                after++;
            }
View Full Code Here

    @Test
    public void testSetNamespace() throws Exception {
        SailConnection sc = sail.getConnection();
        try {
            sc.begin();
            String prefix = "foo";
            String emptyPrefix = "";
            String name = "http://example.org/foo";
            String otherName = "http://example.org/bar";
View Full Code Here

            String otherName = "http://example.org/bar";

            sc.removeNamespace(prefix);
            sc.removeNamespace(emptyPrefix);
            sc.commit();
            sc.begin();

            // Namespace initially absent?
            assertNull(sc.getNamespace(prefix));
            assertNull(sc.getNamespace(emptyPrefix));
View Full Code Here

            assertNull(sc.getNamespace(emptyPrefix));

            // Can we set the namespace?
            sc.setNamespace(prefix, name);
            sc.commit();
            sc.begin();
            assertEquals(sc.getNamespace(prefix), name);

            // Can we reset the namespace?
            sc.setNamespace(prefix, otherName);
            sc.commit();
View Full Code Here

            assertEquals(sc.getNamespace(prefix), name);

            // Can we reset the namespace?
            sc.setNamespace(prefix, otherName);
            sc.commit();
            sc.begin();
            assertEquals(sc.getNamespace(prefix), otherName);

            // Can we use an empty namespace prefix?
            sc.setNamespace(emptyPrefix, name);
            sc.commit();
View Full Code Here

            assertEquals(sc.getNamespace(prefix), otherName);

            // Can we use an empty namespace prefix?
            sc.setNamespace(emptyPrefix, name);
            sc.commit();
            sc.begin();
            assertEquals(sc.getNamespace(emptyPrefix), name);
        } finally {
            sc.rollback();
            sc.close();
        }
View Full Code Here

    @Test
    public void testRemoveNamespace() throws Exception {
        SailConnection sc = sail.getConnection();
        try {
            sc.begin();
            String prefix = "foo";
            String emptyPrefix = "";
            String name = "http://example.org/foo";

            // Set namespace initially.
View Full Code Here

            String name = "http://example.org/foo";

            // Set namespace initially.
            sc.setNamespace(prefix, name);
            sc.commit();
            sc.begin();
            assertEquals(sc.getNamespace(prefix), name);

            // Remove the namespace and make sure it's gone.
            sc.removeNamespace(prefix);
            sc.commit();
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.