use of com.orientechnologies.orient.core.command.OBasicCommandContext in project orientdb by orientechnologies.
the class OSQLFunctionAstarTest method test1Execute.
@Test
public void test1Execute() throws Exception {
Map<String, Object> options = new HashMap<String, Object>();
options.put(OSQLFunctionAstar.PARAM_DIRECTION, "out");
options.put(OSQLFunctionAstar.PARAM_PARALLEL, true);
options.put(OSQLFunctionAstar.PARAM_EDGE_TYPE_NAMES, new String[] { "has_path" });
final List<OrientVertex> result = functionAstar.execute(null, null, null, new Object[] { v1, v4, "'weight'", options }, new OBasicCommandContext());
assertEquals(16, graph.countEdges("has_path"));
assertEquals(4, result.size());
assertEquals(v1, result.get(0));
assertEquals(v2, result.get(1));
assertEquals(v3, result.get(2));
assertEquals(v4, result.get(3));
}
use of com.orientechnologies.orient.core.command.OBasicCommandContext in project orientdb by orientechnologies.
the class OSQLFunctionAstarTest method test9Execute.
@Test
public void test9Execute() throws Exception {
Map<String, Object> options = new HashMap<String, Object>();
options.put(OSQLFunctionAstar.PARAM_DIRECTION, Direction.BOTH);
options.put(OSQLFunctionAstar.PARAM_PARALLEL, true);
options.put(OSQLFunctionAstar.PARAM_TIE_BREAKER, false);
options.put(OSQLFunctionAstar.PARAM_EDGE_TYPE_NAMES, new String[] { "has_path" });
options.put(OSQLFunctionAstar.PARAM_VERTEX_AXIS_NAMES, new String[] { "lat", "lon" });
options.put(OSQLFunctionAstar.PARAM_HEURISTIC_FORMULA, HeuristicFormula.MAXAXIS);
final List<OrientVertex> result = functionAstar.execute(null, null, null, new Object[] { v6, v1, "'weight'", options }, new OBasicCommandContext());
assertEquals(16, graph.countEdges("has_path"));
assertEquals(3, result.size());
assertEquals(v6, result.get(0));
assertEquals(v5, result.get(1));
assertEquals(v1, result.get(2));
}
use of com.orientechnologies.orient.core.command.OBasicCommandContext in project orientdb by orientechnologies.
the class OSQLFunctionAstarTest method test11Execute.
@Test
public void test11Execute() throws Exception {
Map<String, Object> options = new HashMap<String, Object>();
options.put(OSQLFunctionAstar.PARAM_DIRECTION, Direction.OUT);
options.put(OSQLFunctionAstar.PARAM_PARALLEL, true);
options.put(OSQLFunctionAstar.PARAM_TIE_BREAKER, false);
options.put(OSQLFunctionAstar.PARAM_EMPTY_IF_MAX_DEPTH, true);
options.put(OSQLFunctionAstar.PARAM_MAX_DEPTH, 3);
options.put(OSQLFunctionAstar.PARAM_EDGE_TYPE_NAMES, new String[] { "has_path" });
options.put(OSQLFunctionAstar.PARAM_VERTEX_AXIS_NAMES, new String[] { "lat", "lon" });
options.put(OSQLFunctionAstar.PARAM_HEURISTIC_FORMULA, HeuristicFormula.CUSTOM);
options.put(OSQLFunctionAstar.PARAM_CUSTOM_HEURISTIC_FORMULA, "myCustomHeuristic");
final List<OrientVertex> result = functionAstar.execute(null, null, null, new Object[] { v6, v1, "'weight'", options }, new OBasicCommandContext());
assertEquals(16, graph.countEdges("has_path"));
assertEquals(0, result.size());
}
use of com.orientechnologies.orient.core.command.OBasicCommandContext in project orientdb by orientechnologies.
the class OSQLFunctionDijkstraTest method testExecute.
@Test
public void testExecute() throws Exception {
final List<OrientVertex> result = functionDijkstra.execute(null, null, null, new Object[] { v1, v4, "'weight'" }, new OBasicCommandContext());
assertEquals(4, result.size());
assertEquals(v1, result.get(0));
assertEquals(v2, result.get(1));
assertEquals(v3, result.get(2));
assertEquals(v4, result.get(3));
}
use of com.orientechnologies.orient.core.command.OBasicCommandContext in project orientdb by orientechnologies.
the class OSQLFunctionShortestPathTest method testMaxDepth1.
@Test
public void testMaxDepth1() throws Exception {
Map<String, Object> additionalParams = new HashMap<String, Object>();
additionalParams.put(OSQLFunctionShortestPath.PARAM_MAX_DEPTH, 11);
final List<ORID> result = function.execute(null, null, null, new Object[] { vertices.get(1), vertices.get(20), null, null, additionalParams }, new OBasicCommandContext());
assertEquals(11, result.size());
}
Aggregations