Partially ordered regular languages for graph queries