more work on implementing toAQLFragment()