use of ai.grakn.graql.internal.analytics.KCoreVertexProgram in project grakn by graknlabs.
the class TinkerComputeQueryRunner method run.
public ComputeJob<Map<String, Set<String>>> run(KCoreQuery query) {
return runCompute(query, tinkerComputeQuery -> {
long k = query.kValue();
if (k < 2L)
throw GraqlQueryException.kValueSmallerThanTwo();
if (!tinkerComputeQuery.selectedTypesHaveInstance()) {
return Collections.emptyMap();
}
ComputerResult result;
Set<LabelId> subLabelIds = convertLabelsToIds(tinkerComputeQuery.subLabels());
try {
result = tinkerComputeQuery.compute(new KCoreVertexProgram(k), new ClusterMemberMapReduce(KCoreVertexProgram.K_CORE_LABEL), subLabelIds);
} catch (NoResultException e) {
return Collections.emptyMap();
}
return result.memory().get(ClusterMemberMapReduce.class.getName());
});
}
Aggregations