QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory();
Selector selector = qomFactory.selector(NodeType.NT_BASE, "category");
// Build and execute the query ...
Query query = qomFactory.createQuery(selector, qomFactory.childNode("category", "/Cars"), null, new Column[0]);
assertThat(query.getStatement(), is("SELECT * FROM [{http://www.jcp.org/jcr/nt/1.0}base] AS category WHERE ISCHILDNODE(category,'/Cars')"));
QueryResult result = query.execute();
validateQuery().rowCount(4).hasColumns(allColumnNames("category")).validate(query, result);
}