Package org.openrdf.repository

Examples of org.openrdf.repository.Repository


        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


                _count +=1;
                return false;
        }
      };
     
            Repository model = RdfExporter.buildModel(project, engine, visitor);
            StringWriter sw = new StringWriter();
            try{
              RepositoryConnection con = model.getConnection();
              try{
                RDFWriter w = Rio.createWriter(RDFFormat.TURTLE, sw);
                for(Vocabulary v:schema.getPrefixesMap().values()){
                  w.handleNamespace(v.getName(), v.getUri());
                }
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

  @Override
  protected Repository createRepository(String id)
    throws RepositoryConfigException, RepositoryException
  {
    Repository systemRepository = getSystemRepository();

    RepositoryConnection con = systemRepository.getConnection();
    try {
      Repository repository = null;

      RepositoryConfig repConfig = RepositoryConfigUtil.getRepositoryConfig(systemRepository, id);
      if (repConfig != null) {
        repConfig.validate();

        repository = createRepositoryStack(repConfig.getRepositoryImplConfig());
        repository.setDataDir(getRepositoryDir(id));
        repository.initialize();
      }

      return repository;
    }
    finally {
View Full Code Here

    RepositoryFactory factory = RepositoryRegistry.getInstance().get(config.getType());
    if (factory == null) {
      throw new RepositoryConfigException("Unsupported repository type: " + config.getType());
    }

    Repository repository = factory.getRepository(config);

    if (config instanceof DelegatingRepositoryImplConfig) {
      RepositoryImplConfig delegateConfig = ((DelegatingRepositoryImplConfig)config).getDelegate();

      Repository delegate = createRepositoryStack(delegateConfig);

      try {
        ((DelegatingRepository)repository).setDelegate(delegate);
      }
      catch (ClassCastException e) {
        throw new RepositoryConfigException(
            "Delegate specified for repository that is not a DelegatingRepository: "
                + delegate.getClass());
      }
    }

    return repository;
  }
View Full Code Here

  {
    // Create test suite
    TestSuite suite = new TestSuite();

    // Add the manifest to a repository and query it
    Repository repository = new SailRepository(new MemoryStore());
    repository.initialize();
    RepositoryConnection con = repository.getConnection();

    URL url = new URL(MANIFEST_URL);
    con.add(url, MANIFEST_URL, RDFFormat.TURTLE);

    // Add all positive parser tests to the test suite
    String query = "SELECT testURI, inputURL, outputURL "
        + "FROM {testURI} rdf:type {n3test:PositiveParserTest}; "
        + "               n3test:inputDocument {inputURL}; "
        + "               n3test:outputDocument {outputURL} "
        + "USING NAMESPACE n3test = <http://www.w3.org/2004/11/n3test#>";

    TupleQueryResult queryResult = con.prepareTupleQuery(QueryLanguage.SERQL, query).evaluate();
    while(queryResult.hasNext()) {
      BindingSet bindingSet = queryResult.next();
      String testURI = bindingSet.getValue("testURI").toString();
      String inputURL = bindingSet.getValue("inputURL").toString();
      String outputURL = bindingSet.getValue("outputURL").toString();

      suite.addTest(new PositiveParserTest(testURI, inputURL, outputURL));
    }

    queryResult.close();

    // Add all negative parser tests to the test suite
    query = "SELECT testURI, inputURL "
        + "FROM {testURI} rdf:type {n3test:NegativeParserTest}; "
        + "               n3test:inputDocument {inputURL} "
        + "USING NAMESPACE n3test = <http://www.w3.org/2004/11/n3test#>";

    queryResult = con.prepareTupleQuery(QueryLanguage.SERQL, query).evaluate();

    while(queryResult.hasNext()) {
      BindingSet bindingSet = queryResult.next();
      String testURI = bindingSet.getValue("testURI").toString();
      String inputURL = bindingSet.getValue("inputURL").toString();

      suite.addTest(new NegativeParserTest(testURI, inputURL));
    }
    queryResult.close();
    con.close();
    repository.shutDown();

    return suite;
  }
View Full Code Here

   */
  @Override
  protected Repository createRepository(String id)
    throws RepositoryConfigException, RepositoryException
  {
    Repository result = null;

    if (RepositoryConfigUtil.hasRepositoryConfig(getSystemRepository(), id)) {
      result = new HTTPRepository(serverURL, id);
      result.initialize();
    }

    return result;
  }
View Full Code Here

   *         If the manager failed to initialize the SYSTEM repository.
   */
  public void initialize()
    throws RepositoryException
  {
    Repository systemRepository = createSystemRepository();

    synchronized (repositories) {
      repositories.put(SystemRepository.ID, systemRepository);
    }
  }
View Full Code Here

    synchronized (repositories) {
      isRemoved = RepositoryConfigUtil.removeRepositoryConfigs(getSystemRepository(), repositoryID);

      if (isRemoved) {
        logger.debug("Shutdown repository {} after removal of configuration.", repositoryID);
        Repository repository = repositories.remove(repositoryID);

        if (repository != null) {
          repository.shutDown();
        }
      }
    }

    return isRemoved;
View Full Code Here

   */
  public Repository getRepository(String id)
    throws RepositoryConfigException, RepositoryException
  {
    synchronized (repositories) {
      Repository result = repositories.get(id);

      if (result == null) {
        // First call, create and initialize the repository.
        result = createRepository(id);

View Full Code Here

TOP

Related Classes of org.openrdf.repository.Repository

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.