@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 ) ); }
public int removeAll(final Triple triple) { int removed = 0; Collection<Triple> coll = getAll( triple ); for ( Triple t : coll ) { if ( remove(t) ) { removed++; } } return removed; }
public void clear() { for ( Triple t : getTriplesForSubject( getObject() ) ) { store.remove( t ); } }
public void clear() { for ( Triple t : getSchemaTriplesForSubject(getObject()) ) { store.remove( t ); } }
public Object remove(Object key) { return store.remove( store.get( propertyKey ( key ) ) ); }