// TODO Cover the other graph exceptions in tests - currently only the first one is test driven.
// Search for Unable to remove nonexistent statement.
public void remove(Long... quin) throws GraphException {
ClosableMap<Long, ClosableMap<Long, ClosableMap<Long, Set<Long>>>> mids = index.get(quin[0]);
if (null == mids) {
throw new GraphException("Failed to remove nonexistent triple");
}
ClosableMap<Long, ClosableMap<Long, Set<Long>>> subjectIndex = mids.get(quin[1]);
if (null == subjectIndex) {
throw new GraphException("Failed to remove nonexistent triple");
}
Map<Long, Set<Long>> predicateIndex = subjectIndex.get(quin[2]);
if (null == predicateIndex) {
throw new GraphException("Failed to remove nonexistent triple");
}
Set<Long> objectIndex = predicateIndex.get(quin[3]);
if (null == objectIndex) {
throw new GraphException("Unable to remove nonexistent statement");
}
if (!objectIndex.remove(quin[4])) {
throw new GraphException("Unable to remove nonexistent statement");
}
if (objectIndex.isEmpty()) {
predicateIndex.remove(quin[3]);
if (predicateIndex.isEmpty()) {
subjectIndex.remove(quin[2]);