copy from http://code.google.com/p/gql4j/
solve conflict