use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DefaultEdgeEventQueryLogicTest method orAbleFieldtest.
@Test(expected = IllegalArgumentException.class)
public void orAbleFieldtest() throws Exception {
Query query = new QueryImpl();
query.setQuery("SOURCE == 'sourceValue' AND SINK == 'targetValue' AND TYPE == 'TEST1' AND RELATION == 'REL1-REL2' AND ATTRIBUTE1 == 'SOURCE1-SOURCE2' AND (ATTRIBUTE2 == 'red' OR ATTRIBUTE2 == 'blue')");
String transformed = logic.getEventQuery(query);
assertEquals("(SOURCEFIELD == 'sourceValue' AND TARGETFIELD == 'targetValue' AND ENRICHFIELD == 'enrichValue')", transformed);
query = new QueryImpl();
query.setQuery("SOURCE == 'sourceValue' AND SINK == 'targetValue' AND TYPE == 'TEST1' AND RELATION == 'REL1-REL2' AND (ATTRIBUTE1 == 'SOURCE1-SOURCE2' OR ATTRIBUTE1 == 'SOURCE2-SOURCE2')");
// throws
transformed = logic.getEventQuery(query);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DefaultEdgeEventQueryLogicTest method testGroupedEnrichmentField.
@Test
public void testGroupedEnrichmentField() throws Exception {
Query query = new QueryImpl();
query.setQuery("SOURCE == 'sourceValue' AND SINK == 'targetValue' AND TYPE == 'TEST8' AND RELATION == 'REL1-REL2' AND ATTRIBUTE1 == 'SOURCE1-SOURCE2'");
String transformed = logic.getEventQuery(query);
assertEquals("(SOURCEFIELD == 'sourceValue' AND TARGETFIELD == 'targetValue' AND $1_5 == 'enrichValue')", transformed);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DefaultEdgeEventQueryLogicTest method testInvalidEdgeEventQuery.
@Test(expected = IllegalArgumentException.class)
public void testInvalidEdgeEventQuery() throws Exception {
Query query = new QueryImpl();
query.setQuery("SOURCE == 'sourceValue' AND TYPE == 'TEST1' AND RELATION == 'REL1-REL2' AND ATTRIBUTE1 == 'SOURCE1-SOURCE2'");
// throws
logic.getEventQuery(query);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class EdgeQueryFunctionalTest method testUnknownFunction.
@Test(expected = UnsupportedOperationException.class)
public void testUnknownFunction() throws Exception {
QueryImpl q = configQuery("SOURCE == 'SUN' && (filter:includeregex(SINK, 'earth|mars'))", auths);
EdgeQueryLogic logic = runLogic(q, auths);
List<String> expected = new ArrayList<>();
compareResults(logic, expected);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class EdgeQueryFunctionalTest method testComplexQuery1.
@Test
public void testComplexQuery1() throws Exception {
QueryImpl q = configQuery("(SOURCE == 'EARTH' || SOURCE == 'PLUTO' || SOURCE == 'MARS' || SOURCE == 'CERES' || SOURCE == 'ASTEROID_BELT') && RELATION == 'FROM-TO' && TYPE == 'AdjacentCelestialBodies'", auths);
EdgeQueryLogic logic = runLogic(q, auths);
List<String> expected = new ArrayList<>();
expected.add("earth%00;moon AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
expected.add("pluto%00;charon AdjacentCelestialBodies/FROM-TO:20150713/NEW_HORIZONS-NEW_HORIZONS [C]");
expected.add("mars%00;ceres AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [B]");
expected.add("ceres%00;jupiter AdjacentCelestialBodies/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;ceres AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
expected.add("asteroid_belt%00;jupiter AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
compareResults(logic, expected);
}
Aggregations