function createQueryFieldMatchStatement()

in templates/JSResolverOCHTTPS.js [575:599]


function createQueryFieldMatchStatement(fieldSchemaInfo, lastNamePath) {
    // solution until CALL subquery is supported in Neptune openCypher
    
    const refactored = graphQueryRefactoring(lastNamePath, fieldSchemaInfo);

    if (refactored.queryMatch.toUpperCase().includes('MATCH'))
        refactored.queryMatch = 'OPTIONAL ' + refactored.queryMatch;            
    matchStatements.push(refactored.queryMatch);

    if ( refactored.returnAggregation != '' ) {
        const thisWithId = withStatements.push({carryOver: refactored.returnCarryOver, inLevel: '', content: `${refactored.returnAggregation} AS ${refactored.inLevel}`}) -1;        
        let i = withStatements.findIndex(({carryOver}) => carryOver.startsWith(lastNamePath));        
        
        withStatements[i].content += refactored.inLevel;

        for (let p = thisWithId -1; p > i; p--) {          
            withStatements[p].inLevel += refactored.inLevel + ', ';
        }

    } else {
        // no new with, just add it to lastnamepath content
        // maybe not needed
    }
        
}