1 6 7 package com.hp.hpl.jena.db.test; 8 9 import com.hp.hpl.jena.graph.*; 10 import com.hp.hpl.jena.db.*; 11 import com.hp.hpl.jena.shared.*; 12 13 import java.util.*; 14 15 import junit.framework.*; 16 17 21 public class TestQuery1 extends AbstractTestQuery1 22 { 23 public TestQuery1( String name ) 24 { super( name ); } 25 26 public static TestSuite suite() 27 { return new TestSuite( TestQuery1.class ); } 28 29 private IDBConnection theConnection; 30 private int count = 0; 31 32 private List graphs; 33 34 public void setUp() throws Exception 35 { 36 theConnection = TestConnection.makeTestConnection(); 37 graphs = new ArrayList(); 38 super.setUp(); 39 } 40 41 public void tearDown() throws Exception 42 { 43 removeGraphs(); 44 theConnection.close(); 45 super.tearDown(); 46 } 47 48 private void removeGraphs() 49 { for (int i = 0; i < graphs.size(); i += 1) ((GraphRDB) graphs.get(i)).remove(); } 50 51 public Graph getGraph ( ) { 52 return getGraph( ReificationStyle.Minimal ); 53 } 54 55 public Graph getGraph ( ReificationStyle style ) 56 { 57 String name = "jena-test-rdb-TestQuery1-" + count ++; 58 if (theConnection.containsModel( name )) makeGraph( name, false, style ).remove(); 59 GraphRDB result = makeGraph( name, true, style ); 60 graphs.add( result ); 61 return result; 62 } 63 64 protected GraphRDB makeGraph( String name, boolean fresh, ReificationStyle style ) 65 { return new GraphRDB 66 ( 67 theConnection, 68 name, 69 theConnection.getDefaultModelProperties().getGraph(), 70 GraphRDB.styleRDB( style ), 71 fresh 72 ); } 73 74 } 75 76 77 78 79 80 | Popular Tags |