public void loadSomeData(Repository repo) throws Exception {
  RepositoryConnection cxn=repo.getConnection();
  cxn.setAutoCommit(false);
  try {
    Resource s=new URIImpl("http://www.bigdata.com/rdf#Mike");
    URI p=new URIImpl("http://www.bigdata.com/rdf#loves");
    Value o=new URIImpl("http://www.bigdata.com/rdf#RDF");
    Statement stmt=new StatementImpl(s,p,o);
    cxn.add(stmt);
    cxn.commit();
  }
 catch (  Exception ex) {
    cxn.rollback();
    throw ex;
  }
 finally {
    cxn.close();
  }
}

public void loadSomeData ( Repository repo ) throws Exception { RepositoryConnection cxn = repo . getConnection ( ) ; cxn . setAutoCommit ( false ) ; try { Resource s = new URIImpl ( "http://www.bigdata.com/rdf#Mike" ) ; URI p = new URIImpl ( "http://www.bigdata.com/rdf#loves" ) ; Value o = new URIImpl ( "http://www.bigdata.com/rdf#RDF" ) ; Statement stmt = new StatementImpl ( s , p , o ) ; cxn . add ( stmt ) ; cxn . commit ( ) ; } catch ( Exception ex ) { cxn . rollback ( ) ; throw ex ; } finally { cxn . close ( ) ; } }
add a statement to a repository .
