public static boolean deleteInstances(HyperGraph graph, HGHandle type)
	{		
		int batchSize = 100; // perhaps this should become a parameter
		HGHandle [] batch = new HGHandle[batchSize];
		for (boolean done = false; !done; )
		{
			HGSearchResult<HGHandle> rs = null;
			try
			{
				int fetched = 0;
				graph.getTransactionManager().beginTransaction();
				try
				{
					rs = graph.find(new TypePlusCondition(type));					
					while (fetched < batch.length && rs.hasNext())
						batch[fetched++] = rs.next();
					rs.close();
				}
				finally
				{
					try { graph.getTransactionManager().endTransaction(true); }
					catch (HGTransactionException tex) { throw new HGException(tex); }
				}
				done = fetched == 0;
				graph.getTransactionManager().beginTransaction();
				try
				{
					while (--fetched >= 0)
						if (!graph.remove(batch[fetched]))
							return false;
					graph.getTransactionManager().endTransaction(true);
				}
				catch (Throwable t)
				{
					try { graph.getTransactionManager().endTransaction(false); }
					catch (Throwable t1) { t1.printStackTrace(System.err); }
					done = false;
					HGUtils.wrapAndRethrow(t);
				}
			}
			finally
			{
				HGUtils.closeNoException(rs);
			}
		}
		return true;
	}