use of ai.grakn.graql.analytics.PathQuery in project grakn by graknlabs.
the class GraqlTest method testPath.
@Test
public void testPath() throws InvalidKBException {
addSchemaAndEntities();
try (GraknTx graph = session.open(GraknTxType.WRITE)) {
PathQuery query = graph.graql().parse("compute path from '" + entityId1 + "' to '" + entityId2 + "';");
Optional<List<Concept>> path = query.execute();
List<String> result = path.get().stream().map(Concept::getId).map(ConceptId::getValue).collect(Collectors.toList());
List<String> expected = Lists.newArrayList(entityId1, relationId12, entityId2);
assertEquals(expected, result);
}
}