Search in sources :

Example 1 with RelationshipProperty

use of ai.grakn.graql.internal.pattern.property.RelationshipProperty 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)1 RelationshipProperty (ai.grakn.graql.internal.pattern.property.RelationshipProperty)1