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);
}
Aggregations