}
return GdlPool.getRelation(rel.getName(), rval);
} else if(gdl instanceof GdlRule) {
GdlRule rule = (GdlRule)gdl;
List<GdlLiteral> rval = new ArrayList<GdlLiteral>();
for(int i=0; i<rule.arity(); i++)
{
rval.add((GdlLiteral) replaceVariableInternal(rule.get(i), toSubstitute, theReplacement));
}
return GdlPool.getRule((GdlSentence) replaceVariableInternal(rule.getHead(), toSubstitute, theReplacement), rval);
} else if(gdl instanceof GdlConstant) {