@Test void testComplexQuery() throws RSQLParserException { Attribute nameAttr = when(mock(Attribute.class).getDataType()).thenReturn(STRING).getMock(); Attribute ageAttr = when(mock(Attribute.class).getDataType()).thenReturn(INT).getMock(); doReturn(nameAttr).when(entityType).getAttribute("name"); doReturn(ageAttr).when(entityType).getAttribute("age"); Query<Entity> q = molgenisRSQL.createQuery("((name==piet;age==87),(name==klaas;age>100))", repository); assertEquals( new QueryImpl<>() .nest() .nest() .eq("name", "piet") .and() .eq("age", 87) .unnest() .or() .nest() .eq("name", "klaas") .and() .gt("age", 100) .unnest() .unnest(), q); }
public Query<Entity> createQuery(String rsql, Repository<Entity> repository) { Node rootNode = rsqlParser.parse(rsql); MolgenisRSQLVisitor visitor = new MolgenisRSQLVisitor(repository); return rootNode.accept(visitor); }
MolgenisRSQL { public Query<Entity> createQuery(String rsql, Repository<Entity> repository) { Node rootNode = rsqlParser.parse(rsql); MolgenisRSQLVisitor visitor = new MolgenisRSQLVisitor(repository); return rootNode.accept(visitor); } }
MolgenisRSQL { public Query<Entity> createQuery(String rsql, Repository<Entity> repository) { Node rootNode = rsqlParser.parse(rsql); MolgenisRSQLVisitor visitor = new MolgenisRSQLVisitor(repository); return rootNode.accept(visitor); } MolgenisRSQL(RSQLParser rsqlParser); }
MolgenisRSQL { public Query<Entity> createQuery(String rsql, Repository<Entity> repository) { Node rootNode = rsqlParser.parse(rsql); MolgenisRSQLVisitor visitor = new MolgenisRSQLVisitor(repository); return rootNode.accept(visitor); } MolgenisRSQL(RSQLParser rsqlParser); Query<Entity> createQuery(String rsql, Repository<Entity> repository); }
MolgenisRSQL { public Query<Entity> createQuery(String rsql, Repository<Entity> repository) { Node rootNode = rsqlParser.parse(rsql); MolgenisRSQLVisitor visitor = new MolgenisRSQLVisitor(repository); return rootNode.accept(visitor); } MolgenisRSQL(RSQLParser rsqlParser); Query<Entity> createQuery(String rsql, Repository<Entity> repository);  }