Examples of RepositoryConnection


Examples of org.openrdf.repository.RepositoryConnection

  public String returnCodeListURI(String codeList)
  {
   
    String codeListURI="";
    try {
         RepositoryConnection con = _repository.getConnection();
         try
         {
           BindingSet bindingSet;

           TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, String.format(SELECT_CodeList_TEMPLATE,codeList));
           TupleQueryResult result = tupleQuery.evaluate();
              
           if(result.hasNext())
             {                
               bindingSet = result.next();
               codeListURI = bindingSet.getValue("sub").toString();
               codeListURI = codeListURI.substring(codeListURI.indexOf("#")+1);
              
             }
              
             result.close();              
         }
         finally {
           con.close();
         }
      }
    catch (OpenRDFException e) {
     
    }

Examples of org.openrdf.repository.RepositoryConnection

     */
    private void assertEncodingDetection(String encoding, String input, String expectedContent)
    throws Exception {
        DocumentSource fileDocumentSource = getDocumentSourceFromResource(input);
        Any23 any23;
        RepositoryConnection conn;
        RepositoryWriter repositoryWriter;
       
        any23 = new Any23();
        Sail store = new MemoryStore();
        store.initialize();
        conn = new SailRepository(store).getConnection();
        repositoryWriter = new RepositoryWriter(conn);
        Assert.assertTrue( any23.extract(fileDocumentSource, repositoryWriter, encoding).hasMatchingExtractors() );

        RepositoryResult<Statement> statements = conn.getStatements(null, vDCTERMS.title, null, false);
        try {
            while (statements.hasNext()) {
                Statement statement = statements.next();
                printStatement(statement);
                org.junit.Assert.assertTrue(statement.getObject().stringValue().contains(expectedContent));
            }
        } finally {
            statements.close();
        }

        fileDocumentSource = null;
        any23 = null;
        conn.close();
        repositoryWriter.close();
    }
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.