GdlRule rule = (GdlRule) gdl;
String name = rule.getHead().getName().toString();
if(name.equals("next"))
{
GdlSentence head = rule.getHead();
if(head.arity()!=1)
throw new RuntimeException("Can't next more than one thing as far as I know.");
if(head.get(0) instanceof GdlVariable)
{ //weird case where you have rule like (next ?q)
Location l = new Location();
l.idx = 0;