porting query api 1