use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class EdgeQueryFunctionalTest method testNOT.
@Test
public void testNOT() throws Exception {
QueryImpl q = configQuery("SOURCE == 'MARS' && SINK != 'CERES'", auths);
EdgeQueryLogic logic = runLogic(q, auths);
List<String> expected = new ArrayList<>();
expected.add("mars%00;jupiter AdjacentPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
expected.add("mars%00;earth AdjacentPlanets/TO-FROM:20150713/COSMOS_DATA-COSMOS_DATA [A]");
expected.add("mars STATS/ACTIVITY/Planets/TO:20150713/COSMOS_DATA [B]");
expected.add("mars%00;asteroid_belt AdjacentCelestialBodies/TO-FROM:20150713/COSMOS_DATA-COSMOS_DATA [A]");
compareResults(logic, expected);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class EdgeQueryFunctionalTest method testComplexQuery3.
@Test
public void testComplexQuery3() throws Exception {
QueryImpl q = configQuery("(SOURCE == 'MARS' && SINK == 'JUPITER') || (SOURCE == 'ASTEROID_BELT' && SINK == 'MARS') " + "|| (SOURCE == 'ASTEROID_BELT' && SINK == 'JUPITER')", auths);
EdgeQueryLogic logic = runLogic(q, auths);
List<String> expected = new ArrayList<>();
expected.add("mars%00;jupiter AdjacentPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
expected.add("asteroid_belt%00;mars AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
expected.add("asteroid_belt%00;jupiter AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
expected.add("mars STATS/ACTIVITY/Planets/TO:20150713/COSMOS_DATA [B]");
compareResults(logic, expected);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DatawaveSelectorExtractorTest method extractSelectorsNegation.
@Test
public void extractSelectorsNegation() {
DatawaveSelectorExtractor extractor = new DatawaveSelectorExtractor();
QueryImpl q = new QueryImpl();
q.setQuery("FIELD1:selector1 NOT selector2");
List<String> selectorList = extractor.extractSelectors(q);
List<String> expected = Lists.newArrayList("selector1");
Assert.assertEquals(expected, selectorList);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DatawaveSelectorExtractorTest method extractSelectorsTripleNegation.
@Test
public void extractSelectorsTripleNegation() {
DatawaveSelectorExtractor extractor = new DatawaveSelectorExtractor();
QueryImpl q = new QueryImpl();
q.setQuery("FIELD1:selector1 NOT (selector2 NOT (selector3 NOT selector4))");
List<String> selectorList = extractor.extractSelectors(q);
List<String> expected = Lists.newArrayList("selector1", "selector3");
Assert.assertEquals(expected, selectorList);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DatawaveSelectorExtractorTest method extractSelectorsWildcard.
@Test
public void extractSelectorsWildcard() {
DatawaveSelectorExtractor extractor = new DatawaveSelectorExtractor();
QueryImpl q = new QueryImpl();
q.setQuery("FIELD1:selector1 AND selector.*");
List<String> selectorList = extractor.extractSelectors(q);
List<String> expected = Lists.newArrayList("selector1");
Assert.assertEquals(expected, selectorList);
}
Aggregations