Chemistry and line emission from evolving Herbig Ae disks