Search in sources :

Example 46 with VarPattern

use of ai.grakn.graql.VarPattern in project grakn by graknlabs.

the class InstanceMapper method map.

/**
 * Map a {@link Relationship} to a var, along with all of the roleplayers
 * Exclude any relations that are mapped to an encountered resource
 * @param relationship {@link Relationship} to be mapped
 * @return var patterns representing the given instance
 */
// TODO resources on relations
private static VarPattern map(Relationship relationship) {
    if (relationship.type().isImplicit()) {
        return var();
    }
    VarPattern var = base(relationship);
    var = roleplayers(var, relationship);
    return var;
}
Also used : VarPattern(ai.grakn.graql.VarPattern)

Aggregations

VarPattern (ai.grakn.graql.VarPattern)46 Test (org.junit.Test)28 Var (ai.grakn.graql.Var)12 Pattern (ai.grakn.graql.Pattern)11 Answer (ai.grakn.graql.admin.Answer)9 GraknTx (ai.grakn.GraknTx)8 Role (ai.grakn.concept.Role)8 Label (ai.grakn.concept.Label)7 RelationshipType (ai.grakn.concept.RelationshipType)7 Graql (ai.grakn.graql.Graql)7 Set (java.util.Set)7 ConceptId (ai.grakn.concept.ConceptId)6 EntityType (ai.grakn.concept.EntityType)6 List (java.util.List)6 Collectors.toSet (java.util.stream.Collectors.toSet)6 SchemaConcept (ai.grakn.concept.SchemaConcept)5 GraqlQueryException (ai.grakn.exception.GraqlQueryException)5 QueryBuilder (ai.grakn.graql.QueryBuilder)5 RelationPlayer (ai.grakn.graql.admin.RelationPlayer)5 VarPatternAdmin (ai.grakn.graql.admin.VarPatternAdmin)5