Package org.openrdf.repository.sail

Examples of org.openrdf.repository.sail.SailRepository


    return mappingRes;
  }

  private void initializeTripleStore() throws RepositoryException {
    /** Initialize an in-memory sesame triple store **/
    myRepository = new SailRepository(new MemoryStore());
    myRepository.initialize();
    con = myRepository.getConnection();
    f = myRepository.getValueFactory();
  }
View Full Code Here


    public Repository createRepository(HttpServletRequest request, String repoType, String slug) throws Exception {
        ExtendedProperties properties = getProperties();
        String dbDir = properties.getString("backstage.databaseDir","databases");

        SailRepository repository = null;
        File thisDbDir = new File(new File(dbDir,repoType),slug);

        if (repoType.equals(REPOTYPE_MEM)) {
            DataLoadingUtilities.RepoSailTuple rs = DataLoadingUtilities.createMemoryRepository(thisDbDir);
            repository = (SailRepository)rs.repository;
            rs = null;
        } else if (repoType.equals(REPOTYPE_DISK)) {
            DataLoadingUtilities.RepoSailTuple rs = DataLoadingUtilities.createNativeRepository(thisDbDir);
            repository = (SailRepository)rs.repository;
            rs = null;
        } else {
            return null;
        }

        String lang = DataLoadingUtilities.contentTypeToLang(request.getContentType());
        if (lang == null) {
            throw new Exception("Unsupported content type");
        }

        DataLoadingUtilities.loadDataFromStream( (InputStream)request.getInputStream(),
                                                 request.getRequestURL().toString(),
                                                 lang, repository.getSail() );
        return repository;
    }
View Full Code Here

        // break encapsulation to simplify data upload integration
        _repository = repo;

        // all repos should be sail repos, but our Java master must be served
        try {
            SailRepository sr = (SailRepository)repo;
            _sail = sr.getSail();
        } catch (ClassCastException e) {
            // pass
        }
    }
View Full Code Here

        try {
            Repository r = null;
            Sail s = null;
            if (dir != null) {
                s = new MemoryStore(dir);
                r = new SailRepository(s);
            } else {
                s = new MemoryStore();
                r = new SailRepository(new MemoryStore());
            }
            r.initialize();

            return new RepoSailTuple(r,s);
        } catch (Exception e) {
View Full Code Here

    static public RepoSailTuple createNativeRepository(File dir) {
        try {
            Sail sail = new NativeStore();
            sail.setDataDir(dir);
            ((NativeStore) sail).setTripleIndexes("spoc,posc,opsc");
            Repository r = new SailRepository(sail);
            r.initialize();
            return new RepoSailTuple(r,sail);
        } catch (Exception e) {
            _logger.error("Exception caught while creating Sesame native repository", e);
            return null;
        }
View Full Code Here

    } catch (IOException e) {
      Global.log().warning("Failed to write result to temporary file");
      return;
    }
   
    Repository tempRepository = new SailRepository(new MemoryStore());
    RepositoryConnection conn = null;
    try {
      tempRepository.initialize();
      conn = tempRepository.getConnection();
    } catch (RepositoryException e1) {
      Global.log().warning("Failed to create repository for merging");
      return;
    }
 
View Full Code Here

  RDFFormat rdfType=RDFFormat.N3;
 
  public RDFGraphClusteringAnnotator(File data, Type type) {
    originalDataFile = data;
    currentType = type;
    tempRepository = new SailRepository(new MemoryStore());
    try {
      tempRepository.initialize();
      conn = tempRepository.getConnection();
      if(type == Type.RDFXML)
        rdfType = RDFFormat.RDFXML;
View Full Code Here

    @Before
    public void initDatabase() throws RepositoryException {
        store = new KiWiStore("test",jdbcUrl,jdbcUser,jdbcPass,dialect, "http://localhost/context/default", "http://localhost/context/inferred");
        tsail = new KiWiTransactionalSail(store);
        vsail = new KiWiVersioningSail(tsail);
        repository = new SailRepository(vsail);
        repository.initialize();
    }
View Full Code Here

        assertExpected(get(joshCreatedRipple, weight, vf.createLiteral(1.0)));
    }

    @Test
    public void testRDFDump() throws Exception {
        Repository repo = new SailRepository(sail);
        RepositoryConnection rc = repo.getConnection();
        try {
            RDFWriter w = Rio.createWriter(RDFFormat.TURTLE, System.out);
            rc.export(w);
        } finally {
            rc.close();
View Full Code Here

          filename = item.getName();
          in = item.getInputStream();
        }
      }
     
      Repository repository = new SailRepository(
          new ForwardChainingRDFSInferencer(new MemoryStore()));
      repository.initialize();
      RepositoryConnection con = repository.getConnection();
      RDFFormat rdfFromat;
      if(format.equals("auto-detect")){
        rdfFromat = guessFormat(filename);
      }else if(format.equals("TTL")){
        rdfFromat = RDFFormat.TURTLE;
View Full Code Here

TOP

Related Classes of org.openrdf.repository.sail.SailRepository

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.