Search in sources :

Example 41 with QueryImpl

use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.

the class EdgeQueryFunctionalTest method testORQuery.

@Test
public void testORQuery() throws Exception {
    QueryImpl q = configQuery("(SOURCE == 'EARTH' || SOURCE == 'PLUTO')", auths);
    EdgeQueryLogic logic = runLogic(q, auths);
    List<String> expected = new ArrayList<>();
    expected.add("earth%00;mars AdjacentPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("earth%00;moon AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("earth%00;venus AdjacentPlanets/TO-FROM:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("earth STATS/ACTIVITY/Planets/TO:20150713/COSMOS_DATA [B]");
    expected.add("pluto%00;charon AdjacentCelestialBodies/FROM-TO:20150713/NEW_HORIZONS-NEW_HORIZONS [C]");
    expected.add("pluto%00;neptune AdjacentDwarfPlanets/FROM-TO:20150713/NEW_HORIZONS-NEW_HORIZONS [C]");
    expected.add("pluto%00;neptune AdjacentPlanets/TO-FROM:20150713/NEW_HORIZONS-NEW_HORIZONS [C]");
    expected.add("pluto STATS/ACTIVITY/DwarfPlanets/TO:20150713/NEW_HORIZONS [D]");
    compareResults(logic, expected);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 42 with QueryImpl

use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.

the class EdgeQueryFunctionalTest method testRegExQueryStatsOn.

@Test
public void testRegExQueryStatsOn() throws Exception {
    QueryImpl q = configQuery("(SOURCE =~ 'M.*')", auths);
    q.addParameter("stats", "true");
    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]");
    expected.add("mercury%00;sun AdjacentCelestialBodies/TO-FROM:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("mercury STATS/ACTIVITY/Planets/TO:20150713/COSMOS_DATA [B]");
    expected.add("moon%00;earth AdjacentCelestialBodies/TO-FROM:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("mercury%00;venus AdjacentPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("mars%00;ceres AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [B]");
    expected.add("mars%00;ceres AdjacentDwarfPlanets/TO-FROM:20150713/COSMOS_DATA-COSMOS_DATA [B]");
    compareResults(logic, expected);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 43 with QueryImpl

use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.

the class EdgeQueryFunctionalTest method testCombinationQuery.

@Test
public void testCombinationQuery() throws Exception {
    QueryImpl q = configQuery("(SOURCE == 'EARTH' || SOURCE == 'ASTEROID_BELT') && (SINK == 'MARS')", auths);
    EdgeQueryLogic logic = runLogic(q, auths);
    List<String> expected = new ArrayList<>();
    expected.add("earth%00;mars AdjacentPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("earth STATS/ACTIVITY/Planets/TO:20150713/COSMOS_DATA [B]");
    expected.add("asteroid_belt%00;mars AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    compareResults(logic, expected);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 44 with QueryImpl

use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.

the class EdgeQueryFunctionalTest method testLiteralWithPatternAndRelation.

@Test
public void testLiteralWithPatternAndRelation() throws Exception {
    QueryImpl q = configQuery("(( SOURCE == 'CERES') && ( SINK =~ 'JUP.*' ) && ( RELATION ==  'FROM-TO' || RELATION == 'TO-FROM') ) || ( (SOURCE =~ 'E.*') && (SINK == 'MARS' ) ) ", auths);
    EdgeQueryLogic logic = runLogic(q, auths);
    List<String> expected = new ArrayList<>();
    expected.add("ceres%00;jupiter AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("ceres%00;jupiter AdjacentDwarfPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [B]");
    expected.add("earth%00;mars AdjacentPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("ceres STATS/ACTIVITY/DwarfPlanets/TO:20150713/COSMOS_DATA [D]");
    expected.add("earth STATS/ACTIVITY/Planets/TO:20150713/COSMOS_DATA [B]");
    expected.add("eris STATS/ACTIVITY/DwarfPlanets/TO:20150713/COSMOS_DATA [D]");
    compareResults(logic, expected);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 45 with QueryImpl

use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.

the class EdgeQueryFunctionalTest method testCombinationQueryWithPattern.

@Test
public void testCombinationQueryWithPattern() throws Exception {
    QueryImpl q = configQuery("(SOURCE =~ 'E.*' || SOURCE == 'ASTEROID_BELT') && (SINK == 'MARS')", auths);
    EdgeQueryLogic logic = runLogic(q, auths);
    List<String> expected = new ArrayList<>();
    expected.add("earth%00;mars AdjacentPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("earth STATS/ACTIVITY/Planets/TO:20150713/COSMOS_DATA [B]");
    expected.add("asteroid_belt%00;mars AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
    expected.add("eris STATS/ACTIVITY/DwarfPlanets/TO:20150713/COSMOS_DATA [D]");
    compareResults(logic, expected);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

QueryImpl (datawave.webservice.query.QueryImpl)131 Test (org.junit.Test)96 ArrayList (java.util.ArrayList)54 Query (datawave.webservice.query.Query)40 HashSet (java.util.HashSet)27 BaseQueryLogic (datawave.webservice.query.logic.BaseQueryLogic)18 GenericQueryConfiguration (datawave.webservice.query.configuration.GenericQueryConfiguration)16 Date (java.util.Date)16 QueryParametersImpl (datawave.webservice.query.QueryParametersImpl)14 MultivaluedMapImpl (org.jboss.resteasy.specimpl.MultivaluedMapImpl)13 QueryMetricFactoryImpl (datawave.microservice.querymetric.QueryMetricFactoryImpl)12 QueryParameters (datawave.webservice.query.QueryParameters)12 Value (org.apache.accumulo.core.data.Value)10 Document (datawave.query.attributes.Document)9 ShardQueryConfiguration (datawave.query.config.ShardQueryConfiguration)9 EdgeQueryFunctionalTest (datawave.query.tables.edge.EdgeQueryFunctionalTest)9 QueryLogic (datawave.webservice.query.logic.QueryLogic)9 HashMap (java.util.HashMap)9 Key (org.apache.accumulo.core.data.Key)9 Authorizations (org.apache.accumulo.core.security.Authorizations)9