Search in sources :

Example 16 with IdPredicate

use of ai.grakn.graql.internal.reasoner.atom.predicate.IdPredicate in project grakn by graknlabs.

the class AbstractIsaProperty method mapToAtom.

@Nullable
@Override
public final Atomic mapToAtom(VarPatternAdmin var, Set<VarPatternAdmin> vars, ReasonerQuery parent) {
    // IsaProperty is unique within a var, so skip if this is a relation
    if (var.hasProperty(RelationshipProperty.class))
        return null;
    Var varName = var.var().asUserDefined();
    VarPatternAdmin typePattern = this.type();
    Var typeVariable = typePattern.var();
    IdPredicate predicate = getIdPredicate(typeVariable, typePattern, vars, parent);
    ConceptId predicateId = predicate != null ? predicate.getPredicate() : null;
    // isa part
    VarPatternAdmin isaVar = varPatternForAtom(varName, typeVariable).admin();
    return IsaAtom.create(isaVar, typeVariable, predicateId, parent);
}
Also used : IdPredicate(ai.grakn.graql.internal.reasoner.atom.predicate.IdPredicate) ReasonerUtils.getIdPredicate(ai.grakn.graql.internal.reasoner.utils.ReasonerUtils.getIdPredicate) VarPatternAdmin(ai.grakn.graql.admin.VarPatternAdmin) Var(ai.grakn.graql.Var) ConceptId(ai.grakn.concept.ConceptId) Nullable(javax.annotation.Nullable)

Aggregations

IdPredicate (ai.grakn.graql.internal.reasoner.atom.predicate.IdPredicate)16 ConceptId (ai.grakn.concept.ConceptId)11 Var (ai.grakn.graql.Var)11 VarPatternAdmin (ai.grakn.graql.admin.VarPatternAdmin)9 ReasonerUtils.getIdPredicate (ai.grakn.graql.internal.reasoner.utils.ReasonerUtils.getIdPredicate)5 Atomic (ai.grakn.graql.admin.Atomic)4 GraknTx (ai.grakn.GraknTx)3 Concept (ai.grakn.concept.Concept)3 Label (ai.grakn.concept.Label)3 Role (ai.grakn.concept.Role)3 GraqlQueryException (ai.grakn.exception.GraqlQueryException)3 ReasonerQuery (ai.grakn.graql.admin.ReasonerQuery)3 Atom (ai.grakn.graql.internal.reasoner.atom.Atom)3 Pair (ai.grakn.graql.internal.reasoner.utils.Pair)3 Sets (com.google.common.collect.Sets)3 Set (java.util.Set)3 Stream (java.util.stream.Stream)3 Nullable (javax.annotation.Nullable)3 Relationship (ai.grakn.concept.Relationship)2 SchemaConcept (ai.grakn.concept.SchemaConcept)2