Search in sources :

Example 11 with RelationPlayer

use of ai.grakn.graql.admin.RelationPlayer in project grakn by graknlabs.

the class AbstractVarPattern method addCasting.

private VarPattern addCasting(RelationPlayer relationPlayer) {
    Optional<RelationshipProperty> relationProperty = getProperty(RelationshipProperty.class);
    ImmutableMultiset<RelationPlayer> oldCastings = relationProperty.map(RelationshipProperty::relationPlayers).orElse(ImmutableMultiset.of());
    ImmutableMultiset<RelationPlayer> relationPlayers = Stream.concat(oldCastings.stream(), Stream.of(relationPlayer)).collect(CommonUtil.toImmutableMultiset());
    RelationshipProperty newProperty = RelationshipProperty.of(relationPlayers);
    return relationProperty.map(this::removeProperty).orElse(this).addProperty(newProperty);
}
Also used : RelationshipProperty(ai.grakn.graql.internal.pattern.property.RelationshipProperty) RelationPlayer(ai.grakn.graql.admin.RelationPlayer)

Aggregations

RelationPlayer (ai.grakn.graql.admin.RelationPlayer)11 VarPatternAdmin (ai.grakn.graql.admin.VarPatternAdmin)9 VarPattern (ai.grakn.graql.VarPattern)8 GraknTx (ai.grakn.GraknTx)7 Label (ai.grakn.concept.Label)7 SchemaConcept (ai.grakn.concept.SchemaConcept)7 Var (ai.grakn.graql.Var)7 Concept (ai.grakn.concept.Concept)6 ConceptId (ai.grakn.concept.ConceptId)6 Relationship (ai.grakn.concept.Relationship)6 Role (ai.grakn.concept.Role)6 GraqlQueryException (ai.grakn.exception.GraqlQueryException)6 Graql (ai.grakn.graql.Graql)6 Atomic (ai.grakn.graql.admin.Atomic)6 MultiUnifier (ai.grakn.graql.admin.MultiUnifier)6 ReasonerQuery (ai.grakn.graql.admin.ReasonerQuery)6 Unifier (ai.grakn.graql.admin.Unifier)6 RelationshipProperty (ai.grakn.graql.internal.pattern.property.RelationshipProperty)6 MultiUnifierImpl (ai.grakn.graql.internal.reasoner.MultiUnifierImpl)6 UnifierImpl (ai.grakn.graql.internal.reasoner.UnifierImpl)6