public RDFRepositoryConnector(URI serverUri, String repositoryName) throws RDFRepositoryException { if (null == serverUri || null == serverUri.toString() || "" == serverUri.toString() || null == repositoryName || "" == repositoryName) { throw new RDFRepositoryException("Can not initialize the connector"); } sesameRepository = new HTTPRepository(serverUri.toString(), repositoryName); try { sesameRepository.initialize(); } catch (RepositoryException e) { throw new RDFRepositoryException("Can not initialize the connector"); } }
public RepositoryModel openRepositoryModel(URI contextUri) throws RDFRepositoryException { if (null == sesameRepository) { throw new RDFRepositoryException("The connector has not been initialized correctly"); } RepositoryModel result = null; if (contextUri != null && contextUri.toString() != null && contextUri.toString() != "") { URIImpl contextUriInRepository = new URIImpl(contextUri.toString()); result = new RepositoryModel(contextUriInRepository, sesameRepository); } else { result = new RepositoryModel(sesameRepository); } if (null == result) { throw new RDFRepositoryException("Can not open the repository"); } result.open(); return result; }