Advertisement
jbjares

Untitled

Oct 21st, 2014
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1.     public void insertAsTriples(SimulationInstanceProcessManagerTO simulationInstanceProcessManagerTO) throws Exception {
  2.            
  3.             List<Triple> triplesList = simulationInstanceProcessManagerTO.getTripleList();
  4.             String namedGraph = simulationInstanceProcessManagerTO.getNamedGraph();
  5.            
  6.             for (Triple triple : triplesList) {
  7.                 VirtGraph virtGraph = new VirtGraph(" <"+namedGraph+"> ",virtDataSource.getGraphUrl(),virtDataSource.getGraphUser(),virtDataSource.getGraphPassword());
  8.                 try{
  9.                     //virtGraph.clear();
  10.                     virtGraph.performAdd(triple);
  11.                 }catch(Exception e){
  12.                     String tripleStr = namedGraph+": "+triple.getSubject().toString()+" "+triple.getPredicate().toString()+" "+triple.getObject().toString();
  13.                     System.err.println("Error ["+tripleStr+"] "+e.getStackTrace());
  14.                     continue;
  15.                 }finally{
  16.                     if(!virtGraph.isClosed()){
  17.                         virtGraph.close();                 
  18.                     }
  19.                 }
  20.                
  21.                
  22.             }          
  23.  
  24.        
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement