public void setDefaultTripleStore() { tripleStore = new TripleStore(); }
public static TripleStore getDefaultTripleStore() { return new TripleStore(); }
@Test public void testMassAddRemove() { TripleStore store = new TripleStore( ); int instanceLength = 1 * 1000 * 30; int tripleLength = 70; Triple t = null; List<Individual> inds = new ArrayList<Individual>(instanceLength); for ( int i = 0; i < instanceLength; i++) { Individual ind = new Individual(); inds.add( ind ); for (int j = 0; j < tripleLength; j++) { t = new TripleImpl(ind, getPropertyName(j), i*j); assertFalse( store.put( t ) ); } } assertEquals( instanceLength * tripleLength, store.size() ); for ( int i = 0; i < instanceLength; i++) { for (int j = 0; j < tripleLength; j++) { t = new TripleImpl(inds.get( i ),getPropertyName(j), V ); store.removeAll( t ); } } assertEquals( 0, store.size() ); }
@Test public void testPutAndGet() { // We know it needs to hold a lot of triples, so instantiate it with huge capacity. // A lower capacity ensures a larger capacity per number of triples, i.e. less collision - default is 0.75f TripleStore store = new TripleStore(10*100*1000, 0.6f ); Individual ind = new Individual(); Triple t = new TripleImpl(ind, "hasName", "mark"); assertFalse( store.put( t ) ); Triple tKey = new TripleImpl(ind, "hasName", V ); t = store.get( tKey ); assertEquals("mark", t.getValue() ); }
@Test public void testQueryVariable() { TripleStore store = new TripleStore(10*100*1000, 0.6f ); Individual ind = new Individual();
@Test public void testPutAndGetWithExisting() { // We know it needs to hold a lot of triples, so instantiate it with huge capacity. // A lower capacity ensures a larger capacity per number of triples, i.e. less collision - default is 0.75f TripleStore store = new TripleStore(10*100*1000, 0.6f ); Individual ind = new Individual(); Triple t = new TripleImpl(ind, "hasName", "mark"); assertFalse( store.put( t ) ); Triple tKey = new TripleImpl(ind, "hasName", V ); t = store.get( tKey ); assertEquals("mark", t.getValue() ); t = new TripleImpl(ind, "hasName", "davide"); assertTrue( store.put( t ) ); tKey = new TripleImpl(ind, "hasName", V ); t = store.get( tKey ); assertEquals("davide", t.getValue() ); }
@Test public void testPutAndGetandRemove() { // We know it needs to hold a lot of triples, so instantiate it with huge capacity. // A lower capacity ensures a larger capacity per number of triples, i.e. less collision - default is 0.75f TripleStore store = new TripleStore(10*100*1000, 0.6f ); Individual ind = new Individual(); Triple t = new TripleImpl(ind, "hasName", "mark"); assertFalse( store.put( t ) ); Triple tKey = new TripleImpl(ind, "hasName", V ); t = store.get( tKey ); assertEquals("mark", t.getValue() ); t = new TripleImpl(ind, "hasName", V ); assertEquals( 1, store.removeAll( t ) ); assertFalse( store.remove( t ) ); // try again and make sure it's false. tKey = new TripleImpl(ind, "hasName", V ); assertNull( store.get( tKey ) ); }
@Test public void testAddNary() { TripleStore store = new TripleStore(200, 0.6f ); Individual ind = new Individual();