src/openCypherParser/AST/MatchClause.cs
/// <summary>
/// Return a new MatchClause mirrors the old one but with anonymous entities filled with
/// a place holder alias
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
Return a new MatchClause mirrors the old one but with anonymous entities filled with
a place holder alias
Return a new MatchClause mirrors the old one but with anonymous entities filled with a place holder alias
public MatchClause AssignGeneratedEntityAliasToAnonEntities(string anonVarPrefix)
        {
            var varIdx = 0;
            var existingAliases = new HashSet<string>(MatchPatterns.SelectMany(p => p.Select(e => e.Alias)).Where(a => !string.IsNullOrEmpty(a)).Distinct());
            if (existingAliases.Any(p => p.StartsWith(anonVarPrefix)))
            {
                throw new TranspilerSyntaxErrorException($"Banned prefix for variable aliases: {anonVarPrefix}. Please consider a different prefix.");
            }
            return new MatchClause()
            {
                MatchPatterns = MatchPatterns.Select(p => new MatchPattern(p.IsOptionalMatch, p.Select(e =>
                {
                    var alias = e.Alias ?? $"{anonVarPrefix}{varIdx++}";
                    var entity = e.Clone();
                    entity.Alias = alias;
                    return entity;
                }))).ToList()
            };
        }
public MatchClause AssignGeneratedEntityAliasToAnonEntities ( string anonVarPrefix ) { var varIdx = 0 ; var existingAliases = new HashSet < string > ( MatchPatterns . SelectMany ( p => p . Select ( e => e . Alias ) ) . Where ( a => ! string . IsNullOrEmpty ( a ) ) . Distinct ( ) ) ; if ( existingAliases . Any ( p => p . StartsWith ( anonVarPrefix ) ) ) { throw new TranspilerSyntaxErrorException ( $" Banned prefix for variable aliases:  { anonVarPrefix } . Please consider a different prefix. " ) ; } return new MatchClause ( ) { MatchPatterns = MatchPatterns . Select ( p => new MatchPattern ( p . IsOptionalMatch , p . Select ( e => { var alias = e . Alias ?? $" { anonVarPrefix } { varIdx ++ } " ; var entity = e . Clone ( ) ; entity . Alias = alias ; return entity ; } ) ) ) . ToList ( ) } ; }
Return a new MatchClause mirrors the old one but with anonymous entities filled with
a place holder alias
Return a new MatchClause mirrors the old one but with anonymous entities filled with a place holder alias
None
anonVarPrefix
string
entity
None