Search in sources :

Example 1 with GraknAdmin

use of ai.grakn.kb.admin.GraknAdmin in project grakn by graknlabs.

the class GraqlCompleter method create.

public static GraqlCompleter create(GraknSession session) {
    ImmutableSet<Label> labels;
    try (GraknAdmin tx = session.open(GraknTxType.READ).admin()) {
        Stream<SchemaConcept> metaConcepts = Stream.of(tx.getMetaConcept(), tx.getMetaRole(), tx.getMetaRule()).flatMap(SchemaConcept::subs);
        labels = metaConcepts.map(SchemaConcept::getLabel).collect(toImmutableSet());
    }
    return new GraqlCompleter(labels);
}
Also used : Label(ai.grakn.concept.Label) GraknAdmin(ai.grakn.kb.admin.GraknAdmin) SchemaConcept(ai.grakn.concept.SchemaConcept)

Aggregations

Label (ai.grakn.concept.Label)1 SchemaConcept (ai.grakn.concept.SchemaConcept)1 GraknAdmin (ai.grakn.kb.admin.GraknAdmin)1