Java Code Examples for org.openrdf.repository.RepositoryConnection#clearNamespaces()

The following examples show how to use org.openrdf.repository.RepositoryConnection#clearNamespaces() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryTestCase.java    From anno4j with Apache License 2.0 5 votes vote down vote up
protected Repository getRepository() throws Exception, RepositoryException {
	Repository repository = createRepository();
	repository.initialize();
	RepositoryConnection con = repository.getConnection();
	try {
		con.setAutoCommit(false);
		con.clear();
		con.clearNamespaces();
		con.setNamespace("test", "urn:test:");
		con.setAutoCommit(true);
	} finally {
		con.close();
	}
	return repository;
}
 
Example 2
Source File: SPARQLQueryTest.java    From database with GNU General Public License v2.0 5 votes vote down vote up
protected Repository createRepository()
	throws Exception
{
	Repository repo = newRepository();
	repo.initialize();
	RepositoryConnection con = repo.getConnection();
	try {
		con.clear();
		con.clearNamespaces();
	}
	finally {
		con.close();
	}
	return repo;
}
 
Example 3
Source File: SPARQLUpdateConformanceTest.java    From database with GNU General Public License v2.0 5 votes vote down vote up
protected Repository createRepository()
	throws Exception
{
	Repository repo = newRepository();
	repo.initialize();
	RepositoryConnection con = repo.getConnection();
	try {
		con.clear();
		con.clearNamespaces();
	}
	finally {
		con.close();
	}
	return repo;
}
 
Example 4
Source File: SPARQLUpdateTest.java    From database with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates, initializes and clears a repository.
 * 
 * @return an initialized empty repository.
 * @throws Exception
 */
protected Repository createRepository()
	throws Exception
{
	Repository repository = newRepository();
	repository.initialize();
	RepositoryConnection con = repository.getConnection();
	con.clear();
	con.clearNamespaces();
	con.close();
	return repository;
}
 
Example 5
Source File: NamespacesHandler.java    From cumulusrdf with Apache License 2.0 5 votes vote down vote up
/**
 * clear the namespaces
 * 
 * @param repository the Repository object
 * @param request the HttpServletRequest object 
 * @param response the HttpServletResponse oject
 * @return EmptySuccessView object if success
 * @throws ServerHTTPException throws when errors in repository
 * @throws RepositoryException throws when errors in closing the RepositoryConnection 
 */
private ModelAndView getClearNamespacesResult(final Repository repository, final HttpServletRequest request, final HttpServletResponse response)
		throws ServerHTTPException, RepositoryException {
	RepositoryConnection repositoryCon = repository.getConnection();
	synchronized (repositoryCon) {
		try {
			repositoryCon.clearNamespaces();
		} catch (RepositoryException e) {
			throw new ServerHTTPException("Repository error: " + e.getMessage(), e);
		}
	}
	repositoryCon.close();
	return new ModelAndView(EmptySuccessView.getInstance());
}