Package org.openrdf.repository

Examples of org.openrdf.repository.Repository.initialize()


    @Override
    protected boolean matchesSPARQL(RepositoryConnection connection) throws MalformedQueryException, RepositoryException, QueryEvaluationException {
        final GraphQuery graphQuery = connection.prepareGraphQuery(QueryLanguage.SPARQL, query, baseUri);

        final Repository repo = new SailRepository(new MemoryStore());
        repo.initialize();
        try {
            final RepositoryConnection connection2 = repo.getConnection();
            try {
                connection2.begin();
                final GraphQueryResult graph = graphQuery.evaluate();
View Full Code Here


    private void testGetBase(RDFFormat format) throws Exception {
        String data = given().header("Accept",format.getDefaultMIMEType()).expect().statusCode(200).when().get(createResourceURI("sepp_huber").stringValue()).asString();

        Repository mem = new SailRepository(new MemoryStore());
        mem.initialize();

        RepositoryConnection con = mem.getConnection();
        RepositoryConnection icon = sesameService.getConnection();
        try {
            con.begin();
View Full Code Here

        given().header("Accept",format.getDefaultMIMEType()).expect().statusCode(404).when().get(resource1.stringValue());


        // create resource 2 with some triples that we generate randomly in a temporary repository
        Repository mem = new SailRepository(new MemoryStore());
        mem.initialize();

        RepositoryConnection con = mem.getConnection();
        RepositoryConnection mcon = sesameService.getConnection();
        try {
            for(int i=0; i < rnd.nextInt(20); i++ ) {
View Full Code Here

     * @param model the model to wrap in a memory repository
     * @return the memory repository
     */
    public static Repository asRepository(Model model) throws RepositoryException {
        Repository repository = new SailRepository(new MemoryStore());
        repository.initialize();
        RepositoryConnection con = repository.getConnection();
        try {
            con.begin();

            con.add(model);
View Full Code Here

        InputStream vcard = this.getClass().getResourceAsStream(fileName+".vcf");
        InputStream sparql = this.getClass().getResourceAsStream(fileName+".sparql");
        assumeThat("Could not load testfiles", asList(vcard, sparql), everyItem(notNullValue(InputStream.class)));

        Repository repository = new SailRepository(new MemoryStore());
        repository.initialize();

        RepositoryConnection connection = repository.getConnection();
        try {
            connection.add(vcard,"http://localhost/vcard/", VCardFormat.FORMAT);
            connection.commit();
View Full Code Here

        InputStream ical = this.getClass().getResourceAsStream(fileName+".ics");
        InputStream sparql = this.getClass().getResourceAsStream(fileName+".sparql");
        assumeThat("Could not load testfiles", asList(ical, sparql), everyItem(notNullValue(InputStream.class)));

        Repository repository = new SailRepository(new MemoryStore());
        repository.initialize();

        RepositoryConnection connection = repository.getConnection();
        try {
            connection.add(ical,"http://localhost/ical/", ICalFormat.FORMAT);
            connection.commit();
View Full Code Here

        InputStream rdfJSON = this.getClass().getResourceAsStream(fileName+".json");
        InputStream rdfXML = this.getClass().getResourceAsStream(fileName+".rdf");
        assumeThat("Could not load testfiles", asList(rdfJSON, rdfXML), everyItem(notNullValue(InputStream.class)));

        Repository repositoryJSON = new SailRepository(new MemoryStore());
        repositoryJSON.initialize();

        RepositoryConnection connectionJSON = repositoryJSON.getConnection();
        try {
            connectionJSON.add(rdfJSON, "http://localhost/rdfjson/", RDFFormat.RDFJSON);
            connectionJSON.commit();
View Full Code Here

        }
        assertTrue(connectionJSON.size() > 0);


        Repository repositoryRDF = new SailRepository(new MemoryStore());
        repositoryRDF.initialize();

        RepositoryConnection connectionRDF = repositoryRDF.getConnection();
        connectionRDF.add(rdfXML, "http://localhost/rdfjson/", RDFFormat.RDFXML);
        connectionRDF.commit();
View Full Code Here

    public void testCreateCacheKey() throws Exception {
        Assert.assertNotEquals(LiteralCommons.createCacheKey("abc",null,(String)null), LiteralCommons.createCacheKey("ABC",null,(String)null));
        Assert.assertNotEquals(LiteralCommons.createCacheKey("abc",null,(URI)null), LiteralCommons.createCacheKey("ABC",null,(URI)null));

        Repository repository = new SailRepository(new MemoryStore());
        repository.initialize();

        ValueFactory vf = repository.getValueFactory();

        // create a string literal without language and datatype and test if the hash key is correct between
        // the different methods
View Full Code Here

  public ClientResponse retrieveResource(String resource, LDClientService client, Endpoint endpoint) throws DataRetrievalException {
        String filename = resource.substring("http://remote/".length()) + ".ttl";

        try {
            Repository triples = new SailRepository(new MemoryStore());
            triples.initialize();

            RepositoryConnection con = triples.getConnection();
            try {
                con.begin();
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.