Package org.apache.marmotta.kiwi.model.rdf

Examples of org.apache.marmotta.kiwi.model.rdf.KiWiNamespace


    // TODO: test namespaces
    @Test
    public void testStoreNamespaces() throws SQLException {
        KiWiConnection connection = persistence.getConnection();
        try {
            KiWiNamespace ns1 = new KiWiNamespace("ns1", "http://localhost/ns1/");
            KiWiNamespace ns2 = new KiWiNamespace("ns2", "http://localhost/ns2/");

            connection.storeNamespace(ns1);
            connection.storeNamespace(ns2);

            // check before transaction commit
View Full Code Here


    }

    @Override
    protected String getNamespaceInternal(String prefix) throws SailException {
        try {
            KiWiNamespace result = databaseConnection.loadNamespaceByPrefix(prefix);
            if(result != null) {
                return result.getUri();
            } else {
                return null;
            }
        } catch (SQLException e) {
            throw new SailException("database error while querying namespaces",e);
View Full Code Here

    @Override
    protected void setNamespaceInternal(String prefix, String name) throws SailException {
        try {
            // check if the namespace prefix already exists; if yes and unequal, then delete first
            KiWiNamespace result = databaseConnection.loadNamespaceByPrefix(prefix);
            if(result != null) {
                if(!result.getUri().equals(name)) {
                    databaseConnection.deleteNamespace(result);
                    databaseConnection.storeNamespace(new KiWiNamespace(prefix,name));
                }
            } else {
                databaseConnection.storeNamespace(new KiWiNamespace(prefix,name));
            }
        } catch (SQLException e) {
            throw new SailException("database error while updating namespace",e);
        }
    }
View Full Code Here

    @Override
    protected void removeNamespaceInternal(String prefix) throws SailException {
        try {
            // check if the namespace prefix already exists; if yes and unequal, then delete first
            KiWiNamespace result = databaseConnection.loadNamespaceByPrefix(prefix);
            if(result != null) {
                databaseConnection.deleteNamespace(result);
            }
        } catch (SQLException e) {
            throw new SailException("database error while deleting namespace",e);
View Full Code Here

    }

    @Override
    public String getNamespace(String prefix) throws SailException {
        try {
            KiWiNamespace result = databaseConnection.loadNamespaceByPrefix(prefix);
            if(result != null) {
                return result.getUri();
            } else {
                return null;
            }
        } catch (SQLException e) {
            throw new SailException("database error while querying namespaces",e);
View Full Code Here

    }

    @Override
    protected String getNamespaceInternal(String prefix) throws SailException {
        try {
            KiWiNamespace result = databaseConnection.loadNamespaceByPrefix(prefix);
            if(result != null) {
                return result.getUri();
            } else {
                return null;
            }
        } catch (SQLException e) {
            throw new SailException("database error while querying namespaces",e);
View Full Code Here

    @Override
    protected void setNamespaceInternal(String prefix, String name) throws SailException {
        try {
            // check if the namespace prefix already exists; if yes and unequal, then delete first
            KiWiNamespace result = databaseConnection.loadNamespaceByPrefix(prefix);
            if(result != null) {
                if(!result.getUri().equals(name)) {
                    databaseConnection.deleteNamespace(result);
                    databaseConnection.storeNamespace(new KiWiNamespace(prefix,name));
                }
            } else {
                databaseConnection.storeNamespace(new KiWiNamespace(prefix,name));
            }
        } catch (SQLException e) {
            throw new SailException("database error while updating namespace",e);
        }
    }
View Full Code Here

    @Override
    protected void removeNamespaceInternal(String prefix) throws SailException {
        try {
            // check if the namespace prefix already exists; if yes and unequal, then delete first
            KiWiNamespace result = databaseConnection.loadNamespaceByPrefix(prefix);
            if(result != null) {
                databaseConnection.deleteNamespace(result);
            }
        } catch (SQLException e) {
            throw new SailException("database error while deleting namespace",e);
View Full Code Here

TOP

Related Classes of org.apache.marmotta.kiwi.model.rdf.KiWiNamespace

Copyright © 2018 www.massapicom. 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.