Search in sources :

Example 11 with Repository

use of org.openrdf.repository.Repository in project gocd by gocd.

the class InMemoryRepositoryFactory method emptyRepository.

public static Repository emptyRepository() {
    try {
        Repository repo = new SailRepository(new MemoryStore());
        repo.initialize();
        return repo;
    } catch (RepositoryException ex) {
        throw new ShineRuntimeException(ex);
    }
}
Also used : MemoryStore(org.openrdf.sail.memory.MemoryStore) Repository(org.openrdf.repository.Repository) SailRepository(org.openrdf.repository.sail.SailRepository) ShineRuntimeException(com.thoughtworks.studios.shine.ShineRuntimeException) SailRepository(org.openrdf.repository.sail.SailRepository) RepositoryException(org.openrdf.repository.RepositoryException)

Example 12 with Repository

use of org.openrdf.repository.Repository in project gocd by gocd.

the class SesameGraph method createTempGraph.

public Graph createTempGraph() {
    try {
        if (!conn.isOpen()) {
            throw new IllegalStateException("Cannot create a temp graph on a closed graph!");
        }
        Repository inMemRepos = InMemoryRepositoryFactory.emptyRepository();
        String contextURI = null;
        if (contextResource.length > 0) {
            contextURI = contextResource[0].stringValue();
        }
        Graph tempGraph = new SesameGraph(inMemRepos.getConnection(), contextURI);
        tempGraphs.add(tempGraph);
        return tempGraph;
    } catch (RepositoryException ex) {
        throw new ShineRuntimeException("Unable to create temp graph!", ex);
    }
}
Also used : Repository(org.openrdf.repository.Repository) Graph(com.thoughtworks.studios.shine.semweb.Graph) ShineRuntimeException(com.thoughtworks.studios.shine.ShineRuntimeException) RepositoryException(org.openrdf.repository.RepositoryException)

Example 13 with Repository

use of org.openrdf.repository.Repository in project incubator-rya by apache.

the class CbSailTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    store = new MockRdfCloudStore();
    // store.setDisplayQueryPlan(true);
    // store.setInferencing(false);
    NamespaceManager nm = new NamespaceManager(store.getRyaDAO(), store.getConf());
    store.setNamespaceManager(nm);
    repository = new RyaSailRepository(store);
    repository.initialize();
    JndiRegistry registry = super.createRegistry();
    registry.bind(Repository.class.getName(), repository);
    return registry;
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) NamespaceManager(org.apache.rya.rdftriplestore.namespace.NamespaceManager) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository) Repository(org.openrdf.repository.Repository) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository)

Example 14 with Repository

use of org.openrdf.repository.Repository in project incubator-rya by apache.

the class AbstractRyaCommand method doExecute.

@Override
protected Object doExecute() throws Exception {
    ServiceTracker serviceTracker = new ServiceTracker(getBundleContext(), Repository.class.getName(), null);
    serviceTracker.open();
    repository = (Repository) serviceTracker.getService();
    serviceTracker.close();
    if (repository == null) {
        System.out.println("Sail Repository not available");
        return null;
    }
    serviceTracker = new ServiceTracker(getBundleContext(), RyaDAO.class.getName(), null);
    serviceTracker.open();
    rdfDAO = (RyaDAO) serviceTracker.getService();
    serviceTracker.close();
    if (rdfDAO == null) {
        System.out.println("Rdf DAO not available");
        return null;
    }
    return doRyaExecute();
}
Also used : Repository(org.openrdf.repository.Repository) ServiceTracker(org.osgi.util.tracker.ServiceTracker)

Example 15 with Repository

use of org.openrdf.repository.Repository in project incubator-rya by apache.

the class CbSailComponent method createEndpoint.

@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    String sailRepoNameParam = Repository.class.getName();
    if (parameters.containsKey(sailRepoNameParam)) {
        sailRepoNameParam = getAndRemoveParameter(parameters, SAILREPONAME, String.class);
    }
    Repository sailRepository = getCamelContext().getRegistry().lookup(sailRepoNameParam, Repository.class);
    checkNotNull(sailRepository, "Sail Repository must exist within the camel registry. Using lookup name[" + sailRepoNameParam + "]");
    CbSailEndpoint sailEndpoint = new CbSailEndpoint(uri, this, sailRepository, remaining);
    setProperties(sailEndpoint, parameters);
    return sailEndpoint;
}
Also used : Repository(org.openrdf.repository.Repository) SailRepository(org.openrdf.repository.sail.SailRepository)

Aggregations

Repository (org.openrdf.repository.Repository)18 SailRepository (org.openrdf.repository.sail.SailRepository)9 RepositoryConnection (org.openrdf.repository.RepositoryConnection)6 RepositoryException (org.openrdf.repository.RepositoryException)6 IOException (java.io.IOException)4 Test (org.junit.Test)4 MemoryStore (org.openrdf.sail.memory.MemoryStore)4 FileNotFoundException (java.io.FileNotFoundException)3 InputStreamReader (java.io.InputStreamReader)3 Statement (org.openrdf.model.Statement)3 RDFHandlerException (org.openrdf.rio.RDFHandlerException)3 SailException (org.openrdf.sail.SailException)3 ShineRuntimeException (com.thoughtworks.studios.shine.ShineRuntimeException)2 FileInputStream (java.io.FileInputStream)2 StringReader (java.io.StringReader)2 Ignore (org.junit.Ignore)2 RepositoryConfig (org.openrdf.repository.config.RepositoryConfig)2 SailRepositoryFactory (org.openrdf.repository.sail.config.SailRepositoryFactory)2 RDFFormat (org.openrdf.rio.RDFFormat)2 RDFParser (org.openrdf.rio.RDFParser)2